Jump to content




anyweb

Customising Windows 7 deployments - part 3.



Recommended Posts

Imagine the scenario, you deploy some Windows 7 laptops but receive feedback from the users that they don't like the power management default settings,

to get around this you could use Group Policy or if that's not possible due to time constraints or other issues, you could import the power management settings directly into your image based on whether the target pc is a Laptop or Desktop.

 

The default power management plans in Windows 7 are pretty good, but also quite aggressive, so you will probably want to configure them in some way,

 

View current PowerScheme

 

First of all you will need to understand how to 'see' them. On a Client Laptop (not a VM or desktop, as they won't show the profiles we are interested in) open a administrator command prompt and type powercfg -list

 

 

 

C:\Users\windowsnoob\Desktop\LocalGPO>powercfg -list

 

Existing Power Schemes (* Active)

-----------------------------------

Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)

Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)

 

from the above we can see the the Balanced power plan is selected currently.

 

 

 

Export current PowerScheme

 

 

Now let's make some changes to our Power scheme (as a test, change the values for hard disc time out in advanced properties of the current plan).

 

change power.JPG

 

Once you have power management the way you want, we will export our settings using powercfg -export

 

C:\Windows\system32>POWERCFG -EXPORT c:\scheme.pow b20406da-dd0d-432e-859b-399e994c7aff

 

 

 

Import a previously exported PowerScheme

 

 

Now that we have our pow settings saved, let's import them (on another computer) using powercfg -import

 

C:\Windows\system32>POWERCFG -IMPORT c:\scheme.pow

Imported Power Scheme Successfully. GUID: b20406da-dd0d-432e-859b-399e994c7aff

 

and verify

 

C:\Windows\system32>powercfg -list

 

Existing Power Schemes (* Active)

-----------------------------------

Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *

Power Scheme GUID: 7d67c408-0a5b-4bfe-a2e8-19bcb22cf21e (Balanced)

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)

Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)

Power Scheme GUID: cba55b22-5cdc-4a45-b095-225d34a60e99 (Balanced)

Power Scheme GUID: b20406da-dd0d-432e-859b-399e994c7aff (Balanced)

 

Note that even though the scheme is imported, it's not set as default, to do that we have to use the powercfg -set command.

 

 

Set current PowerScheme

 

Ok now that we know how to import it, let's set a powerscheme, to do so use powercfg -setactive guid

 

 

C:\Users\windowsnoob\Desktop\LocalGPO>powercfg -setactive b20406da-dd0d-432e-859b-399e994c7aff

 

let's verify the change

 

C:\Users\windowsnoob\Desktop\LocalGPO>powercfg -list

 

Existing Power Schemes (* Active)

-----------------------------------

Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)

Power Scheme GUID: b20406da-dd0d-432e-859b-399e994c7aff (Balanced) *

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)

Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)

 

It Worked and now our powerscheme is set to our custom scheme.

Share this post


Link to post
Share on other sites


now that we know how to change PowerScheme's we can apply the same logic in a Task Sequence, we use an MDT integrated task sequence to avail of some scripts within MDT.

 

Our first step is to use MDT's Gather function (MDT Settings) to determine if the computer is a laptop or desktop

 

gather.JPG

 

our second step use's the MDT Toolkit Package (MDT Files) as we have copied the powermanagement POW file(s) to a subfolder of the scripts directory called Power

 

use toolkit package.JPG

 

Our next step copies the files to our target folder (c:\windows) using this command line

xcopy.exe "%deployroot%\scripts\power\*" "c:\Windows" /Q /F /R /Y

 

copy powerscheme.JPG

 

Now we Import the power scheme using the powercfg -IMPORT command

 

import power scheme.JPG

 

and now we actually apply the power scheme based on whether the client machine is a laptop or desktop, first step is for a laptop

 

set power scheme laptop.JPG

 

and the query to check if it's a laptop is done on the options tab, the step will only run if the variable IsLaptop is True

 

isLaptop.JPG

 

and finally we have the Desktop Step

 

set desktop.JPG

 

and it's options are as follows

 

islaptop false.JPG

 

that's it, add the group above to a standard Windows 7 Deploy task sequence after the apply operating system step, deploy some Windows 7 laptops and desktops and note the newly changed Power Schemes !

Share this post


Link to post
Share on other sites

no matter where I put these steps I could not get this to work. I am able to manually apply the power schemes via command line within windows so I know my .pow file and guid are correct. It kept telling me that it couldn't find the pow file in the windows directory. I confirmed that it was there, but it would still fail.

Share this post


Link to post
Share on other sites

can you attach your smsts.log file it must list the problem (with your step)

Share this post


Link to post
Share on other sites

I'm sure it is an issue with my step but I can't seem to find the smsts.log file after the machine has booted. I thought it was supposed to be c:\windows\syswow64\ccm\logs\smsts.log ???

Share this post


Link to post
Share on other sites

depends on whether you are in windows pe or not, did you check if there was a SMSTSLOG subdir in ccm\logs ? at what point are you trying to get the log ? during the ts, or after it's failed

Share this post


Link to post
Share on other sites

yes, I'm trying to get it after it has failed (continue on failure checked). So it's in Full windows OS. There isn't a SMSTSLOG subdirectory in the ccm\logs folder. I'm confused and will just end up re-running the task sequence to grab the log I guess.

 

Hey on a side note - I'm trying to populate pc description in Ad with the model and serial number of the machine during deployment. I grabbed something from Maik Koster that was built for MDT but I thought I read it would work on SCCM. Is there anything wrong with using "oEnvironment" in SCCM task sequences?

Share this post


Link to post
Share on other sites

you can post your webservice related questions here, but no, it's fine to use it once specified correctly

Share this post


Link to post
Share on other sites

search for smsts*.log

Share this post


Link to post
Share on other sites

i did, still no luck. I have mucked around with the task sequence so much that I just decided to create a clean "config testing" TS. I have done nothing more than open an HTA, apply an image, windows settings, config mgr client, and apply the power settings.

 

I will see what luck I have then. Hopefully even if it doesn't work, I will be able to find the smstslog.

 

I will update.

Share this post


Link to post
Share on other sites

Im not sure what is wrong, but I still cannot find the smstslog file. The only thing I see is in the task sequence report -

 

BaseVar = '', ContinueOnError='' SwdAction = '0001' Set command line: Run command line Working dir 'not set' Executing command line: Run command line Process completed with exit code 1 Command line returned 1

 

This is for the "Import Power Scheme" step. The "Copy Power Scheme" step works fine and does copy the .pow file to c:\windows.

 

This is a 64bit system, I don't need to redirect for 64bit do I?

Share this post


Link to post
Share on other sites

Answered - Apparently I do need to "Disable 64-bit file system redirection" in order for this to work. Everything is ok now.

Share this post


Link to post
Share on other sites

I set mine up but a little different and a few less steps. Just wondering if my method is ok or if I'm overlooking something?

I just created a Run Command Line TS and in command line i have powercfg.exe /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

See any problems with doing it this way?

Share this post


Link to post
Share on other sites

I was wondering how you got the "C:\Windows\system32>POWERCFG -EXPORT c:\scheme.pow b20406da-dd0d-432e-859b-399e994c7aff"? How did you get that GUID?

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


×