Geddon
Geddon

Reputation: 1306

How do I (un)install an application remotely using PowerShell 2.0?

I understand how to use PowerShell to install/uninstall locally, but how can I run this on another server that is on the same network and same OS version?

$product = Get-WmiObject -Class Win32_Product -Filter "Name='MyMSI'"
$product.Uninstall()

or

$product = Get-WmiObject -List | ?{ $_.Name -eq "Win32_Product" }
$product.Install("C:\\MyMSI.msi")

Upvotes: 2

Views: 4352

Answers (2)

Mark Schill
Mark Schill

Reputation: 2368

You can still use those lines to uninstall and install software by using the -ComputerName property and specifying the name of the computer. For the install you have to copy the software to the local filesystem and specify that in the command.

Upvotes: 1

LaPhi
LaPhi

Reputation: 5887

You must use PowerShell remoting.

Read this please

Upvotes: 1

Related Questions