salt.modules.win_powercfg

This module allows you to control the power settings of a windows minion via powercfg.

New in version 2015.8.0.

# Set monitor to never turn off on Battery power
salt '*' powercfg.set_monitor_timeout 0 power=dc
# Set disk timeout to 120 minutes on AC power
salt '*' powercfg.set_disk_timeout 120 power=ac
salt.modules.win_powercfg.get_disk_timeout(scheme=None)

Get the current disk timeout of the given scheme

Parameters

scheme (str) --

The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

  • SCHEME_BALANCED - Balanced

  • SCHEME_MAX - Power saver

  • SCHEME_MIN - High performance

Returns

A dictionary of both the AC and DC settings

Return type

dict

CLI Example:

salt '*' powercfg.get_disk_timeout
salt.modules.win_powercfg.get_hibernate_timeout(scheme=None)

Get the current hibernate timeout of the given scheme

scheme (str):

The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

  • SCHEME_BALANCED - Balanced

  • SCHEME_MAX - Power saver

  • SCHEME_MIN - High performance

Returns

A dictionary of both the AC and DC settings

Return type

dict

CLI Example:

salt '*' powercfg.get_hibernate_timeout
salt.modules.win_powercfg.get_monitor_timeout(scheme=None)

Get the current monitor timeout of the given scheme

Parameters

scheme (str) --

The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

  • SCHEME_BALANCED - Balanced

  • SCHEME_MAX - Power saver

  • SCHEME_MIN - High performance

Returns

A dictionary of both the AC and DC settings

Return type

dict

CLI Example:

salt '*' powercfg.get_monitor_timeout
salt.modules.win_powercfg.get_standby_timeout(scheme=None)

Get the current standby timeout of the given scheme

scheme (str):

The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

  • SCHEME_BALANCED - Balanced

  • SCHEME_MAX - Power saver

  • SCHEME_MIN - High performance

Returns

A dictionary of both the AC and DC settings

Return type

dict

CLI Example:

salt '*' powercfg.get_standby_timeout
salt.modules.win_powercfg.set_disk_timeout(timeout, power='ac', scheme=None)

Set the disk timeout in minutes for the given power scheme

Parameters
  • timeout (int) -- The amount of time in minutes before the disk will timeout

  • power (str) --

    Set the value for AC or DC power. Default is ac. Valid options are:

    • ac (AC Power)

    • dc (Battery)

  • scheme (str) --

    The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

    • SCHEME_BALANCED - Balanced

    • SCHEME_MAX - Power saver

    • SCHEME_MIN - High performance

Returns

True if successful, otherwise False

Return type

bool

CLI Example:

# Sets the disk timeout to 30 minutes on battery
salt '*' powercfg.set_disk_timeout 30 power=dc
salt.modules.win_powercfg.set_hibernate_timeout(timeout, power='ac', scheme=None)

Set the hibernate timeout in minutes for the given power scheme

Parameters
  • timeout (int) -- The amount of time in minutes before the computer hibernates

  • power (str) --

    Set the value for AC or DC power. Default is ac. Valid options are:

    • ac (AC Power)

    • dc (Battery)

  • scheme (str) --

    The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

    • SCHEME_BALANCED - Balanced

    • SCHEME_MAX - Power saver

    • SCHEME_MIN - High performance

Returns

True if successful, otherwise False

Return type

bool

CLI Example:

# Sets the hibernate timeout to 30 minutes on Battery
salt '*' powercfg.set_hibernate_timeout 30 power=dc
salt.modules.win_powercfg.set_monitor_timeout(timeout, power='ac', scheme=None)

Set the monitor timeout in minutes for the given power scheme

Parameters
  • timeout (int) -- The amount of time in minutes before the monitor will timeout

  • power (str) --

    Set the value for AC or DC power. Default is ac. Valid options are:

    • ac (AC Power)

    • dc (Battery)

  • scheme (str) --

    The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

    • SCHEME_BALANCED - Balanced

    • SCHEME_MAX - Power saver

    • SCHEME_MIN - High performance

Returns

True if successful, otherwise False

Return type

bool

CLI Example:

# Sets the monitor timeout to 30 minutes
salt '*' powercfg.set_monitor_timeout 30
salt.modules.win_powercfg.set_standby_timeout(timeout, power='ac', scheme=None)

Set the standby timeout in minutes for the given power scheme

Parameters
  • timeout (int) -- The amount of time in minutes before the computer sleeps

  • power (str) --

    Set the value for AC or DC power. Default is ac. Valid options are:

    • ac (AC Power)

    • dc (Battery)

  • scheme (str) --

    The scheme to use, leave as None to use the current. Default is None. This can be the GUID or the Alias for the Scheme. Known Aliases are:

    • SCHEME_BALANCED - Balanced

    • SCHEME_MAX - Power saver

    • SCHEME_MIN - High performance

Returns

True if successful, otherwise False

Return type

bool

CLI Example:

# Sets the system standby timeout to 30 minutes on Battery
salt '*' powercfg.set_standby_timeout 30 power=dc