Enable File And Print Sharing for Microsoft Networks with a WMI WSH VBScript

A RIS (Disc) image went out that did not have "File and Print Sharing for Microsoft Networks" turned on! Oh NO! Now I want to fix it with a script deployed with SMS.

I want to be able to turn on (enable) "File and Print Sharing for Microsoft Networks" in my network adaptor configuration, and do it with a VBScript.

Looking at the "Win32_NetworkAdapterConfiguration " I dont see how I can turn this on.

I can do things like set DNS and WINS servers and other nifty stuff like that, but there is appearently no methods for turning this componant on thru this interface.

Has anyone ever done this sort of scripting?

OS: Windows 2000 Advanced Servers & Windows XP Pro clients
ridgewndAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ridgewndAuthor Commented:
Well having researched this for about a week I'm finding that this cannot be done with just a simple script. There is no simple method. When FPS is installed on a machine but not enabled, the simple act of enabling FPS (no reboot needed) causes some (very large)  REG_BINARY changes in the registry that have not been easy (for me anyway) to reverse engineer.
0
ridgewndAuthor Commented:
OK, it occurs to me that maybe there is another way to ask this question.

This is a large organization with over 100,000 WinXP, Win2K, WinNT under remote management using the world largest intranet.

I have a Windows XP Professional Service Pack 1 machine that was shipped to users with File and Print Services installed but not enabled (The check mark is not checked), in the Local Area Connection Properties. BTW, the only other Componants installed and checked are Client for Microsoft Networks, and TCP/IP.

These machines (10,000+ dial-up) are remote to my location, we wont be flying people anywhere just to turn this option on.

How can this function be enabled remotely so that we dont have to ask the users to do it themselves?


0
ridgewndAuthor Commented:
Since these are dial-up machines that I'm dealing with, I have found out that a file called the Rasphone.pbk located in the "Documents and Settings\%UserName%\Application Data\Microsoft\Network\Connections\Pbk\" directory.
This file has two entries that I believe will do the job.
ShardMsFilePrint=1, and
ms_server=1.
I will test this tommorrow.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

ridgewndAuthor Commented:
I tested this and it works. Thats was so easy once I found out about the Rasphone.pbk file.

Now (someday anyway) figure out how to do this with a LAN connection.

0
zenlion420Commented:
PAQd and points refunded (500)

zenlion420
EE Page Editor
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rhumphries_lumleyCommented:
This can be done by copying snetcfg_wxp.exe from the Win2003 res kit (I think) then running 2 DOS commands within a script..

snetcfg_wxp -u MS_Server
snetcfg_wxp -c s -i MS_Server

This disables then enables the File and Printer Sharing for Microsoft Networks settings.  (doesn't appear to work without the disable).
0
nabeelm2003Commented:

uninstalling the MS_server and installing it again works.

However, I don't want to take such action unless File & Printer Sharing is disabled. I could not find a way to check on the status of File & Printer Sharing whether it is enabled or disabled using the snetcfg_wxp tool.



0
outlander0088Commented:
Has anyone been able to get this working on LAN connections?  I am in the same situation, have file and print installed but not checked/enabled.  I need to enable/disable it via login scripts.
0
BDBartlettCommented:
I am new and just joined because I found this question on a search. I need the answer. I knew about the rasphone.pbk file but need a lan solution and not by login in scripts either.

The solution title (Enable File And Print Sharing for Microsoft Networks with a WMI WSH VBScript) implies a scripting solution, yet the "Accepted Answer" says "PAQd and points refunded (500)". and the "comment" following that references a solution with an EXE that does not exist in my Win2003 server Resource kit.

Is there an answer for my $9.95 signup fee?    :)
0
BDBartlettCommented:
This is what I payed 10 bucks for.  A few caveats:
the text is wrong it does NOT enable\disable FPS it uninstalls and then re-installs the Server Service (lanmanserver). It removes and installs the FPS network component and then enables it.
It also deletes the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer
key and thus any shares because they are at
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares

So it would be wise to save the lanmanserver key and copy back anything that needs to be saved. I lost 25 shares that I now have to recreate, thank goodness for documentation and test environments. It does not work remotely so would have to be used in a logon script very judiciously. The install command line is wrong it should be:
snetcfg_wxp -l c:\winnt\inf\netserv.inf -c s -i MS_Server

It is not a 2003 Resource kit tool because I have it (the RK) installed and snetcfg_wxp did not exist on my HD until I went to the link below.

http://www.jsiinc.com/dl/snetcfg_wxp.zip
0
yeneCommented:
I am still in the sam esituation .Does anybody found out how to enable and disable file and printer sharing using powershell script !!
Thanks
0
Dan_MahoneyCommented:
I've just found this article. I haven't tested it yet but this looks hopeful.
http://www.intelliadmin.com/blog/index.php/2008/12/enable-file-and-printer-sharing-using-group-policy-2/
0
h2odata2Commented:
There is a better way then to use snetcfg as you have to uninstall and reinstall MS_Server to make it work, I had the same problem so made a powershell script with the help of nvspbind.

Made a script and a guide, hope it helps!

http://microsoftis.com/2010/12/27/how-to-enable-file-and-printer-sharing-for-microsoft-networks-on-nic-with-powershell-2/
0
dridenCommented:
I've had good luck with the following:

Myshell.run "netsh firewall set service type=FILEANDPRINT mode=enable"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.