top of page

Disable Administrator and Sets Random Password with PowerShell

<# .Synopsis Disable Admin Account and Sets Random Password




#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

0 views0 comments
bottom of page