I have a script here to test for a folder's existence. If found pop up a message to show that it exists. In the long run it will run a command to uninstall the update if found. Right now I am trying to have it just locate the file and verify that is working, but I haven't had any luck. I have debugged it and it has no errors. Could anyone let me know why it isn't working properly?
option explicit
on error resume next
'initalize variables
Dim WDS2602083, WDS2602057, WDS265Beta, WDS3, WDS4, objFSO, objShell
WDS2602083 = "%systemroot%\$NtUninstallKB907371-V2$"
WDS2602057 = "%systemroot%\$NtUninstallKB907371$"
WDS265Beta = "%systemroot%\$NtUninstallKB911993$"
WDS3 = "%systemroot%/$NtUninstallKB917013$"
WDS4 = "%systemroot%\$NtUninstallKB940157$"
'Initialize File system object and Wscript Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("Wscript.Shell")
'Tests for versions and if found dispalys message
If objFSO.FolderExists(WDS2602083) Then
wscript.Echo "1"
ElseIf objFSO.FolderExists(WDS2602057) Then
wscript.Echo "2"
ElseIf objFSO.FolderExists(WDS265Beta) Then
wscript.Echo "3"
ElseIf objFSO.FolderExists(WDS3) Then
Wscript.Echo "4"
ElseIf objFSO.FolderExists(WDS4) Then
Wscript.Echo "5"
End If
option explicit
on error resume next
'initalize variables
Dim WDS2602083, WDS2602057, WDS265Beta, WDS3, WDS4, objFSO, objShell
WDS2602083 = "%systemroot%\$NtUninstallKB907371-V2$"
WDS2602057 = "%systemroot%\$NtUninstallKB907371$"
WDS265Beta = "%systemroot%\$NtUninstallKB911993$"
WDS3 = "%systemroot%/$NtUninstallKB917013$"
WDS4 = "%systemroot%\$NtUninstallKB940157$"
'Initialize File system object and Wscript Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = WScript.CreateObject("Wscript.Shell")
'Tests for versions and if found dispalys message
If objFSO.FolderExists(WDS2602083) Then
wscript.Echo "1"
ElseIf objFSO.FolderExists(WDS2602057) Then
wscript.Echo "2"
ElseIf objFSO.FolderExists(WDS265Beta) Then
wscript.Echo "3"
ElseIf objFSO.FolderExists(WDS3) Then
Wscript.Echo "4"
ElseIf objFSO.FolderExists(WDS4) Then
Wscript.Echo "5"
End If