Script to create Multiple local Users and set Password never Expire

function create-account ([string]$accountName) {

 $hostname = hostname

 $comp = [adsi]"WinNT://$hostname"

 $user = $comp.Create("User", $accountName)



 $User.UserFlags[0] = $User.UserFlags[0] -bor 0x10000 #ADS_UF_DONT_EXPIRE_PASSWD flag is 0x10000


 # Create 30 administrator users named user1 ... user 30

for($i=20; $i -le 23; $i++){



No comments:

Post a Comment

Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is You need to connect your laptop and storage with...