Tenaka
Feb 13, 20201 min
<#
.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