Subscribe

Get the Network Administrators tool pack

Subscribe to our newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them.

Click Here to get your free tools

Recent Posts

Search

Archives

Enable File and Printer sharing from a script

Post image for Enable File and Printer sharing from a script

by Steve Wiseman on January 25, 2013 · 6 comments

in Microsoft,Tips,Tools


.

File and printer sharing is needed for a variety of Windows administration tools.

Our Remote Control, and Network Administrator need it to do their work.

If you want to use the remote execution tool PSExec from Microsoft, it needs to be enabled.

The same is true for other utilities like the cool software over at systemtools.com

The problem is..well..it is a pain to enable file and printer sharing.

With Windows XP, you have this nifty feature called “Simple File Sharing”. It needs to be disabled for remote admin tools to work, and it is enabled by default.

Unfortunately it is hidden under a folders option menu:

XP Simple File Sharing

With Vista and higher there is an even better feature called “Remote UAC”.

Short version: It keeps you from using file and printer sharing for remote administration. Even more frustrating the option can only be changed by digging around in the registry.

Once you get those things taken care of, you still need to go into the firewall settings and enable file and printer sharing:

File and printer sharing firewall

During the holidays a very generous reader sent me a script to take care of all of this in one shot. I cleaned it up a little and you can use it to easily enable file and printer sharing for remote administration tasks – without the hassles of going through wizards and dialogs.

You just run it from the command line like this:

cscript.exe enable_fps.vbs

In a few moments it will enable everything needed to get file and printer sharing working for you:

File and printer sharing script output

Get a copy of it from here:

Enable File and Printer Sharing Script

(Rename to enable_fps.vbs after downloading)

Note: On Vista and higher you will need to make sure your command prompt is elevated for it to work 🙁

One more thing…Subscribe to my newsletter and get 11 free network administrator tools, plus a 30 page user guide so you can get the most out of them. Click Here to get your free tools

Related Articles:

{ 6 comments… read them below or add one }

1 John Davis January 25, 2013 at 3:16 pm

Thanks for the script steve. The gem in there is simple file sharing. I have been looking for a way to script that for quite some time.

2 David Chang January 25, 2013 at 4:43 pm

Any idea if this works for Windows server 2012?

3 Steve Wiseman January 25, 2013 at 4:44 pm

Hi David,

Have not tested it here yet, but pretty sure it will work fine without any changes. Just make sure you run it from an elevated command prompt.

4 eddie October 21, 2014 at 3:55 pm

how would i run this script remotely?

5 Steve Wiseman November 7, 2014 at 10:29 am

Hi Eddie,

You can’t. The reason is you need file and printer sharing to execute things remotely…so really the only way would be to put it into a logon script or run it manually.

6 Steve Mantz March 9, 2016 at 10:49 am

Hi Steve,

Script seems to work great. I will try it from AD if possible. Can I make the script run silently so my users don’t see the screens and Freak out?

Also, is there way to have it run in an elevated user mode?

Leave a Comment

Category Links - Windows Forum - Exchange Forum