Tuesday, February 1, 2011

MS PowerShell

http://www.quest.com/powershell/activeroles-server.aspx  Quest AD powershell extentions

http://www.computerperformance.co.uk/powershell/powershell_qad_user.htm  user guide for quest powershell QadUser

Some Snippets

Update AD attributes

Takes a list of users in the IT OU and sets the Roomnumber attribute to XXXX

Displays a list of all users affected

<code powershell>
$OU = "OU=IT,OU=GDv4,OU=Users,OU=IE,DC=Domain,DC=domain,DC=Domain,DC=com"
$users = get-qaduser -searchroot $ou
$Users | foreach  { set-Qaduser $_.name -objectAttributes @{roomNumber='XXXX'} }
$Users | foreach  { write-host $_.Name }
</code>