Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Running invoke-command does not call executable in master script....

$
0
0

Ok here's the scenario.

Domain-based network.

Computer running invoke-command is also a domain member.

Powershell v2 is installed on domain member computer.

Powershell v2 is installed on the domain member server.

Both powershell scripts are located on a share on the domain member server, and is both mapped as well as unc-path accessable by the domain member computer.

"Enable-PSRemoting -force" command as administrator ran successfully on the domain member server where the scripts and executable are located.

Running the invoke-command powershell script from the domain computer does indeed attach and execute the script on the domain member server.

However, the process that the "master" script that calls a local (to that domain member server) executable to further process the files does not work.

If I run the "master" script on the server directly, all works as expected.

Here's the slave script that is called from the domain member computer:

---

invoke-command -filepath "\\Servername\Programdir\Uploads_here\Masterscript.ps1" -computername Servername

---

And here's the "master" script:

---

# Commented out
cd "\\Servername\Programdir\Uploads_here"
(get-content AP*.txt|where {$_.readcount -lt 1 -or $_.readcount -gt 3})|set-content APdatafile.txt
(get-content PR*.txt|where {$_.readcount -lt 1 -or $_.readcount -gt 3})|set-content PRdatafile.txt
cd "C:\Program Files (x86)\Mysteryprogram\ProgramData\Scripts"
start-process -FilePath "C:\Program Files (x86)\Mysteryprogram\Mysteryprogram.exe" -ArgumentList "-n -s WFUpload4.s"

--

I see that the "slave" script does indeed run, and does indeed process the master script at least up to line 4 as it creates the modified APDatafile.txt and PRDatafile.txt.

My assumption is that it's not completing as the Mysteryprogram then creates PGP files from each; named APDatafile.txt.pgp and PRDatafile.txt.pgp, then logs into an FTP site, transmits the PGP files, then deletes both PGP and modified TXT files (APDatafile.txt.pgp, APDatafile.txt, PRDatafile.txt.pgp, PRDatafile.txt).

I know I'm doing something wrong but what?

Thanks in advance!


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>