Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = '10.0.0.10';
- $username = 'username';
- $password = 'password';
- $WbemLocator = new COM ( "WbemScripting.SWbemLocator" );
- $objPwr = $WbemLocator->ConnectServer ( $host, 'root\cimv2power', $username, $password );
- $PowerPlanInstanceID = '{8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c}'; //Performance
- $ACDC = 'AC';
- $InstansID = 'Microsoft:PowerSettingDataIndex\\'.$PowerPlanInstanceID.'\\'.$ACDC.'\\{3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e}'; //Turn off display after
- // Change PowerSetting for "Turn off display after" from default 800 to 600
- $query = "Select * from Win32_PowerSettingDataIndex WHERE InstanceID = '$InstansID'";
- $PowerPlanSetting = $objPwr->ExecQuery ( $query );
- foreach ( $PowerPlanSetting as $Setting ) {
- $Setting->SettingIndexValue = '600';
- }
- // Activating PowerPlan
- $PowerPlan = $objPwr->ExecQuery ( "Select * from Win32_PowerPlan WHERE ElementName = 'High performance'" );
- foreach ( $PowerPlan as $Plan ) {
- $Plan->Activate();
- }
- // Check PowerSetting
- foreach ( $PowerPlanSetting as $Setting ) {
- echo $Setting->InstanceID . ' '. $Setting->SettingIndexValue;
- }
- ?>
Add Comment
Please, Sign In to add comment