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?

by kittH at 2013-01-22 11:09:29
You could try using "Switch" … 30937.aspx