Jump to content

Win 2003 vs Win 2000


Recommended Posts

All,

I am calling the following code from a service

#include <Constants.au3>
#include <Date.au3>

Opt("RunErrorsFatal", 0)

Global $var1 = $CmdLine[1]  ;user

Global $var2 = $CmdLine[2]  ;domain

Global $var3 = $CmdLine[3]  ;password

Global $var4 = $CmdLine[4]  ;batch file to execute

Global $var5 = $CmdLine[5]  ;log file 

Global $workDir = $CmdLine[6]   ;working dir

Global $logFile = FileOpen($var5, 2)

RunAsSet($var1,$var2,$var3)

FileWrite($logFile,  "Launching commands...." & _Now() & @CRLF)
FileClose($logFile)

;$retVal = RunWait(@ComSpec & " /c" & $var4 & " >> " & $var5 &  " 2>&1")
$retVal = RunWait($var4 & " >> " & $var5 &  " 2>&1",$workDir)

if @error Then
    $logFile = FileOpen($var5, 1)
    FileWrite($logFile,  "WINSSHELLERR: Error executing script. Please check if the User Id - " & $var1 & ", Domain - " &  $var2 & "  and Password are valid.")
    FileClose($logFile)
    Exit 1
EndIf

If $retVal <> 0 Then
    $logFile = FileOpen($var5, 1)
    FileWrite($logFile,  "WINSSHELLERR: Error executing script.")
    FileClose($logFile)
    Exit 1
EndIf

$logFile = FileOpen($var5, 1)
FileWrite($logFile,  "Finished executing commands.." & _Now() & @CRLF)
FileClose($logFile)

Everything works fine when I call the autoit executable on Win 2K machine. However on a Windows 2003 server, the script consitently errors out throwing the following app error

"WINSSHELLERR: Error executing script. Please check if the User Id - " & $var1 & ", Domain - " & $var2 & " and Password are valid."

I have made sure that the user credentials I am using are correct. What's baffling is the fact that if I call the auto it executable from commandline it works as per design.

I am unable to figure out what makes the script reject the user credentials on a Win 2003 server. Are there any ways to Trace the executable that could help me debug the issue. Are there any issues with autoit and Win 2003 that I am overlooking ?

Thanks

Link to comment
Share on other sites

I have 2003 server Basic, and it gives an error to. BUT if you remove: ,$workDir from

$retVal = RunWait($var4 & " >> " & $var5 &  " 2>&1",$workDir)

Then it works fine!

Now i get:

Launching commands....3-6-2007 20:47:01

C:\Documents and Settings\Administrator\Desktop>ShutDown -i 
Finished executing commands..3-6-2007 20:47:02
Edited by kip
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...