Reputation: 63
I am a complete newbie to PowerShell and trying to write a first DSC script.
Install-Module -Name SecurityPolicyDsc
However when I run the configuration I get...
VERBOSE: [COMPUTER]: LCM: [ Start Test ] [[AccountPolicy]AccountPolicies]
The term 'secedit.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (secedit.exe:) [], CimException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : localhost
It seems that secedit.exe is actually called C:\WINDOWS\system32\SecEdit.exe on my Windows 10 system. C:\ is NTFS.
Any idea how to make Powershell case insensitive when invoking secedit.exe?
Upvotes: 1
Views: 521
Reputation: 63
It turned out that C:\Windows\System32 was not on PATH as Bill suggested. I used Advanced System Settings -> Environment Variables to set PATH to include C:\Windows\System32. I then restarted the PC so that services also picked up the change and now it works. Many thanks.
PS C:\WINDOWS\system32> Start-DscConfiguration -Path c:\dsc -Wait -Force -Verbose
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespace
Name' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer COMPUTER with user sid S-1-5-21-1762681051-3184050464-2174412407-1001.
VERBOSE: [COMPUTER]: LCM: [ Start Set ]
VERBOSE: [COMPUTER]: LCM: [ Start Resource ] [[AccountPolicy]AccountPolicies]
VERBOSE: [COMPUTER]: LCM: [ Start Test ] [[AccountPolicy]AccountPolicies]
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Enforce_password_history
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: 15 Desired policy: 15
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Maximum_Password_Age
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: 42 Desired policy: 42
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Minimum_Password_Age
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: 1 COMPUTERpolicy: 1
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Minimum_Password_Length
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: COMPUTERDesired policy: 12
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Password_must_meet_complexity_requirements
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: Enabled Desired policy: Enabled
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Testing AccountPolicy: Store_passwords_using_reversible_encryption
VERBOSE: [COMPUTER]: [[AccountPolicy]AccountPolicies] Current policy: Disabled Desired policy: Disabled
VERBOSE: [COMPUTER]: LCM: [ End Test ] [[AccountPolicy]AccountPolicies] in 0.4340 seconds.
VERBOSE: [COMPUTER]: LCM: [ Skip Set ] [[AccountPolicy]AccountPolicies]
VERBOSE: [COMPUTER]: LCM: [ End Resource ] [[AccountPolicy]AccountPolicies]
VERBOSE: [COMPUTER]: LCM: [ End Set ]
VERBOSE: [COMPUTER]: LCM: [ End Set ] in 2.5460 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.791 seconds
Upvotes: 1