Solved

Script or batch to turn off or tweak windows settings

Posted on 2014-12-13
5
397 Views
Last Modified: 2015-01-02
I need a script or batch that I can run on Windows 7/8/2003/2008 that will do the following...

Turn off and disable Windows firewall

Adjust 'balanced' power options to turn off display after 30 mins and put the computer to sleep 'never', when plugged in.
0
Comment
Question by:murryc
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:SimonAdept
Comment Utility
They all sound like things that you'd do through Group Policy - are these devices not on a AD domain?
0
 
LVL 95

Accepted Solution

by:
Lee W, MVP earned 500 total points
Comment Utility
Group Policy is definitely the way you should be doing this.  If that's not possible for some reason, the user will need to run the script as an administrator -
@ECHO OFF
REM Save the currently active scheme to "ActiveScheme" variable so we can restore it.
for /f "tokens=4" %%a in ('powercfg -getactivescheme') do @Set ActiveScheme=%%a
REM Set the Balanced power scheme to active so we can change settings
powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e

REM Change the necessary AC settings
powercfg -change -monitor-timeout-ac 30
powercfg -change -standby-timeout-ac 0
powercfg -change -hibernate-timeout-ac 0

REM Restore the power scheme
powercfg -setactive %ActiveScheme%

REM Disable the fire wall - use enable instead of disable to re-enable
netsh advfirewall set allprofiles state off

Open in new window


Test the above first - I have not.
0
 

Author Comment

by:murryc
Comment Utility
This will be used on standalone systems, so local GPO would work okay, but I am looking to automate these steps.

Lee, the batch tweaks the power options ok, but the firewall is not changing its state to disabled and the service is not stopping.  Do I need to insert something into your batch?
0
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
Run the netsh command separately and check for errors.  Review the event logs.  I just tested that command and its working fine.
0
 

Author Comment

by:murryc
Comment Utility
You were correct.  Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now