Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 4 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.