Set user’s logon script

Staying on the profile tab we can also set a logon script

$ou = "OU=BlogTests,DC=Manticore,DC=org"            
$name = "UserA"            
Get-ADUser -Identity $name |            
Set-ADUser -ScriptPath "ls1.cmd"            
"`nAD provider"            
$name = "UserB"            
$dn = "cn=$name,$ou"            
Set-ItemProperty -Path AD:\$dn  -Name scriptpath -Value "ls1.cmd" -Force            
$name = "UserC"            
Get-QADUser -Identity $name |            
Set-QADUser -LogonScript "ls1.cmd"            
$name = "UserD"            
$dn = "cn=$name,$ou"            
$user = [adsi]"LDAP://$dn"            
$user.scriptpath = "ls1.cmd"            

Simply set the name of the logon script file in the scriptpath attribute. Notice that the Quest cmdlet uses –LogonScript for the parameter

The full path isn’t required because logon scripts are in the netlogon share on domain controllers – you don’t want to set a specific domain controller usually

Published Wed, Feb 29 2012 21:58 by RichardSiddaway

Leave a Comment

If you can't read this number refresh your screen
Enter the numbers above: