Hi
I'm struggeling with a vbscript to move AD objects in the Post Install Phase of OSD.
It looks like the LDAP queries are working fine. Example: Locate OU where the machine is currenlty member of works fine.
But once the MoveHere command needs to be executed, it looks like the script is running fine but in fact nothing happened.
The scripts works correct in a Windows env., so it looks I'm missing a component in Windows PE??
I added ADSI already to boot image but that didn't make any difference.
Any other idea? Do I need to add MDAC?
This is a part of the script,
The way I located a PC in Active Directory. This works in WinPE!
strSQL = "SELECT * FROM 'LDAP://domain.com/DC=Domain,DC=COM' Where cn='" & strcomputername & "'"
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open "ADS Provider"
Set rs = oConn.Execute(strSQL)
on error resume next
Set sComputerID = GetObject(rs.Fields(0).Value)
Computer = sComputerID.distinguishedName
----------------------------------------------------------------------------
The command that I use to move. (off course the variables are declared, the message boxes are popping me the expected result) It's just refusing to execute the MoveHere command in Windows PE.
StrNewParentDN = "LDAP://" & strobjectouNEW
'msgbox strnewparentdn
strObjectDN = "LDAP://cn=" & strcomputername & "," & strobjectouOLD
'msgbox strObjectDN
strObjectRDN = "cn=" & strcomputername
'msgbox strObjectRDN
set objCont = GetObject(strNewParentDN)
objCont.MoveHere strobjectdn, strobjectrdn
' msgbox "mOVE OK"
Set objCont = Nothing
Set objObject = Nothing
-----------------------------------------------------------------------------------------
Thanks Nico
I'm struggeling with a vbscript to move AD objects in the Post Install Phase of OSD.
It looks like the LDAP queries are working fine. Example: Locate OU where the machine is currenlty member of works fine.
But once the MoveHere command needs to be executed, it looks like the script is running fine but in fact nothing happened.
The scripts works correct in a Windows env., so it looks I'm missing a component in Windows PE??
I added ADSI already to boot image but that didn't make any difference.
Any other idea? Do I need to add MDAC?
This is a part of the script,
The way I located a PC in Active Directory. This works in WinPE!
strSQL = "SELECT * FROM 'LDAP://domain.com/DC=Domain,DC=COM' Where cn='" & strcomputername & "'"
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open "ADS Provider"
Set rs = oConn.Execute(strSQL)
on error resume next
Set sComputerID = GetObject(rs.Fields(0).Value)
Computer = sComputerID.distinguishedName
----------------------------------------------------------------------------
The command that I use to move. (off course the variables are declared, the message boxes are popping me the expected result) It's just refusing to execute the MoveHere command in Windows PE.
StrNewParentDN = "LDAP://" & strobjectouNEW
'msgbox strnewparentdn
strObjectDN = "LDAP://cn=" & strcomputername & "," & strobjectouOLD
'msgbox strObjectDN
strObjectRDN = "cn=" & strcomputername
'msgbox strObjectRDN
set objCont = GetObject(strNewParentDN)
objCont.MoveHere strobjectdn, strobjectrdn
' msgbox "mOVE OK"
Set objCont = Nothing
Set objObject = Nothing
-----------------------------------------------------------------------------------------
Thanks Nico