top of page

Disable Administrator and Sets Random Password with PowerShell

Feb 13, 2020
1 min read

<# .Synopsis Disable Admin Account and Sets Random Password

​

.Description

​

.Version

#>

#Password length $length = 20

​

#Minimum number of symbols to use in the password #Do not set to high as this will remove complexity and make passwords easier to compromise $random = 5

​

#Creates random password $assembly = Add-Type -AssemblyName system.web $randPass = [System.Web.Security.Membership]::GeneratePassword($length,$random)

​

#Var for Administrator Account $admin = "Administrator"

​

#Sets Administrator password net user $admin $randPass /YES


#Disable Administrator account net user $admin /active:yes

​


 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page