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?

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.