'Error invoking command to install a Msi through Powershell

I am trying to use PowerShell's Invoke-Command but I am encountering an error that I have no idea of what it is!

Would be great to have some help on this. I am sure that it must be something really simple..

invoke-command  -scriptblock{ $executable = "wmic"; & "$executable product call install true","-computername name" ,'path to the msi' } 

Thank you!



Solution 1:[1]

You could just try using msiexec:

$scriptblock = {Start-Process msiexec.exe -Argumentlist "/i $PathToMSI","/qn"}
invoke-command  -scriptblock $scriptblock -computername $name 

I´m not sure if you even can install msi´s via wmi, never seen it before. Other than that you mixed up the syntax of your invoke-command a bit ;)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paul