Skip to content

AccountPolicy Fails with "The parameter is incorrect." & "Incorrect function." #121

Description

@begna112

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:

secedit arguments: /configure /db C:\Windows\TEMP\DscSecedit.sdb /cfg C:\Windows\TEMP\accountPolicyToAdd.inf
Testing AccountPolicy: Minimum_Password_Length
Current policy: 8 Desired policy: 0
An error occurred running method 'Set' in resource 'AccountPolicy' for resourceID '[AccountPolicy]SetPasswordPolicies': System.Management.Automation.RuntimeException: Failed to update Account Policy Minimum_Password_Length,Enforce_password_history,Maximum_Password_Age,Password_must_meet_complexity_requirements. Refer to %windir%\security\logs\scesrv.log for details.

scesrv.log includes:

----Configure Security Policy...
Error 87: The parameter is incorrect.
 	Error configuring password information.
Error 1: Incorrect function.
	System Access configuration was completed with one or more errors.

	Configuration of Registry Values was completed successfully.

	Audit/Log configuration was completed successfully.

Secedit-OutPut.txt:

Completed 1 percent (0/63) 	Process Privilege Rights area        
Completed 25 percent (15/63) 	Process Privilege Rights area        
Completed 25 percent (15/63) 	Process Group Membership area        
Completed 49 percent (30/63) 	Process Group Membership area        
Completed 49 percent (30/63) 	Process Registry Keys area        
Completed 49 percent (30/63) 	Process File Security area        
Completed 49 percent (30/63) 	Process Services area        
Completed 65 percent (40/63) 	Process Services area        
Completed 73 percent (45/63) 	Process Services area        
Completed 73 percent (45/63) 	Process Security Policy area        
Completed 77 percent (48/63) 	Process Security Policy area        
Completed 84 percent (52/63) 	Process Security Policy area        
Completed 88 percent (55/63) 	Process Security Policy area        
Completed 93 percent (58/63) 	Process Security Policy area        
Completed 100 percent (63/63) 	Process Security Policy area        
                                                                           
The parameter is incorrect.


The task has completed with an error.
See log %windir%\security\logs\scesrv.log for detail info.

This is the accountPolicyToAdd.inf that it generates:

[Unicode]
Unicode=yes
[System Access]
MinimumPasswordLength=0
PasswordHistorySize=0
MaximumPasswordAge=0
PasswordComplexity=0
[Version]
signature="$CHICAGO$"
Revision=1

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:

AccountPolicy SetPasswordPolicies {
    Name      = "PasswordPolicies"
    Enforce_password_history = 0
    Maximum_Password_Age     = 0
    Minimum_Password_Age     = 0
    Minimum_Password_Length  = 0
    Password_must_meet_complexity_requirements  = "Disabled"
    Store_passwords_using_reversible_encryption = 'Disabled'
}

The operating system the target node is running

OsName               : Microsoft Windows Server 2016 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsBuildLabEx    : 14393.2273.amd64fre.rs1_release_1.180427-1811
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value
----                           -----
PSVersion                      5.1.14393.2273
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.2273
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

2.8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions