Thanks, Jeffrey. I'm much delighted to see your reply. I'll try the script
in my test domian and put back the results in my next post.
"Jeffrey Snover [MSFT]" wrote:
> I'm not going to test this on my machine to see if i got the code correct so
> there might be errors :-).
> That is the downside of direct .NET access vs Cmdlet. If it was a Cmdlet,
> you could just type -WHATIF and things would be great.
>
> $list= import-csv c:\sql.csv
> foreach ($entry in $list)
> {
> $prod = Get-WmiObject Win32_Product -computer $a.Computer |where
> {$_.name -match "SQL Server"}
> $status = $prod.InvokeMethod("Uninstall",1)
> switch ($status.ReturnValue)
> {
> 0 {$entry.Status = "Success"}
> 2147549445 {$entry.Status = "RPC Server Fault"}
> default {$entry.Status = $status.ReturnValue}
> }
> }
> $list |export-csv c:\sql.csv
>
> The link below documents the returnValue values:
> http://msdn.microsoft.com/library/de...32_product.asp
> --
> Jeffrey Snover [MSFT]
> Windows PowerShell/Aspen Architect
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, no confers rights.
> Visit the Windows PowerShell Team blog at:
> http://blogs.msdn.com/PowerShell
> Visit the Windows PowerShell ScriptCenter at:
> http://www.microsoft.com/technet/scr.../hubs/msh.mspx
>
>
>