Home All Groups Group Topic Archive Search About

Configure Presentation Power schemes settings via WMi/API

Author
28 Nov 2007 4:12 AM
rflazaro
Hi All,

We are trying to build an automation utility to configure OS. I found a way
to automate the processes below via registry:

Control Panel -> Power Options -> Power Schemes Tab:
-> Power schemes -> Presentation

    Turn off monitor    Never
    Turn off hard disks    Never
    System Standby    Never

HKEY_CURRENT_USER\Control Panel\PowerCfg
String Value name    Value Data
CurrentPowerPolicy    2

HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2
- set above settings then export the key
- run the imported registry setting in the code

But may I ask for anyone who could help me find a way to automate in C# the
process above via WMI/API?

Thanks in advance!

Author
28 Nov 2007 12:51 PM
Willy Denoyette [MVP]
This and all of your previous questions can be answered by using the RSoP
WMI Classes, you should also take a look at the GPO command line tools.
Search MSDN for RSOP.

Willy.

Show quote
"rflazaro" <rflazaro@nospam.nospam> wrote in message
news:5BE32B17-AFD2-4710-87DD-7367864807A1@microsoft.com...
> Hi All,
>
> We are trying to build an automation utility to configure OS. I found a
> way
> to automate the processes below via registry:
>
> Control Panel -> Power Options -> Power Schemes Tab:
> -> Power schemes -> Presentation
>
>    Turn off monitor Never
>    Turn off hard disks Never
>    System Standby Never
>
> HKEY_CURRENT_USER\Control Panel\PowerCfg
> String Value name Value Data
> CurrentPowerPolicy 2
>
> HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2
> - set above settings then export the key
> - run the imported registry setting in the code
>
> But may I ask for anyone who could help me find a way to automate in C#
> the
> process above via WMI/API?
>
> Thanks in advance!
Author
29 Nov 2007 2:23 AM
rflazaro
Hi,

Thanks for the reply but I don't think RSoP will work for my case. The Group
Policy Management Console can only be installed in a domain server. I forgot
to mention that I'm currently using WEPOS as my OS for the automation. Sorry
my bad!


Show quote
"Willy Denoyette [MVP]" wrote:

> This and all of your previous questions can be answered by using the RSoP
> WMI Classes, you should also take a look at the GPO command line tools.
> Search MSDN for RSOP.
>
> Willy.
>
> "rflazaro" <rflazaro@nospam.nospam> wrote in message
> news:5BE32B17-AFD2-4710-87DD-7367864807A1@microsoft.com...
> > Hi All,
> >
> > We are trying to build an automation utility to configure OS. I found a
> > way
> > to automate the processes below via registry:
> >
> > Control Panel -> Power Options -> Power Schemes Tab:
> > -> Power schemes -> Presentation
> >
> >    Turn off monitor Never
> >    Turn off hard disks Never
> >    System Standby Never
> >
> > HKEY_CURRENT_USER\Control Panel\PowerCfg
> > String Value name Value Data
> > CurrentPowerPolicy 2
> >
> > HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2
> > - set above settings then export the key
> > - run the imported registry setting in the code
> >
> > But may I ask for anyone who could help me find a way to automate in C#
> > the
> > process above via WMI/API?
> >
> > Thanks in advance!
>
>
>
Author
29 Nov 2007 9:05 AM
Willy Denoyette [MVP]
"rflazaro" <rflazaro@nospam.nospam> wrote in message
news:A1D8A776-861D-4A1D-BADA-2293668BEBD5@microsoft.com...
> Hi,
>
> Thanks for the reply but I don't think RSoP will work for my case. The
> Group
> Policy Management Console can only be installed in a domain server. I
> forgot
> to mention that I'm currently using WEPOS as my OS for the automation.
> Sorry
> my bad!
>

GPM Console and RSoP can be used for Local (registry policy seting) Computer
Policy management,  just run mmc and add the "Local Computer Policy" add-in,
and look at the Computer and User Configuration - Administrative Templates.
These templates contain the information you are looking for.
Don't know whether WEPOS contains the RSoP WMI provider though, this is
something you can find out by running wbemtest and connect to the root/rsop
namespace.

Willy.
Author
29 Nov 2007 9:59 AM
rflazaro
Hi,

I was able to explore on the GPM Console by running gpedit.msc in the
command prompt just to see what are the available policies I could use via
RSoP but it seems to not have some of the policies that I am having trouble
with automating including how to configure Presentation Power schemes
settings. :(

Show quote
"Willy Denoyette [MVP]" wrote:

> "rflazaro" <rflazaro@nospam.nospam> wrote in message
> news:A1D8A776-861D-4A1D-BADA-2293668BEBD5@microsoft.com...
> > Hi,
> >
> > Thanks for the reply but I don't think RSoP will work for my case. The
> > Group
> > Policy Management Console can only be installed in a domain server. I
> > forgot
> > to mention that I'm currently using WEPOS as my OS for the automation.
> > Sorry
> > my bad!
> >
>
> GPM Console and RSoP can be used for Local (registry policy seting) Computer
> Policy management,  just run mmc and add the "Local Computer Policy" add-in,
> and look at the Computer and User Configuration - Administrative Templates.
> These templates contain the information you are looking for.
> Don't know whether WEPOS contains the RSoP WMI provider though, this is
> something you can find out by running wbemtest and connect to the root/rsop
> namespace.
>
> Willy.
>
Author
29 Nov 2007 10:22 AM
Willy Denoyette [MVP]
"rflazaro" <rflazaro@nospam.nospam> wrote in message
news:C524B759-BBF8-4C18-8274-CBF402910EBD@microsoft.com...
> Hi,
>
> I was able to explore on the GPM Console by running gpedit.msc in the
> command prompt just to see what are the available policies I could use via
> RSoP but it seems to not have some of the policies that I am having
> trouble
> with automating including how to configure Presentation Power schemes
> settings. :(


This specific Power Management option is only available in Vista and higher.
What stops you from setting this through the Registry API's?


Willy.

AddThis Social Bookmark Button