Jump to content

problems to start cmd-files via AutoIT


Recommended Posts

Hi,

I wrote a script, which installs our updates on clients (Win XP Prof.). The script was started by the tool psexec. This tool, copies the script to the c:\ drive of the client and starts remote.

The problem is, if the script should start our cmd-file (pskill.cmd) or any other *.cmd file at first, then the script can´t continue and will be cancelled.

A error messages appears like "Could not find file specified". But the file is in the correct folder / path.

If I start the script manually then it works fine. No error messages, everything works great. But if you have over 100 clients, so its very difficult to start the script manually and not by the tool psexec.

By the way, we got also Group Policys on the client which are hide the c:\ drive on the client. The client users are administrators with full control ntfs permissions.

If I disable the Group Policys, the scipt works, too. But this solution is very bad, because I can´t deactivate the Group Policys.

Here is a segment of my code:

sleep(1000)

TrayTip("Maus und Tastatur unberührt lassen!", "Installation wird vorgenommen: " & @ScriptName, 20, 2)

MsgBox(16, "Remoteinstallation", "Der Rechner wird jetzt einer Installationsroutine unterzogen!",5)

$abfrage= MsgBox(4+64, "Remoteinstallation", "Soll die Installation jetzt vorgenommen werden?",20)

if $abfrage=6 or $abfrage=-1 Then

sleep(2000)

MsgBox(64, "Remoteinstallation", "Der Befehl zum installieren des Updates auf dem Client wurde erteilt ", 5)

$file = FileOpen("c:\dokumentation\newstart.txt", 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

$line = FileReadline($file,1)

msgBox(0, "Remoteinstallation",$line,1)

if $line=2 then

msgBox(0, "Remoteinstallation", "Installationsroutine wird nun fortgesetzt",3)

endif

FileClose($file)

Sleep(1000)

msgBox(0, "Remoteinstallation", "Datei lesen erfolgreich.",3)

if $line=1 then

Sleep(2000)

ShellExecute("X:\install\Programme\pskill.cmd")

Sleep(5000)

WinActivate("PsKill License Agreement")

Sleep(4000)

if WinWaitActive("PsKill License Agreement","",4)=1 then

send("!a")

EndIf Sleep(2000)

Red-marked is the problem. x:\ is a network drive. the client users have full control on x:\

So, if you have any questions or suggestions please let me know.

Thanks for your help in advance

Link to comment
Share on other sites

Link to comment
Share on other sites

I take if X: is a network drive, the X: is a folder on another machine? Maybe if you went to that location instead... :)

Hi Bert,

I´m sorry, but what do you mean exactly?

The network drive (X:) is located on the domain controller. Path: {servername}\d$\Systemupdate

sharingname is on folder "Systemupdate". The user Everone has Full Control sharing- and ntfs permissions.

The strange thing is, why can I start the autoit-file locally and everything works fine on the client (with Group Policy), but if I start it via psexec (with Group Policy), the script starts and at the point of pskill.cmd it will be cancelled and the windows error message box appears "Path or file not found". Very strange.

I would like to use an UNC Path to the pskill.cmd, like:

ShellExecute("{servername}\Systemupdate\install\Programme\pskill.cmd")

But the problem of this is, that all processes will be "killed", not on the client, on the domain controller. And this is too risky, you know?

Link to comment
Share on other sites

Hallo Landsmann :)

I wrote a script, which installs our updates on clients (Win XP Prof.). The script was started by the tool psexec. This tool, copies the script to the c:\ drive of the client and starts remote.

I suspect that PSEXEC is executing your script in a new generated security context. This means, that the local logon's mapped drive letters do not exist for your script:

if $line=1 then     
    Sleep(2000)
    ShellExecute("X:\install\Programme\pskill.cmd")                   
; [snip]

Use the UNC Path instead of a drive letter path. You might want to copy it from UNC to local C: drive, or to experiment with winXP's "pushd <unc-path>" to assign a drive letter on the fly (popd is the oposite one)

You also might want to pack all files into your autoit script, as you push it to the clients using pstools anyways, right?

Look at FileInstall(...)

Schönen Abend, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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...