> it is possible to execute the uninstall of programs with SCRIPT - in
> background?
Yes, if the application supports unattended uninstall. Software packaged with
Windows Installer, Wise and InstallShield often do that.
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> escreveu na mensagem
news:40104D77...@hydro.com...
> Torgeir Bakken (MVP) wrote:
> > "ts...@teste.com" wrote:
> >
> > > it is possible to execute the uninstall of programs with SCRIPT - in
> > > background?
> >
> > Yes, if the application supports unattended uninstall. Software packaged
> > with Windows Installer, Wise and InstallShield often do that.
>
> you it could help me with an example?
Hi
To be able to help, please supply the following information from the registry,
for each package you want to uninstall:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<something>
The value of
1) the key <something>
2) <something>\DisplayName
3) <something>\UninstallString
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> escreveu na mensagem
news:40111A45...@hydro.com...
> ... and as I would make to desinstalar the GAMES of Windows 2000?
Hi
You can use sysocmgr.exe for this.
More about sysocmgr.exe here:
http://groups.google.com/groups?selm=3EAEF13E.7C4114E7%40hydro.com
Here is a script that removes the games for Win2k and WinXP (based on a script
by Michael Bouchard):
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oShell : Set oShell = createobject("wscript.shell")
SetLocale "en-us" ' Do not remove!
sWinDir = oFSO.GetSpecialFolder(0)
sPrograms = oShell.SpecialFolders("AllUsersPrograms")
iOsVer = GetOsVersionNumber
'================================================================
' Uninstall games from Windows XP
'================================================================
If iOsVer = 5.1 Then
' WinXP
If (oFSO.FolderExists(sPrograms & "\games")) Then
' Create file for uninstalling games
Set f = oFSO.CreateTextFile(sWinDir & "\inf\wmdtocm.txt", True)
f.WriteLine("[Components]")
f.WriteLine("freecell=off")
f.WriteLine("hearts=off")
f.WriteLine("minesweeper=off")
f.WriteLine("msnexplr=off")
f.WriteLine("pinball=off")
f.WriteLine("solitaire=off")
f.WriteLine("spider=off")
f.WriteLine("zonegames=off")
f.Close
oShell.Run "sysocmgr.exe /i:%windir%\inf\sysoc.inf" _
& " /u:""%windir%\inf\wmdtocm.txt"" /q", 0, True
oShell.Run "%Comspec% /C RD /S /Q " _
& Chr(34) & sPrograms & "\games" & Chr(34), 0, True
End If
End If
'================================================================
' Uninstall games from Windows 2000
'================================================================
If iOsVer = 5 Then
' Win2k
If (oFSO.FolderExists(sPrograms & "\accessories\games")) Then
' Create file for uninstalling games
Set f = oFSO.CreateTextFile(sWinDir & "\inf\wmdtocm.txt", True)
f.WriteLine("[Components]")
f.WriteLine("freecell=off")
f.WriteLine("minesweeper=off")
f.WriteLine("pinball=off")
f.WriteLine("solitaire=off")
f.Close
oShell.Run "sysocmgr.exe /i:%windir%\inf\sysoc.inf" _
& " /u:""%windir%\inf\wmdtocm.txt"" /q", 0, True
End If
End If
Function GetOsVersionNumber()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Determines OS by reading reg val & comparing to known values
' OS version number returned as number of type double:
' Windows 2k: 5
' Windows XP: 5.1
' Windows Server 2003: 5.2
' Windows x: >5.2
' Note: Decimal point returned is based on the Locale setting
' of the computer, so it might be returned as 5,1 as well.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim sOStype, sOSversion
On Error Resume Next
sOStype = oShell.RegRead(_
"HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType")
If Err.Number<>0 Then
' Hex(Err.Number)="80070002"
' - Could not find this key, OS must be Win9x
Err.Clear
sOStype = oShell.RegRead(_
"HKLM\SOFTWARE\Microsoft\Windows" & _
"\CurrentVersion\VersionNumber")
Select Case sOStype
Case "4.00.950"
sOSversion = 1 ' Windows 95A
Case "4.00.1111"
Dim sSubVersion
sSubVersion = oShell.RegRead(_
"HKLM\SOFTWARE\Microsoft\Windows" & _
"\CurrentVersion\SubVersionNumber")
Select Case sSubVersion
Case " B"
sOSversion = 1 ' Windows 95B
Case " C"
sOSversion = 1 ' Windows 95C
Case Else
sOSversion = 1 ' Unknown Windows 95
End Select
Case "4.03.1214"
sOSversion = 1 ' Windows 95B
Case "4.10.1998"
sOSversion = 2 ' Windows 98
Case "4.10.2222"
sOSversion = 2 ' Windows 98SE
Case "4.90.3000"
sOSversion = 3 ' Windows Me
Case Else
sOSversion = 1 ' Unknown W9x/Me
End Select
Else ' OS is NT based
sOSversion = oShell.RegRead(_
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
If Err.Number<>0 Then
GetOsVersion = "Unknown NTx"
' Could not determine NT version
Exit Function ' >>>
End If
End If
' Setting Locale to "en-us" to be indifferent to country settings.
' CDbl might err else
SetLocale "en-us"
GetOsVersionNumber = CDbl(sOSversion)
End Function