1
I am working on windows 7 64x laptop. and using powershell i wrote the following script to remove multiple programs:-
PS C:\Users\***> $programs = @("Microsoft SQL Server 2014 T-SQL Language Service","Microsoft SQL Server 2014 Transact-SQL ScriptDom")
PS C:\Users\***> foreach($program in $programs)
>> {$app = Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -match "$program"}
>> if ($app -ne $Null)
>> {
>> $app.Uninstall()
>> Write-Output "completed"
>> }}
>>
and i got this result:-
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0
PSComputerName :
completed
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0
PSComputerName :
completed
so i thought that the programs were removed successfully. but when i checked the "Control Panel" >> "Programs and Features", i found that the programs are still listed and i am able to uninstall them from their.. so seems my powershell script did not uninstall the applications. so can anyone adivce on this please?