Also, Is it also possible to install file & printer sharing if it's not
present?
Thanks!
Hi
You can use Snetcfg.exe for this as long as your clients are Win2k and WinXP.
Snetcfg is a sample tool in the DDK (...\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.
Fortunately, you can download a compiled version (note different version
depending on OS) at
http://www.jsiinc.com/reghack.htm, tip 4705
If you want to use Snetcfg.exe to _enable_ File & Print Sharing (F&PS already
installed, but the checkbox is not checked), you will have to uninstall F&PS
first, and then install again. This will make the checkbox checked.
Win2k with SP >= 2:
snetcfg.exe -v -u MS_Server ' removes F&PS
snetcfg.exe -v -c s -i MS_Server ' adds and enables F&PS
All Win2k:
snetcfg.exe -v -u MS_Server
snetcfg.exe -v -l %windir%\Inf\NETSERV.INF -c s -i MS_Server
With a VBScript:
' Script that enables F&PS
'
' Author: Torgeir Bakken
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)
sSnetcfgPath = "c:\snetcfg\snetcfg.exe"
sUninstCmd = Chr(34) & sSnetcfgPath & Chr(34) & " -u MS_Server"
oShell.Run sUninstCmd, 0, True
sInstCmd = Chr(34) & sSnetcfgPath & Chr(34) & " -l " _
& sWinDir & "\Inf\NETSERV.INF -c s -i MS_Server"
iRC = oShell.Run(sInstCmd, 0, True)
If iRC = 1 Then
MsgBox "Enabling of F&PS failed!", vbExclamation, "F&PS Enabling"
WScript.Quit
End If
MsgBox "F&PS enabled!",, "F&PS Enabling"
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