-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
AccountPolicy Fails with "The parameter is incorrect." & "Incorrect function." #121
Comments
I was able to verify that running the following as a local administrator gives the same error: $Args = "/configure /db C:\Windows\TEMP\secedit\DscSecedit.sdb /cfg C:\Windows\TEMP\secedit\accountPolicyToAdd.inf"
Invoke-Expression -Command "secedit $Args" Is it possible that the sdb is malformed? |
I think I've discovered the core of this issue. I set the setting how I want them in local group policy and then used mmc + the Security Configuration and Teemplate snap-in to export my current settings. What it exported was this:
Note that When I manually edit the accountPolicyToAdd.inf to change that value from Looking at the documentation, it seems to imply that expected values are 0-999, but it also says -1 is equivalent to 0. https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/hh994573(v%3dws.10) However, this seems to not actually be the case and secedit requires the -1, not 0, at least in Server 2016. Unfortunately, this dsc resource does not support a value of -1 for the field:
In this project's code, the issue is created by these lines: [Parameter()]
[ValidateRange(0, 999)]
[System.UInt32]
$Maximum_Password_Age, At the very least this validate range need to be set to -1 through 999 and the type changed to System.Int32 or a translation built in somewhere to change a value of 0 to -1. |
Tried making the change myself but I think it's just a bit over my head and requires more changes than just the lines I pointed out above. I changed
I additionally tried changing the MSFT_AccountPolicy.schema.mof to account for the type change:
|
@begna112 thanks for reporting the issue and the detailed repro! I'll do my best to look into a solution as soon as work allows it. |
I have the same issue when applying the setting 'Store_passwords_using_reversible_encryption'. Receiving the following error message: |
to fix that, not only you'd have to change the psm1 as @begna112 did, you'd also need to change the MOF Schema here: https://github.com/dsccommunity/SecurityPolicyDsc/blob/dev/DSCResources/MSFT_AccountPolicy/MSFT_AccountPolicy.schema.mof#L8 You can't use -1 for an unsigned 32bit Integer. |
The issue described here was fixed in 2.9.0.0. @rdtechie if you're still having your issue, you might want to open another issue. Closing this issue. |
Details of the scenario you tried and the problem that is occurring
I'm having an issue that may or may not be the same as #119. In my case, the mof is being applied by the LocalSystem user on Windows 2016. I've tried using the
PsDscRunAsCredential
parameter but this resource doesn't seem to support it.Verbose logs showing the problem
Here's some relevant logs:
scesrv.log includes:
Secedit-OutPut.txt:
This is the accountPolicyToAdd.inf that it generates:
Suggested solution to the issue
If the issue is that it's being run by LocalSystem, please support running with PsDscRunAsCredential. I can't really test this as I'm applying it with a service.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
My configuration:
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
2.8.0.0
The text was updated successfully, but these errors were encountered: