Debug PowerShell Script so all features work in both Windows 10 & 11

Job ID: 37605378

Budget: £20 – £250 GBP

We have a powershell script where 80% of the functions work but a couple still arent. The script is meant to:

Here's a breakdown of what the code does, step by step:

1. Checks for Administrative Privileges:

Ensures it's running with the necessary permissions to make system changes.

2. Prompts for Confirmation:

Provides information about its purpose and intended use.

Asks for user confirmation to proceed.

3. Disables USB Storage Devices:

Prevents users from connecting USB storage drives to the system.

4. Creates Secure Administrator Account:

Prompts for a strong password.

Creates a new account named "acsadmin" with specific security settings:
Never expires
Password can't be changed by the user
Password never expires
Member of the Administrators group

5. Sets Minimum Password Length:

Enforces a minimum password length of 12 characters for all future user accounts.

6. Configures Lockout Settings:

Sets a 10-minute lockout time for accounts after a certain number of failed login attempts.
Sets a 10-minute screen saver timeout to automatically lock the system when inactive.

7. Sets Default Passwords for Existing Accounts:

Changes the password of most existing user accounts to a default password ("Changeme@12!") and forces users to reset them upon next login.

8. Limits Password Attempts:

Sets the maximum number of incorrect password attempts before an account is locked to 10.

9. Disables Autorun and Autoplay:

Prevents automatic execution of programs from external drives to mitigate malware risks.

10. Converts Accounts to Standard Users:

Changes most existing user accounts to standard user accounts with limited privileges, leaving only the "acsadmin" account with administrative rights.

11. Reboots the System:

Restarts the computer for the changes to take effect.

The code is attached it needs to be tested on both Windows 10 & 11 and on PC's that are on a workgroup, local domain and an azure\entra domain.