1

On the remote machine, I copied the .exe file (from my source machine using Copy-Item command) to the temp folder first which was successful. After that, I ran the following Powershell script on my machine, it ran quite fast but no message was displayed and the software was not installed on the remote machine.

$computerName = "LAPTOP"

Invoke-Command -ComputerName $computerName -ScriptBlock { C:\Temp\Cyberduck-Installer-6.9.4.30164.exe /silent}

On the remote machine, winRM services was started. What did I do wrong?

Blue Tongue
  • 147
  • 11

1 Answers1

1

At first create a PoSH session by the example below:

$session = New-PSsession -ComputerName $computer -Credential (New-object PSCredential -ArgumentList ("login", ("password" |ConvertTo-secureString -AsPlainText -Force)))

and then Invoke-Command to the specified session as an example below:

Invoke-Command -session $session -Command {

script

}

and close PSS session

Remove-PSSession $session
batistuta09
  • 8,723
  • 9
  • 21