Move computer to required OU based on computer model


posted by Felipe
08-31-2010

Downloads: 227
File size: 828 B
Views: 1,209

Embed
Move computer to required OU based on computer model
  1. #Written by Felipe Binotto 
  2. #On the 1st of September of 2010 
  3. #Move computer to required OU based on it's model 
  4.  
  5. #Import required module 
  6. Import-Module (get-pssnapin Quest.ActiveRoles.ADManagement -Registered).ModuleName -WarningAction SilentlyContinue 
  7.  
  8. #Gets computer and model 
  9. $Computer = (Get-WmiObject -Class Win32_ComputerSystem).name 
  10. $model = (Get-WmiObject -Class Win32_ComputerSystem).model 
  11.  
  12. #Move computer to required OU 
  13. if($model -match "D620" -or $model -match "D630" -or $model -match "E6400" -or $model -match "E6410"){ 
  14.  
  15. Move-QADObject (Get-QADComputer $computer).DN -NewParentContainer 'staff.vuw.ac.nz/VUW_Workstations/Win7_Test/W7Desktops' | Out-Null
  16.  
  17. else
  18.  
  19. Move-QADObject (Get-QADComputer $computer).DN -NewParentContainer 'staff.vuw.ac.nz/VUW_Workstations/Win7_Test/W7Laptops' | Out-Null

Requires the Quest ActiveRoles ADManagement

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