I need a script to run to turn off the firewall and turn on file sharing and discovery?


Please help.

Answer Summary:
0 Comments   [ - ] Hide Comments


  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment

Community Chosen Answer


You didn't mention what operating system, but you should be able to run a batch file similar to this:

netsh firewall set opmode disable
netsh firewall set service type=fileandprint mode=enable profile=all
netsh advfirewall firewall set rule group=”network discovery” new enable=yes

Answered 12/30/2014 by: jknox
Red Belt

  • Thanks, can you should me how to create a Batch file. I have used VB scripts and new in creating batch files to run through online shell.
    • I would use an online kscript and select "run a batch file" under the On Success portion of the Task.

      I would also suggest to make sure the commands I posted work properly on a test machine before creating the kscript.
      • is there away to do this silently no pop up cmd screen
Please log in to comment
Answer this question or Comment on this question for clarity


Wouldn't this be better handled by Group Policy ?

Answered 12/30/2014 by: spartacus
Black Belt

  • It could, but our policy people are not in I would like to handle it on the PC level
Please log in to comment
This is pretty much unavoidable as you are calling command line utilities. The changes are likely to be recorded in the registry so if you capture the changes made by each script line then you can add them directly without running the utilities.
Answered 12/30/2014 by: EdT
Red Belt

Please log in to comment
script is working thank you
Answered 12/30/2014 by: Kdebiasse
Eighth Degree Black Belt

Please log in to comment

getting CMDs to run without the pop is a bit tricky.

I have a vbs that can call a CMD (or any other exe etc), but it always seems a bit wrong in my head, you might just aswell create a vbs that does it all, anyway....

here is the script, you need to change the objshell.run bit, to your target, the name of your CMD file, or any other exe.


on Error Resume Next
' Declare Constants and Variables

Set objShell = CreateObject ("WScript.Shell")

objShell.Run "Firewall.cmd",0 , True

' Clean up

set objShell = Nothing

Answered 01/01/2015 by: Badger
Red Belt

Please log in to comment