Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Such an easy task - Why can't I figure it out? Launching an EXE on a remote machine.

$
0
0

Hi All,

First post, new member and very much a beginner at PowerShell.

I want my PowerShell script (v3) to launch an EXE on a remote machine under specific user credentials.  This application launches a visible GUI when I RDP into the server, as it is an actual application, not just a terminate and stay resident process or a service.

I've played around with created a New-PSSession together with the remote machine and credentials to use I then enter my PS-Session, but I don't know the syntax to use to run the EXE.

Here is what I have so far:

$Pw = ConvertTo-SecureString -AsPlainText -Force -String PASSWORDHERE

$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "DOMAIN\User",$Pw

$Session = New-PSSession -ComputerName $Server -Credential $Cred

Enter-PSSession -Session $Session

Invoke-Command -Command "APPLICATION.EXE"

Exit-PSSession

 

-- Any assistance appreciated!


Viewing all articles
Browse latest Browse all 10624

Trending Articles