Eternal IF/ElseIF script

by johnkeng at 2013-01-22 10:09:41

Hello All,

I’m curious if there is a better way to sort AD objects in powershell than IF/ElseIF. I’m looking to sort all our computers into department OU’s based on the computer name and OU name. Currently, I’m getting all computer objects based on OS version and system name and moving them to a specific ou, but we have over 180 computer OU’s and the IF/ELSEIF goes on forever. Is there a simpler and neater (aesthetically and functionally) way of performing this task?

Thnaks,
Kendall
by kittH at 2013-01-22 11:09:29
You could try using "Switch"
http://technet.microsoft.com/en-us/libr … 30937.aspx