Have a script that reads a txt file which contains the computer's OU path. I want to take that line from the text and put that into the script to have it join the domain.
I get the error "an invalid DN syntax hs been specified.
How can I get it to read the variable "strContents" ?
here is the script"
Const FOR_READING = 1
const FOR_Writing = 2
Set objFiles=objFSO.GetFile("\\server\eXpress\NewPC\" & strComputer & ".txt")
Set objTextStream = objFSO.OpenTextFile ("\\server\eXpress\NewPC\" & strComputer & ".txt", FOR_READING)
strContents = objTextStream.Read(40)
WScript.Echo strContents
objTextStream.Close
Set objNewOU = GetObject("LDAP:// " & strContents & ",OU=ABComputers,DC=Domain,DC=net")
Set objMoveComputer = objNewOU.MoveHere _
("LDAP://CN= " & strcomputer & ",CN=Computers,DC=Domain,DC=net", "CN= " & strcomputer & "")
I get the error "an invalid DN syntax hs been specified.
How can I get it to read the variable "strContents" ?
here is the script"
Const FOR_READING = 1
const FOR_Writing = 2
Set objFiles=objFSO.GetFile("\\server\eXpress\NewPC\" & strComputer & ".txt")
Set objTextStream = objFSO.OpenTextFile ("\\server\eXpress\NewPC\" & strComputer & ".txt", FOR_READING)
strContents = objTextStream.Read(40)
WScript.Echo strContents
objTextStream.Close
Set objNewOU = GetObject("LDAP:// " & strContents & ",OU=ABComputers,DC=Domain,DC=net")
Set objMoveComputer = objNewOU.MoveHere _
("LDAP://CN= " & strcomputer & ",CN=Computers,DC=Domain,DC=net", "CN= " & strcomputer & "")