Update Change Local Admins (ADSI).ps1

This script is aimed to disable the Windows built-in local administrator account and create a new local user account with administrator privileges. It will also set the password of each account via input in the console window. This script traverses the AD OU structure, picks up computer object names, sorts them, and performs the actions using ADSI controls. It will also log a CSV file of all offline or otherwise unreachable computers (broken admin share or RPC services, typically).

Side note: in my organization, we have an OU where we place digital signage, POS terminals, and customer-facing kiosks that need a specific set of GPOs applied to them and thus have GP inheritance disabled on their top OU aptly named "No GP Inheritance". The script modifies the ADSI/LDAP path based on the initial input of the script. It will ask for a computer name (if any) to target a specific computer in an OU, the OU computer objects rest in (if any), and if it's in the no GP inheritance OU. If a computer is defined, an OU MUST be defined unless it rests in the base computer OU.

Ex:

This would hit a computer in the base computer OU only:
CN=Test1,OU=Computers,OU=Test,DC=domain,DC=com

This would hit all computers in a specificed OU (no computer defined at prompt):
OU=Test1,OU=Computers,OU=Test,DC=domain,DC=com

This would hit all computers in the No GP Inheritance OU:
OU=No GP Inheritance,OU=Computers,OU=Test,DC=domain,DC=com

This would hit all computers in an OU under No GP Inheritance:
OU=Test1,OU=No GP Inheritance,OU=Computers,OU=Test,DC=domain,DC=com

Based on user input, this would be dynamic.