Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: API for removing windows components

54 views
Skip to first unread message

Torgeir Bakken (MVP)

unread,
Jan 18, 2005, 8:17:08 AM1/18/05
to
icefire wrote:

> I'd like to know is there an API or a registry entry to programly remove
> windows components.I don't like to remove them with Add/Remove Programs cpl.
>
> Any suggestion is appreciated!Thank you very much!
Hi

Using sysocmgr.exe with an answer file should work:

http://groups.google.co.uk/groups?selm=40146647.DFC842F5%40hydro.com


--
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/default.mspx

Torgeir Bakken (MVP)

unread,
Jan 18, 2005, 8:16:56 AM1/18/05
to
icefire wrote:

> I'd like to know is there an API or registry entry to remove windows
> components?I don't like to remove them with Add/Remove Programs cpl.
> Any suggestion is appreciated! Thank you.

icefire

unread,
Jan 18, 2005, 10:21:02 PM1/18/05
to
Thank you very much!

I'm sorry I couldn't open the URL
http://groups.google.co.uk/groups?selm=40146647.DFC842F5%40hydro.com.I'm in
china.

But I know the sysocmgr.exe from
http://support.microsoft.com/default.aspx?scid=kb;en-us;222444.Maybe the
utility will fulfill my reqirement.But I'm puzzled with the detail as
following:
[Components]
Netoc = on
Reminst = on
Paint = off
pinball = off
Solitaire = off

[NetOptionalComponents]
lpdsvc = 1
SimpTcp = 1
wins = 1

I'd like to know where I can get the exact alias list, such as
pinball,Paint, etc. And would you please explain the meanings of "on" or
"off",and "1" or "0".

Thank you very much!

icefire

unread,
Jan 18, 2005, 10:23:01 PM1/18/05
to
Thank you very much!

But I know the sysocmgr.exe from
http://support.microsoft.com/default.aspx?scid=kb;en-us;222444.Maybe the
utility will fulfill my reqirement.But I'm puzzled with the detail as
following:
[Components]
Netoc = on
Reminst = on
Paint = off
pinball = off
Solitaire = off

[NetOptionalComponents]
lpdsvc = 1
SimpTcp = 1
wins = 1

I'd like to know where I can get the exact alias list, such as
pinball,Paint, etc. And would you please explain the meanings of "on" or
"off",and "1" or "0".

Thank you very much!

Torgeir Bakken (MVP)

unread,
Jan 19, 2005, 8:28:23 AM1/19/05
to
icefire wrote:

> Thank you very much!
>
> I'm sorry I couldn't open the URL
> http://groups.google.co.uk/groups?selm=40146647.DFC842F5%40hydro.com

> I'm in china.
Hi

Here is what was in that post:


Q222444 How to Add or Remove Windows 2000 Components with Sysocmgr.exe
http://support.microsoft.com/default.aspx?scid=kb;en-us;222444

And on Windows 2000, if you want to use Sysocmgr to remove networking
components, be sure to have SP3 or SP4 installed:

You Cannot Remove Network Components with Sysocmgr.exe and a Script
http://support.microsoft.com/default.aspx?scid=KB;EN-US;304392


More links and info:

3428 » How can I add or remove Windows 2000 components from a batch?
http://www.jsiinc.com/subg/tip3400/rh3428.htm


From: Doug Hutchens [MS] (dou...@microsoft.com)
Subject: Re: Unattended Terminal Service Installation (not thru a
winnt.sif file)
Newsgroups: microsoft.public.windowsnt.terminalserver.setup
Date: 2002-04-25 22:51:46 PST
http://groups.google.com/groups?selm=e3ISwXO7BHA.1656%40tkmsftngp05

<quote>
There is a built-in tool called sysocmgr.exe that you can use to
add/remove optional windows components after the server is installed.
It uses the same unattend file options as winnt.sif.

All the TS unattend file options are located in "unattend.doc" on the
Windows 2000 server CD.

</quote>


From: Chris Manderson (chrisma...@online.microsoft.com)
Subject: RE: Automatic MSMQ setup on Windows 2000 Professional?
Newsgroups: microsoft.public.msmq.deployment
Date: 2002-08-19 13:27:49 PST
http://groups.google.com/groups?selm=YPK5R17RCHA.3184%40cpmsftngxa10

<quote>
Using sysocmgr should get you where you want to go. This can perform an
unattended install for you.

See the Windows 2000 Advanced Server Help file for info on exactly how
to do this.

</quote>

Here is a script that removes the games for Win2k and WinXP (based on
a script by Michael Bouchard):


'--------------------8<----------------------
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

'--------------------8<----------------------

icefire

unread,
Jan 19, 2005, 8:47:01 PM1/19/05
to
Thank Torgeir Bakken,you saved my times.
Thank you very much!

Gerry Hickman

unread,
Dec 5, 2005, 5:10:08 PM12/5/05
to
mainguy wrote:
> Instead of adding or removing windows components, is there anyway to have a
> list of all installed components instead of going to Control Panel > Add or
> Remove Programs > Add or Remove Windows Components? I want to be able to
> verify the list within a vbscript.

Interesting, I had a quick look and can't find anything related to this...

--
Gerry Hickman (London UK)

0 new messages