Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Need help in uninstalling application using VB scripting

$
0
0

Hi friends,

I am not able to find what is wrong with the below script. please help me in finding out where i went wrong.

IfIsArray(arraySoftwareNames) Then
        strComputer = getComputerName()
        Set myWinManObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set softwareCollection = myWinManObj.ExecQuery("Select * from Win32_Product")
        MsgBox"query done"
        ForEach softwareIn softwareCollection
            ForEach elementIn arraySoftwareNames
                If element = software.NameThen
                    MsgBox"(" & software.Name & ")" & vbNewLine & "(" & element & ")"
                    software.Uninstall()
                    ExitFor
                EndIf
            Next
        Next
    Else

basically i am getting the application names from the registry and storing it in an array and then passing it to this function with the argumentarraySoftwareNames. but when i execute the script softwares are not getting uninstalled and no error is also thrown.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>