function create-account ([string]$accountName) {
$hostname = hostname
$comp = [adsi]"WinNT://$hostname"
$user = $comp.Create("User", $accountName)
$user.SetPassword("P@ssw0rd")
#$user.SetInfo()
$User.UserFlags[0] = $User.UserFlags[0] -bor 0x10000 #ADS_UF_DONT_EXPIRE_PASSWD flag is 0x10000
$user.SetInfo()}
# Create 30 administrator users named user1 ... user 30
for($i=20; $i -le 23; $i++){
create-account("TRAIN-$i")
}