Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using PsExec to access cmd on a Windows 7 computer on my network, and I want to turn on File and Printer Sharing, followed by the Windows firewall without having to get up and walk all the way to the computer.

What commands do I need to use to do this?

Thanks

share|improve this question
    
I thought psexec required file and print sharing before it would remotely connect. How can you remotely enable it, if you can't connect to remotely enable it? – Zoredache Apr 12 '12 at 16:55
    
The Firewall is currently off – JMK Apr 13 '12 at 7:57
up vote 7 down vote accepted

This command should take care of the File and Printer Sharing:

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

For the firewall:

netsh advfirewall set currentprofile state on

I've tried them just now, and its seems to work for me.

For any additional information see Microsofts KB article: http://support.microsoft.com/kb/947709

Regards,

Patrick Jørgensen

share|improve this answer
1  
Thanks for the KB link for netsh advfirewall. That's handy. – Rilgon Arcsinh Apr 12 '12 at 10:22

You can use the net start command to start a service. For example:

net start "Windows Firewall"

From my limited investigation, though, File and Printer Sharing is not a service invokable by name at a CLI. Windows Firewall is, however.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .