PowerShell: New-AdUser > Account > Log on to
hey,
make easy: i'm creating new user , need define 1 computer can log on in user properties > account > log on to..
current script:
$cred = get-credential $template = get-aduser -identity "account_c" $computers = get-content ".\computers.txt" $password = "pa$$w0rd" $domain = "domain.no" $ou = "ou=autologon,ou=systemusers,ou=admin,dc=domain,dc=no" foreach ($computer in $computers) { $newbie = "account_$computer" $upn = "$newbie $domain" -replace " ","@" new-aduser -name $newbie -samaccountname $newbie -instance $template -userprincipalname $upn -givenname $newbie -accountpassword $password -changepasswordatlogon $false -displayname $newbie -enabled $true -server $domain -path $path -cred $cred -enable $true -cannotchangepassword $true -passwordneverexpires $true }
you can assign netbios name of computer extended property "logonworkstations". if there more 1 computer in list, make names comma separated (not array).
richard mueller - mvp directory services
Windows Server > Windows PowerShell
Comments
Post a Comment