Hi
I have a bit of a problem. I need to move all the computers in the default computers container in AD to an OU according to witch subnet they are located in in AD sites and services or according to IP address.
At the moment I run a script to extract the computer names out of the default container and dump the results in a txt file. I then use FastResolver to get the ip addresses of the computers in the txt file and then save it in a .CSV. The problem is I have to manually check each ip with the scope in sites and services and move it to a txt according to witch site the subnet is assigned to. I then run a script that moves the computers from the txt file to the correct OU in AD.
Is there any way I can automate this process. Perhaps by making the script take a pc name from the container and then ping it. Then take the ip it got and convert it to a subnet address. Take the subnet address and use something like a IF statement to move it to the correct OU in AD.
If its possible to get the same info you would get using
Set objADSysInfo = CreateObject("ADSystemInfo")
WScript.Echo "Current site name: " & objADSysInfo.SiteName
From a remote computer that will help a lot as there is currently 271 subnets split over 25 sites and that would mean there will be at least 271 subnet entries in the script. Perhaps there is even a better way to do this but I’m a novice when it comes to VBS
Ill post the two scripts I currently use in my next post.
I have a bit of a problem. I need to move all the computers in the default computers container in AD to an OU according to witch subnet they are located in in AD sites and services or according to IP address.
At the moment I run a script to extract the computer names out of the default container and dump the results in a txt file. I then use FastResolver to get the ip addresses of the computers in the txt file and then save it in a .CSV. The problem is I have to manually check each ip with the scope in sites and services and move it to a txt according to witch site the subnet is assigned to. I then run a script that moves the computers from the txt file to the correct OU in AD.
Is there any way I can automate this process. Perhaps by making the script take a pc name from the container and then ping it. Then take the ip it got and convert it to a subnet address. Take the subnet address and use something like a IF statement to move it to the correct OU in AD.
If its possible to get the same info you would get using
Set objADSysInfo = CreateObject("ADSystemInfo")
WScript.Echo "Current site name: " & objADSysInfo.SiteName
From a remote computer that will help a lot as there is currently 271 subnets split over 25 sites and that would mean there will be at least 271 subnet entries in the script. Perhaps there is even a better way to do this but I’m a novice when it comes to VBS
Ill post the two scripts I currently use in my next post.