[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Script or batch to turn off or tweak windows settings

Posted on 2014-12-13
5
Medium Priority
?
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Simon
ID: 40498016
They all sound like things that you'd do through Group Policy - are these devices not on a AD domain?
0
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 2000 total points
ID: 40498088
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
ID: 40520449
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 96

Expert Comment

by:Lee W, MVP
ID: 40520833
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
ID: 40528129
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

650 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