I'm attempting to script the creation of an OU required for SMS. The OU must be created underneath the Top Level OU of System, but when I run the code, I receive the error "object not founf on the server" where the script attempts to bind to that OU.
The error doesn't occur when pointed at another Top Level OU I have manually created, so it appears that the System OU is special somehow.
Here's the sample code:
The error doesn't occur when pointed at another Top Level OU I have manually created, so it appears that the System OU is special somehow.
Here's the sample code:
Code:
' Create OU
Set adsRootDSE = GetObject("LDAP://rootDSE")
strDomainDN = adsRootDSE.Get("defaultNamingContext")
strADsPath = "LDAP://OU=System," & strDomainDN
Set adsContainer = GetObject(strADsPath)
Set oOU=adsContainer.Create("organizationalUnit", "ou=System Management")
oOU.Put "Description", "SMS OU"
oOU.SetInfo
wscript.echo "Script Complete"