Hi All I have something I am trying to automate using PowerShell. I am pretty new to PowerShell and only know enough to do 1 liners at this point and am hoping to get some help and experience from you expert scripters.
The situation is we buy new machines from a Manufacturer (shipped with a name of GoldSerialNumber (SerialNumber is the actual serial number of the machine). We want a way to automate both renaming the machines with a specific site code as the prefix followed with serial number. The way we want to identify the site code is by using the Subnet each machine is connected to once shipped and plugged into the network. Lastly we want to move the machines from the default ad group they are put in to a specified OU based on the site.
I know this is over my head and am looking for help creating this script or if someone has a script that can do it and don’t mind me using it for my situation I would appreciate that too. At this point I am just trying to get started by identifying the Subnet only of a remote computer using PowerShell.
I think I can get the info using the Get-WmiObject -Class "win32_networkadapterconfiguration commandlet but I have not been able to figure out the rest of the command and syntax to pull just the subnet.
Thanks for any insight, guidance, or scripts that I can use to accomplish this task.