Follow us on Twitter

Have a question on something? Visit the forum for help.

NEW!! LazyNetworkAdmin Forums! Click -> here

 

Uninstall Microsoft Products Silently PDF Print E-mail

I've been gone due to changing jobs. I no longer get the pleasure to work with the Lazy Network Admin.
But, the scripts must go on! This script should be run as a logon script and it will remove MS Project silently from a computer.
Whats good about this script is that you can modify it a bit and remove any software with a silent switch!
Give it a try. I hope it helps you out.

----------COPY EVERYTHING BELOW THIS LINE for the Script----------

'Script to uninstall Project 2003 Standard or Pro Silently
'Created by Cheyenne Haren 6.26.07

 

On Error Resume Next
Const HKLM = &H80000002
Const ForWriting = 8
strFile = "uninstall.bat" 'name of the uninstall file
strPath = "C:\scripts\" 'local folder
' Change one of the strings below to reflect what you need to uninstall
strWriteFile = "MsiExec.Exe /x {903A0409-6000-11D3-8CFE-0150048383C9} /qn" 'Quiet uninstall string
strStartKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903A0409-6000-11D3-8CFE-0150048383C9}" 'Project STD registry key
'strStartKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{913B0409-6000-11D3-8CFE-0150048383C9}" 'Project PRO registry key

 

Set objFSO = CreateObject("Scripting.FileSystemObject")
 
CheckIfRegKeyExist()
CreateFolder()
CreateFile()
WriteFile()
ExecuteFile()

 

Function CheckIfRegKeyExist()
   Set objRegistry = GetObject("winmgmts:root\default:stdregprov")

 

   If objRegistry.EnumKey(HKLM, strStartKey, arrSubKeys) = 0 Then
  CheckIfRegKeyExist = True
  'WScript.Echo "True"
   Else
  CheckIfRegKeyExist = False
  'WScript.Echo "False"
  WScript.Quit
   End If
   Set objRegistry = Nothing
End Function

 

Function CreateFolder()
 Set objFSOf = CreateObject("Scripting.FileSystemObject")
 
 If objFSOf.FolderExists(strPath) Then
  'Wscript.Echo "scripts folder exists"
 Else
  Set objFolder = objFSO.CreateFolder(strPath)
  'Wscript.Echo "scripts folder does NOT exist"
 End If
 Set objFolder = nothing
End Function

 

Function CreateFile()
 'Set objFSO = CreateObject("Scripting.FileSystemObject")
 If objFSO.FileExists(strPath & strFile) Then
  'Wscript.Echo "file exists"
  WScript.Quit
 Else
  'Wscript.Echo "File does not exist."
  Set objFile = objFSO.CreateTextFile(strPath & strFile)
  objFile.Close
  'Wscript.Echo "file created"
 End If
End Function

 

Function WriteFile()
 Set objFileSystem = CreateObject("Scripting.fileSystemObject")
 Set objOutputFile = objFileSystem.OpenTextFile(strPath & strFile, ForWriting, True)
 objOutputFile.WriteLine( "@echo off" & vbCrLf & strWriteFile)
 objOutputFile.Close
End Function

 

Function ExecuteFile()
 Set objShell = CreateObject("WScript.Shell")
 objShell.Run strPath & strFile
End Function

 

 

----------COPY EVERYTHING ABOVE THIS LINE for the Script----------

 

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need the items below!


1. Run this script as a logon script.
2. You can change the stringbelow to reflect your silent uninstall sting:
strWriteFile = "MsiExec.Exe /x {903A0409-6000-11D3-8CFE-0150048383C9} /qn" 'Quiet uninstall string
3. Change this key to reflect the pathof the uninstall you would like to perform:
strStartKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903A0409-6000-11D3-8CFE-0150048383C9}" 'Project STD registry key

This information is provided "AS IS" with no warranties expressed or implied.




Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! TwitThis Joomla Free PHP
 
 

Sponsored Links