Write computer model to AD object description


posted by Felipe
08-26-2010

Downloads: 299
File size: 599 B
Views: 1,797

Embed
Write computer model to AD object description
  1. #Written by Felipe Binotto 
  2. #On the 27th of August of 2010 
  3.  
  4. #Get all computers names from some specific OU and sort it. 
  5. #For each computer in the OU, get its model and write it to its description in AD. 
  6.  
  7. $OU = get-QADComputer -SearchRoot 'staff.vuw.ac.nz/VUW_Workstations/Desktops' -SizeLimit 0 | % {$_.name} | sort 
  8. foreach($computer in $OU){ 
  9. $model = (Get-WmiObject win32_computersystem -computername $computer -ErrorVariable err -ErrorAction SilentlyContinue).model 
  10. if($err){ 
  11. Set-QADComputer $computer -Description Unavailable} 
  12. else
  13. Set-QADComputer $computer -Description $model}} 

Get the computer model through a WMI query (you can get something else) and write it to the computer description in AD.

Do not forget to change the path to your required OU.

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.