Quantcast
Channel: Microsoft Deployment Toolkit forum
Viewing all articles
Browse latest Browse all 11297

vbscript will not work from task sequence

$
0
0

I am trying to run a vbscript from the task sequence using the "Run command line" task with the "run as this account" box checked. It does not work in the task sequence, but it will work when logged onto the target PC after install when logged in with the same credentials. I found this, but it didn't work. I tried finding posts about adding domain credentials to vbscript, but my understanding of this language is minimal (I got the script from somewhere else.) Can anyone provide me with the code to add domain credentials to this script? My test domain info is as follows:

Domain: testdeploy.com

Primary DC: Win2k8R2DC.testdeploy.com

Domain User: BuildAccount

Domain User password: Secret123

Domain user OU: OU=Deployment,DC=testdeploy,DC=com

'Get MachineObjectOU Value
Set wshNetwork = CreateObject("WScript.Network")
Set oFso = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject( "ADSystemInfo" )
Set ArgObj = WScript.Arguments
'Use first argument as target OU
strMachineObjectOU = ArgObj(0)
strComputerDN = objSysInfo.ComputerName
nComma = InStr(strComputerDN,",")
strCurrentOU = Mid(strComputerDN,nComma+1)
strComputerName = Left(strComputerDN,nComma - 1)
'If current ou is different than target OU. Move object
If UCase(strCurrentOU) <> UCase(strMachineObjectOU) Then
Set objNewOU = GetObject("LDAP://" & strMachineObjectOU)
Set objMoveComputer = objNewOU.MoveHere("LDAP://" & strComputerDN, strComputerName)
End If



Viewing all articles
Browse latest Browse all 11297

Trending Articles