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

2 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page