Jump to content

psexec - access denied only after filecopy


Recommended Posts

This isn't really an AutoIt problem...the challenge is equivalent if I type the same logic as the following AutoIt script code snippet manually at the Windows command console - but i'm now a little desperate and would really appreciate comment from wherever it may arise.

The code below  is ran, as an AutoIt script, from a Windows 7 Pro laptop (32 bit) and "slave1" is the single other netbook (also Win7 pro) on my home network.

Problem Def:

When the script ("Slave_Get_IP.au3") already exists on "slave1" and no attempt is made to overwrite it psexec executes the script with no issue (fyi: the remote script dumps the remote ip address to the remote file called "REMOTE-IP.txt") .

However, when the script is copied ("Slave_Get_IP.au3") to the remote "slave1" prior to executing psexec then when psexec is executed the command console reports the infamous:

"access is denied" and the remote script does not execute" 

How might the copy/overwrite be impacting the process??

#include <WinAPIFiles.au3>

;when function "delete_and_overwite" is enabled the following message occurs:
;"access is denied"

;when function "delete_and_overwite" is DISabled the following message occurs:-
;starting psexec service on slave1
;C:\Program Files\AutoIt3\AutoIt3.exe exited on slave1 with error code 0

;For $i = 1 To 20 ;for testing only

   For $j = 1 To 1 ;extend to qty of ip servers
      $sProgram = "psexec \\slave"&$j&" -u Multicam -p abcd"
      $exe = Chr(34)&"C:\Program Files\AutoIt3\AutoIt3.exe"&Chr(34)
      $script = Chr(34)&"C:\Users\Multicam\Desktop\AutoIt-GUI\IPCONFIG\Slave_Get_IP.au3"&Chr(34)
      $sWorkingDir = ""
      $iFlag = @SW_MAXIMIZE

   ;;e.g. $psexec7test = RunWait('psexec \\slave1 -u Multicam -p abcd "C:\Program Files\AutoIt3\AutoIt3.exe" "C:\Users\Multicam\Desktop\AutoIt-GUI\IPCONFIG\Slave_Get_IP.au3"', '')

      $psexec7test = RunWait($sProgram & " " & $exe & " " & $script, $sWorkingDir, $iFlag)



Func delete_and_overwrite($j)

        $did_slave_ipconfig7_copy_successfully = FileCopy("C:\users\Andrew\Google Drive\CHDK\Autoit\WIP\GUI\B.Slave_GUI\For_Slave_Ipconfig\Slave_Get_IP.au3", "\\slave"&$i&"\AutoIt-GUI\IPCONFIG", 1)
        If $did_slave_ipconfig7_copy_successfully = 0 Then
            MsgBox(0, "Error", "IPCONFIG script file not copied to remote slave"&$i)





Link to comment
Share on other sites

  • Moderators

@newniman as you mention this is not an AutoIt issue, I have moved your discussion to a more appropriate sub-forum.  This might be a better place for your question:


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

  • Recently Browsing   0 members

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