• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Script or batch to turn off or tweak windows settings

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
murryc
Asked:
murryc
  • 2
  • 2
1 Solution
 
SimonCommented:
They all sound like things that you'd do through Group Policy - are these devices not on a AD domain?
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
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
 
murrycAuthor Commented:
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
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Run the netsh command separately and check for errors.  Review the event logs.  I just tested that command and its working fine.
0
 
murrycAuthor Commented:
You were correct.  Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now