What is the best way to do this?
All the script examples that I can find seem to presume that you know the OU
in advance.
Hi
Parse the output of sADssComputer below to get the OU:
Set oADsSysInfo = CreateObject("ADSystemInfo")
' Get distinguished name of the local computer
' It will include the OU.
sADssComputer = oADsSysInfo.ComputerName
Wscript.Echo sADssComputer
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
Works very nicely!
Sincerely,
Max Vaughn [MS]
Microsoft Developer Support
Disclaimer: This posting is provided "AS IS" with no warranties, and
confers no rights. You assume all risk for your use.