Jump to content

Script for work station Power Settings

Recommended Posts

Hello all, I am new to this, and also to scripting with anything in Automate.  I am looking for ideas to write a script or adopt one that someone may have.  I would like it to do the following for plugged in settings. 

1. Set power to High Performance
2. Turn off Monitor - 60 minutes
3. Put Computer to Sleep - Never 
4. Advanced Settings - Turn off hard drive - Never
5. Advanced Settings - Sleep - Allow Hybrid Sleep - Off
6. Advanced Settings - USB Settings - Plugged in - Disabled
7. Advanced Settings - PCI Express - Link State - Off
8. Network Card - Power Settings - Off. 

I have offices that run Dental software that if there are any power settings on, the dental software doesn't play well. 

Any help would be very much appreciated.  
Thank You 

Share this post

Link to post
Share on other sites

You can import, export, and change power plans in scripts with powercfg.exe



Here's something I have done in the past for "always on" devices:

  • Create a custom power plan on a reference machine 
  • Export it and grab the file it creates
  • Throw the .pow file on your LTShare\Transfer folder
  • Use an LT script to download and install it

I haven't tried it but you should be able to monitor for your customer power plan as well.

Here's the batch file I wrote to check and see if it's already installed, then install it if not, then set it active:.

Note that your GUID and (PowerPlanName) will differ from mine

:: Set Power Settings
:: Note: custom power profile should be copied in seperate step.
powercfg /h OFF
@echo off
:: Latest power plan with GUID and alias
SET custpow=Power Scheme GUID: 2d1fe04b-0337-4faa-b642-116054518679  (AlwaysOn-v1)

:: Test if latest power plan is installed, install if not
powercfg /list | findstr /c:"%custpow%" > nul
	ECHO Installing Custom Power Scheme
	powercfg /import c:\utils\power\alwayson-v1.pow 2d1fe04b-0337-4faa-b642-116054518679
) ELSE (
    ECHO Custom Power scheme already installed

:: Test if latest power plan is active, set active if not
powercfg /getactivescheme | findstr /c:"%custpow%" > nul
	ECHO Setting Cust power scheme active
	powercfg /setactive 2d1fe04b-0337-4faa-b642-116054518679
) ELSE (
	ECHO Custom power scheme already active


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now