PowerShell DSC secedit.exe SecEdit.exe是否区分大小写?

时间:2018-12-11 23:03:15

标签: powershell dsc

我是PowerShell的新手,正在尝试编写第一个DSC脚本。

安装模块-名称SecurityPolicyDsc

但是,当我运行配置时,我得到...

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

在我的Windows 10系统上,似乎secedit.exe实际上叫做C:\ WINDOWS \ system32 \ SecEdit.exe。 C:\是NTFS。

有什么想法在调用secedit.exe时如何使Powershell不区分大小写?

1 个答案:

答案 0 :(得分:0)

事实证明,比尔建议,C:\ Windows \ System32不在PATH上。我使用高级系统设置->环境变量将PATH设置为包括C:\ Windows \ System32。然后,我重新启动了PC,以便服务也可以进行更改,并且现在可以使用了。非常感谢。

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