Hi,
I can remove App-V 5.0 application from a local computer by using the Cmdlet Remove-AppVClientPackage. But this cmdlet doesn’t accept any parameter as -ComputerName, which means it cannot be executed on a Remote Computer. I know this can be done by running it within the Script block of Invoke-Command but that requires PSRemoting to be enabled which is disabled in our environment.
I have even tried the below WMI command but pipeline doesn’t seems to work with this Cmdlet.
Get-WmiObject -ComputerName $ComputerName -Namespace Root\APPV -Class AppvClientPackage | Where-Object {$_.Name -eq ‘Application name’} | Remove-AppvClientPackage
I would like to know if there is any other way to send the command to be executed on a Remote Computer?
Hey Gyan,
Not used it myself, but you should be able to spark it off by invoking a PowerShell process via WMI, using the Create method of Win32_Process.
Details of Win32_Process you can find here:
[url]http://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx[/url]
In meantime, I’ll try and dig out the actual syntax you need, because you need the remote process to actually invoke powershell.exe and then run the required commands. Can’t recall off the top of my head the exact way it needs to be written.
cheers,
Tim
Hello Tim,
Thanks for your response. Using Win32_Process seems to be a good idea. I will try this and see if it helps.
Cheers,
Gyan
Thanks Tim,
The Create method of Win32_Process worked like a charm. Below is the command I used to achieve it:
$Process = [WMICLASS]“\$ComputerName\root\cimv2:Win32_Process”
$Process.Create(“PowerShell.exe Remove-AppvClientPackage $PackageName”)
Cheers,
Gyan