home *** CD-ROM | disk | FTP | other *** search
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Filename: SCTPostUninstall.vbs
- ' *** ------------------------------------------------------------------------------
- ' *** Description: Post-Uninistall process to clean up Computer
- ' *** ------------------------------------------------------------------------------
- ' *** Version: 1.0
- ' *** Notes:
- ' *** ------------------------------------------------------------------------------
- ' *** Copyright (C) Microsoft Corporation 2005, All Rights Reserved
- ' *** ------------------------------------------------------------------------------
- ' ***
-
- ' ~~~
- ' ~~~ Force variables to be declared
- ' ~~~
- Option Explicit
-
- ' ~~~ Turn on error handling
- On Error Resume Next
-
- ' ~~~
- ' ~~~ Declare global variables
- ' ~~~
- Dim oShell,sAppDir, sCMD
- Dim oWMIService, oOS, colOperatingSystems, iUninstallTime, iLastBootUpTime, sComputer
-
- ' ~~~ ------------------------------------------------------------------------------
- ' ~~~ Create objects
- ' ~~~ ------------------------------------------------------------------------------
- Set oShell = CreateObject("WScript.Shell")
- sAppDir = oshell.RegRead("HKLM\Software\Microsoft\SharedComputerToolkitUninstall\TargetDir")
-
- ' ~~~ ------------------------------------------------------------------------------
- ' ~~~ Clean!
- ' ~~~ ------------------------------------------------------------------------------
-
- ' ~~~ Check reboot key before trying to run tool
-
- Set oWMIService = GetObject _
- ("winmgmts:\\.\root\cimv2")
- Set colOperatingSystems = oWMIService.ExecQuery _
- ("Select * from Win32_OperatingSystem")
- For Each oOS in colOperatingSystems
- iLastBootUpTime = oOS.LastBootUpTime
- Next
-
- iUninstallTime = oShell.RegRead("HKLM\Software\Microsoft\SharedComputerToolkitUninstall\SCTUninstallTime")
-
- If iUninstallTime < iLastBootUpTime Then
- Call oShell.Run("CMD /C %WinDir%\etprep.exe -delete", 0, True)
- Call oShell.Run("CMD /C DEL %WinDir%\etprep.exe", 0, True)
- Call oShell.Run("CMD /C DEL %WinDir%\ewfdll.dll", 0, True)
- Call oShell.Run("CMD /C DEL %WinDir%\System32\Shared_Computer_Toolkit.log", 0, True)
- Call oShell.Run("CMD /C RD /S /Q " & """" & sAppDir & """", 0, True)
- Call oShell.Run("REG DELETE HKLM\Software\Microsoft\SharedComputerToolkitUninstall /f", 0, True)
-
- Call oShell.Run("REG DELETE HKLM\Software\Microsoft\Windows\CurrentVersion\Run /f /v SCTPostUninstall1", 0, True)
-
- Call oShell.Run("REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce /f /v SCTPostUninstall2 /t REG_EXPAND_SZ /d ""cmd /c del %WinDir%\SCTPostUninstall.VBS""", 0, True)
- End If
-