-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSFT_xPowerPlan should use power plan guid #59
Comments
I can see that this becomes a problem if the same configuration file is used for different OS languages.
Option 1We could enhance the schema with a Guid parameter that will override the Name parameter. If Guid is set, the power plan will be set using the Guid, and ignore the Name. The name will still need to be set since it is required, but could be set to anything meaningful for the user managing the configuration.
Option 2We could replace the Name parameter with the Guid parameter. We can provide information in the documentation (README.md) how the user finds the GUID. Although, for the user managing the configuration file it will not be obvious what power plan it is configured to use (unless adding a comment). Neither will it be obvious when running Get-DscConfiguration. So in that sense option 1 would be more preferred.
@TravisEz13 Do you have a moment to weigh in on this? |
You may have a look at my resouce, which is doing basically the same thing: I have just resolved the issue with the GUID and also an other issue where the resouce did not work on core and nano server because of the missing "Win32_PowerPlan" WMI class. Maybe we can merge my changes also to the MSFT_xPowerPlan resouce. What do you think? |
If it is to set the active power plan, @J0F3's schema looks good. |
I just want you know that I updated my module again so also the get and test mechanism does use the GUIDs instead of the names. |
@J0F3 Great work! Just found that issue trying some Polish/Danish language machines. |
Hi @J0F3 , @marcinbojko - are either of you working on a fix for this one or is it still outstanding? |
I just hit this error on a Swedish server. So I could give this a shoot to fix this if nobody else is working on it. But I do need help getting the solution we want. I don't think @J0F3's resource is entirely optimal because it does not allow the user to set the power plan to the power plan the user created them self, at least it doesn't look so from the code. Let me know if I'm mistaken. But there is also an option 3. But this would be a breaking change.
|
Can we not just just try and parse the
If that's not seen as "clean", we can add a boolean
Thoughts? |
@iainbrighton - I do like your first pattern there. I even have a function and unit tests for testing if a string is a GUID (from another project I work on): <#
.SYNOPSIS
Checks that a Guid is valid.
.PARAMETER Guid
The Guid to validate.
.OUTPUTS
Returns true if the Guid is valid.
#>
function Test-Guid
{
[CmdletBinding()]
[OutputType([Boolean])]
param
(
[Parameter(Mandatory = $True)]
[String] $Guid
)
$newGuid = [Guid]::Empty
[Guid]::TryParse($Guid, [ref]$newGuid)
} I can try and get to this one at some point as I'm doing lots of work trying to get this repo up to HQRM. But no idea when. |
@johlju is right. My resource does not allow to set a custom power plan. This is mainly because I hade never a need for that. ;-) But it makes absolutely sense that it is possible to set a custom power plan. I also like the first option from the idea of @iainbrighton |
This is the error message for this issue. Caught it on a Spanish Windows Server 2012 R2 server while doing some other work.
Default power plans on the server for reference.
|
Awesome info thanks @johlju - I better get to looking at this one next. It does seem like these GUIDs do align:
|
I finally got some time to look into that again. Just made a PR with changes to accept a name or a Guid as value for the Name parameter. Let me know what you think. 😊 |
That would be great, as I've noticed that's one of not many resources not working properly on 2019. |
Hi @marcinbojko - can you put any info in here about what you're seeing on 2019 so that we can make sure there are some integration tests that will cover/validate the new version that @J0F3 is working on resolves it? I've only just moved my lab over to WS2019 so haven't had a chance to start validating on it (and AppVeyor doesn't provide it). |
Of course. My resource for setting 'high power' is here: https://gist.github.com/marcinbojko/4de797ff36d66e4b7b6c6a6ddef77284 The reponse is:
|
Yea, it is exactly what I also notices on Windows Server 2019 with the PowerPlan resource. Actually it is the same as issue #155. Meaning the 'Activate' method is somehow not there anymore... |
I actually wonder if this is a bug. Might raise it with the Windows Server team to see if it was intentional and what the new method should be for setting this stuff. |
On non-english Windows, power plans names are localized. Using power plan's GUID instead would make it work as they all seem to be the same across all Windows platforms for standard plans.
The text was updated successfully, but these errors were encountered: