How to install a program on a remote machine

by poliasd at 2012-10-31 09:15:57

Hi,

I am trying hasd to install a program on a remote machine, but the program doesn’t install. I tried psexec, but it doesn’t work as well. Remoting is enabled on the remote machine.
This is my powershell script:

$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr

$s = new-PSSession -computername "testvm1" -credential $cred

invoke-command -session $s -FilePath "installer.ps1"

installer.ps1: cmd.exe /c $installerFile /q2

I tried to create .bat file on the remote machine and to call it from both psexec and invoke-command in powershell, but nothing happens.

Can you help me, please!
by DonJ at 2012-10-31 09:27:25
You should probably try a complete path to the file, not just the file name. Also ensure that the local execution policy will allow script execution.
by poliasd at 2012-10-31 23:48:31
Hi,
I used the whole path, but it still doesn’t work.