Author Posts

June 10, 2018 at 1:48 pm

Hello everyone,

I am trying to call a script which is in remote server using below command from my local server on PS prompt,

.\psexec.exe -e -h -s -u username -p password pwd \\servername Powershell -ExecutionPolicy ByPass -File C:\Users\username\Downloads\psscript.ps1

The prompt will give like,

Starting PSexec service on servername.....


Error establishing communication with psexec service on servername:
the system cannot find the path specified.

The specified path and server-name with password is correct.

Please help me out.

Advance Thanks.

June 10, 2018 at 3:00 pm

You've got a PSExec problem there, not PowerShell. PSExec isn't part of PowerShell – not able to provide any help there, sorry.

June 10, 2018 at 3:06 pm

Thanks Don.

Is there any other method to call the script on remote server from my local/other servers ??

If so please let me know.

June 10, 2018 at 11:26 pm

Yeah, Powershell is pretty good for that....

$s = new-pssession -computer "myserver"
Invoke-Command -session $s -script { C:\Scripts\get-systeminfo.ps1 }
Host Name:                 myserver
OS Name:                   Microsoft Windows Server 2012 R2 Standard
OS Version:                6.3.9600 N/A Build 9600
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Member Server
OS Build Type:             Multiprocessor Free
Registered Owner:          Windows User
Registered Organization:   
Product ID:                00252-60123-77956-AA026
Original Install Date:     5/13/2014, 11:03:30 PM
System Boot Time:          5/22/2018, 9:41:15 PM
System Manufacturer:       VMware, Inc.
System Model:              VMware Virtual Platform
System Type:               x64-based PC
Processor(s):              2 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 45 Stepping 7 GenuineIntel ~2600 Mhz
                           [02]: Intel64 Family 6 Model 45 Stepping 7 GenuineIntel ~2600 Mhz
BIOS Version:              Phoenix Technologies LTD 6.00, 4/14/2014
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC-06:00) Central Time (US & Canada)
Total Physical Memory:     16,383 MB
Available Physical Memory: 12,381 MB
Virtual Memory: Max Size:  32,767 MB
Virtual Memory: Available: 28,806 MB
Virtual Memory: In Use:    3,961 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    ebsi.corp
Logon Server:              N/A
Hotfix(s):                 151 Hotfix(s) Installed.

June 11, 2018 at 1:25 am

.\psexec.exe -e -h -s -u username -p password pwd \\servername Powershell -ExecutionPolicy ByPass -File C:\Users\username\Downloads\psscript.ps1

This syntax doesn't look right, from my experience. Try this:

.\psexec.exe \\servername -e -h -s -u username -p password cmd /c Powershell.exe -ExecutionPolicy Bypass -File C:\Users\username\Downloads\psscript.ps1

I've had best luck putting the computername first, and it looks like you have extra things after the password entry that might not be a recognisable input.

June 11, 2018 at 9:55 am

hi iain,

i caught with below error,

new-pssession : [lhr1-nuget01] Connecting to remote server lhr1-nuget01
WinRM cannot complete the operation. Verify that the specified computer
over the network, and that a firewall exception for the WinRM service is
By default, the WinRM firewall exception for public profiles limits acce
subnet. For more information, see the about_Remote_Troubleshooting Help
At line:1 char:6
+ $s = new-pssession -computer "lhr1-nuget01"
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunsp
   gTransportException
    + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

June 11, 2018 at 9:59 am

Hi Joel,

Still caught for same errors.

Starting PSexec service on servername.....


Error establishing communication with psexec service on servername:
the system cannot find the path specified.