我正在尝试使用以下代码验证本地用户凭据:
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('machine',$ComputerName)
$status=$DS.ValidateCredentials($UserName, $Password)
我收到以下错误:
Exception calling "ValidateCredentials" with "2" argument(s): "The specified network name is no longer available.
"
At line:1 char:1
+ $ds.ValidateCredentials('User','Password')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : PrincipalOperationException
请帮我解决这个问题。
提前致谢
注意:我没有在所有机器上收到此错误。在87台机器中,我仅在12台机器中出现此错误。
答案 0 :(得分:0)
启动'服务器'服务修复了问题