Thanks for your response this are the errors I get. The names for the computers are Win7_2 and Win7_1 and so on. The script is getting
the name for all machines but I think is not passing it the right way to Wmi.
Get-WmiObject : A positional parameter cannot be found that accepts argument 'Win7_1 WHERE Name LIKE '%VMware%''.
At C:\work\unins1.ps1:12 char:8
+ $app = Get-WmiObject -Query "SELECT * FROM Win32_Product -ComputerNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetWmiObjectCommand
You cannot call a method on a null-valued expression.
At C:\work\unins1.ps1:14 char:5
+ $app.Uninstall()
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Get-WmiObject : A positional parameter cannot be found that accepts argument 'Win7_2 WHERE Name LIKE '%VMware%''.
At C:\work\unins1.ps1:12 char:8
+ $app = Get-WmiObject -Query "SELECT * FROM Win32_Product -ComputerNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetWmiObjectCommand
You cannot call a method on a null-valued expression.
At C:\work\unins1.ps1:14 char:5
+ $app.Uninstall()
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull