I need this for an installer I'm working on.
Any information on the subject would be appreciated.
Thanks
PL.
Hi
For network protocol install/uninstall, the command line based Snetcfg.exe is
an option.
Snetcfg is a sample tool in the MS Driver Development Kit
(...\src\network\config\netcfg) that must be compiled into an exe from the
source (C/C++?) before it can be used. It can list, install and uninstall most
network components (note: Win2k and WinXP only).
More about MS Driver Development Kit here:
http://www.microsoft.com/whdc/ddk/winddk.mspx
Fortunately, you can download a compiled version of Snetcfg.exe (note different
version depending on OS) at
http://www.jsiinc.com/reghack.htm, tip 4705
Examples and help listing:
This should remove the MS Netware Client:
snetcfg.exe -v -l %windir%\inf\netnwcli.inf -u ms_nwclient
This should remove the IPX protocol
snetcfg.exe -v -l %windir%\inf\netnwlnk.inf -u ms_nwipx
Here is a vbscript with some error checking as well:
sSnetcfgPath = "some path to snetcfg.exe"
Set oShell = CreateObject("WScript.Shell")
sNWUninstCmd = Chr(34) & sSnetcfgPath & Chr(34) & " -v -l " _
& "%windir%\inf\netnwcli.inf -u ms_nwclient"
iRC = oShell.Run(sNWUninstCmd, 0, True)
If iRC = 1 Then
MsgBox "Uninstall of MS Netware Client failed!", _
vbExclamation, "MS Netware Client removal"
Else
' only remove IPX if the MS Netware Client removal succeeded.
sIPXUninstCmd = Chr(34) & sSnetcfgPath & Chr(34) & " -v -l " _
& "%windir%\inf\netnwlnk.inf -u ms_nwipx"
iRC = oShell.Run(sIPXUninstCmd, 0, True)
If iRC = 1 Then
MsgBox "Uninstall of IPX protocol failed!", _
vbExclamation, "IPX protocol removal"
End If
End If
Here is the help output from snetcfg.exe:
C:\>snetcfg /?
snetcfg [-v] [-l <full-path-to-component-INF>] -c <p|s|c> -i <comp-id>
where,
-l provides the location of INF
-c provides the class of the component to be installed
p == Protocol, s == Service, c == Client
-i provides the component ID
The arguments must be passed in the order shown.
Examples:
snetcfg -l c:\oemdir\foo.inf -c p -i foo
...installs protocol 'foo' using c:\oemdir\foo.inf
snetcfg -c s -i MS_Server
...installs service 'MS_Server'
OR
snetcfg [-v] -q <comp-id>
Example:
snetcfg -q MS_IPX
...displays if component 'MS_IPX' is installed
OR
snetcfg [-v] -u <comp-id>
Example:
snetcfg -u MS_IPX
...uninstalls component 'MS_IPX'
OR
snetcfg [-v] -s <a|n>
where,
-s provides the type of components to show
a == adapters, n == net components
Examples:
snetcfg -s n
...shows all installed net components
OR
snetcfg [-v] -b <comp-id>
Examples:
snetcfg -b ms_tcpip
...shows binding paths containing 'ms_tcpip'
General Notes:
-v turns on the verbose mode
-? Displays this help
--
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
Great, thank you, I'm going to try it out.
PL.
Have tested it in my installer and it works great,
just what I needed, thanks :-)
PL.