How to PSEXEC a POWESHELL script/cmdlets

Sometime Enter-PSSession connecting to a remote computer is not working or simply not configured (check how to configure powershell for remote session).

Is possible to use PSEXEC (from sysinternals) launching POWERSHELL but the parameter “noninteractive” is required to run it without problem:

PsExec.exe \\RemotePC cmd /c "powershell -noninteractive -command c:\myscript.ps1"

Press enter to get back to command prompt after running it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s