Re: Enable/Disable File and Printer Sharing

From: Torgeir Bakken (MVP) (Torgeir.Bakken-spam_at_hydro.com)
Date: 02/27/04


Date: Fri, 27 Feb 2004 01:12:55 +0100

Jon wrote:

> I am looking for a way to enable and disable file and
> printer sharing.

I have never seen a script resolution for this...

> I can install and uninstall the service successfully.
> This doesn't help me. Uninstalling file and print also
> removes the server service.
>
> With file and print services installed but disabled, the
> server service is installed and running. I need this
> specific configuration to be successful.

After you have removed F&PS e.g. with snetcfg.exe, you can
install the server service again, this works for me at least:

Export the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer

from a machine where the server service is running as it should, to a registry
file with e.g. the name Lanmansvr.reg

Then, on a computer with no server service installed, run the following two
command lines from e.g. a batch file (note that the rundll32 line will wrap in
the newsreader!):

%SystemRoot%\system32\rundll32.exe setupapi.dll,InstallHinfSection Install.ndi
132 %SystemRoot%\Inf\netserv.inf

regedit.exe /s "Lanmansvr.reg"

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


Relevant Pages

  • Re: Enable/Disable File and Printer Sharing
    ... >> I can install and uninstall the service successfully. ... >> server service is installed and running. ... >Export the registry key ... >Microsoft MVP Scripting and WMI, ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Starting the Server Service in Windows XP
    ... I checked all the parameters using regedit and they all say what you ... I have the following error when I start the Server Service of XP ... "%SystemRoot%\System32\svchost.exe -k netsvcs" ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Server Services
    ... If you need to add the server service back again: ... and reboot, and then install F&PS (it will install ... Export the registry key ... Microsoft MVP Scripting and WMI, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Disable File sharing
    ... > I want to put it in my login script NT4 enivronment with XP clients. ... You could disable the server service, ... A simple registry update will also disable the server service: ... Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.security_admin)
  • Re: No Server Service
    ... > message that the server service is not started I went ... Export the registry key ... command line from a command prompt or Start\Run ... Microsoft MVP Scripting and WMI, ...
    (microsoft.public.windowsxp.security_admin)

Loading