Jump to content

Recommended Posts

Posted

I am hoping that I am missing something obvious. I cannot get the below code to work. It sure looks right to me but I have been staring at it for about two hours. $CopyINIFile returns 0 and @error returns 0. Shouldn't @error return a non-zero number on failure?

The id, pass, vars are all good.

help!

$CopyINIFile = RunAs("UserID", "Domain", "Password",0, @ComSpec & " /C " & @SystemDir & "\System32\XCOPY.EXE \\" & $SiteServer & "\NetApps$\NTE\BSDNWEA.INI " & CHR(34) & @ScriptDir & CHR(34) & " /Y",@ScriptDir, @SW_HIDE, $STDERR_CHILD)

If StderrRead($CopyINIFile) = 0 Then

MsgBox(16,"BSD TestTaker","Local INI file could NOT be updated." & @CRLF & "Please contact the Service Desk for assistance @302-555-1234" & @CRLF & "Please reference this error during your call. Thanks!")

Exit(1)

EndIf

Posted

I am hoping that I am missing something obvious. I cannot get the below code to work. It sure looks right to me but I have been staring at it for about two hours. $CopyINIFile returns 0 and @error returns 0. Shouldn't @error return a non-zero number on failure?

The id, pass, vars are all good.

help!

$CopyINIFile = RunAs("UserID", "Domain", "Password",0, @ComSpec & " /C " & @SystemDir & "\System32\XCOPY.EXE \\" & $SiteServer & "\NetApps$\NTE\BSDNWEA.INI " & CHR(34) & @ScriptDir & CHR(34) & " /Y",@ScriptDir, @SW_HIDE, $STDERR_CHILD)

If StderrRead($CopyINIFile) = 0 Then

MsgBox(16,"BSD TestTaker","Local INI file could NOT be updated." & @CRLF & "Please contact the Service Desk for assistance @302-555-1234" & @CRLF & "Please reference this error during your call. Thanks!")

Exit(1)

EndIf

If I change the working dir to @SystemDir I at least get the cmd prompt to run but nothing happens and it returns nothing. This makes no sense.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...