I have a master copy of my software on a server. I have 2 workstations that I copy that master server copy to, using batch files. On each workstation there is a Backup_Software.bat file and a Backup_Software_Remote.bat file. Backup_Software.bat on either workstation copies the server share which is mapped to X: on both workstations to the local drive D:, then it starts Backup_Software_Remote.bat on the other workstation which again copies X: to D: on that machine. This way if I add software to the master X: I am one double-click away from getting the master X: copied to both workstation's D: drive.
Working directly on the PsExec destination machine, dir x:\software works correctly.
C:\>dir x:\software
Volume in drive X is Puff_C~
Volume Serial Number is B6A1-0D9E
Directory of x:\software
03/04/2017 12:03 PM <DIR> .
06/20/2023 10:00 PM <DIR> ..
10/21/2021 08:32 PM <DIR> Unix
04/07/2019 04:36 PM <DIR> OS2
04/09/2023 05:03 AM <DIR> Windows
10/18/2023 11:54 AM <DIR> Linux
10/15/2016 10:11 AM <DIR> DOS
0 File(s) 0 bytes
7 Dir(s) 24,102,284,435,456 bytes free
Working directly on the PsExec destination machine, robocopy x:\software d:\software /s /e works correctly.
C:\>robocopy x:\software d:\software /s /e
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Mon Dec 04 22:37:09 2023
Source : x:\software\
Dest : d:\software\
Files : *.*
Options : *.* /S /E /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
0 x:\software\
0 x:\software\DOS\
Starting PsExec on the PsExec source machine, the desired batch file can be seen to start correctly on the destination machine.
psexec64 \\puff -d -i 1 -u puff\user -p password -n 120 Backup_Software_Remote.bat
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
Backup_Software_Remote.bat started on puff with process ID 8572.
But now the destination machine can't find X:\software.
C:\Windows\system32>ECHO OFF
Log File : E:\Backup\Log\Puff_III\Backup-Software_Rem.log
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Mon Dec 04 22:41:41 2023
2023/12/04 22:41:41 ERROR 3 (0x00000003) Getting File System Type of Source X:\Software\
The system cannot find the path specified.
Source - X:\Software\
Dest : D:\Software\
Files : *.*
------------------------------------------------------------------------------
2023/12/04 22:41:41 ERROR 3 (0x00000003) Accessing Source Directory X:\Software\
The system cannot find the path specified.
The Backup_Software_Remote.bat batch file works correctly in either a user or admin console but not if started remotely using PsExec. I have no idea where to go with this or how to start troubleshooting this issue. Thanks in advance for any help that my be provided.
All for now
I tried to run a batch file remotely with PsExec and I expected it to work as well as it does when running that same batch file locally.
Answer: The remote batch file does:
Robocopy \\Plum\Software D:\Software /MIR /NP /LOG:"E:\Backup\Log\Puff_III\Backup-Software_Rem.log" /TEE
Which doesn't work when run remotely through PsExec, although it does work when run locally.
I changed the remote batch file to this:
Robocopy \\192.168.2.12\Software D:\Software /MIR /NP /LOG:"E:\Backup\Log\Puff_III\Backup-Software_Rem.log" /TEE
I changed \\Plum to \\192.168.2.12 and now it works when run remotely through PsExec. Whodathunkit.
I wish I knew why \\Plum in a batch file works locally but not when run remotely through PsExec.
All for now