PowerShell DSC secedit.exe SecEdit.exe с учетом регистра? - PullRequest
0 голосов
/ 12 декабря 2018

Я - новичок в PowerShell и пытаюсь написать первый сценарий DSC.

Install-Module -Имя 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

Кажется, что secedit.exe на самом деле называется C: \ WINDOWS \ system32 \ SecEdit.exe в моей системе Windows 10.C: \ NTFS.

Есть идеи, как сделать Powershell нечувствительным к регистру при вызове secedit.exe?

1 Ответ

0 голосов
/ 12 декабря 2018

Оказалось, что C: \ Windows \ System32 не был в PATH, как предложил Билл.Я использовал Расширенные настройки системы -> Переменные среды, чтобы задать в PATH значение C: \ Windows \ System32.Затем я перезапустил компьютер, чтобы службы также подхватили изменение, и теперь оно работает.Большое спасибо.

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
...