PowerShell Script to move computers to AD Subnet

  • 400 Views
  • Last Post 25 January 2017
jeremy.stump posted this 17 October 2016

Looking for PS script to move computers to their respective workstation OU’s in Active Directory based on their AD sites and services subnet.  For instance Site 1AD Subnet 10.10.10.1/24UsersGroupsWorkstations Site 2AD Subnet 10.10.20.1/24UsersGroupsWorkstations Site 3AD Subnet 10.10.30.1/24UsersGroupsWorkstations   Jeremy Stump | Information Systems |  | BMHCC - CORPORATE
Phone: (901) 227-8205 | Jeremy.Stump@xxxxxxxxxxxxxxxx
Opinions expressed above are not necessarily those of Baptist.

This message and any files transmitted with it may contain legally privileged, confidential, or proprietary information. If you are not the intended recipient of this message, you are not permitted to use, copy, or forward it, in whole or in part without the express consent of the sender. Please notify the sender of the error by reply email, disregard the foregoing messages, and delete it immediately.

P Please consider the environment before printing this email...

Order By: Standard | Newest | Votes
Icolan posted this 25 December 2016

I realize this is an old conversation, I am just wondering why you would want to configure your OU structure based in your sites?  Wouldn't it be better to
setup your OU structure to make management of Group Policy as simple as possible?


show

a-ko posted this 26 December 2016

The only reason to break them out by site would be if you had IT management reasons (you have IT staff in each site and your organization is large enough that

you delegate control out to these folks so they can manage objects within their respective OUs).

 

-Mike Cramer

 

show

jeremy.stump posted this 29 December 2016

That is exactly the reason we do it.  Jeremy Stump
(901) 227-8205

show

jeremyts posted this 29 December 2016

So given that this is an old thread, did you find a solution? If not, is this a once off task, or do you want machines to move dynamically based on the subnet

they boot up on? How do you provision these systems? From SCCM?

 

Cheers,

Jeremy

 

show

aaron.pshemish posted this 25 January 2017

In my case I did this based on IP range. I got this from the Powershell gallery and had to modify this to get it working. Here is the original script from the gallery https://gallery.technet.microsoft.com/PowerShell-Organize-23c6be16#content

 

The IP ranges need to be in Regex format. I used this site to convert IP range to regex: http://www.analyticsmarket.com/freetools/ipregex

 

Below is a link to the modified version of the script (I had to add "$WorkstationPCs = ")

https://1drv.ms/u/s!AmCjNCQnEp-5kwG43fpQkS3knAlV

 Use something like task scheduler to run this and forget about it.

 

 

Close