【问题标题】:Local User Credential Check in windows 2012 serverWindows 2012 服务器中的本地用户凭据检查
【发布时间】:2017-05-12 16:02:27
【问题描述】:

我正在尝试使用以下代码验证本地用户凭据:

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 台机器中就遇到了这个错误。

【问题讨论】:

  • 在 12 台计算机上,它无法正常工作,您能否 ping 通$ComputerName 提供的名称?
  • 是的,服务器正在 ping。这些命令在服务器本身内执行
  • 嗨。我之前试过。它没有帮助。该代码给出了与上述相同的错误

标签: powershell powershell-3.0 credentials windows-server-2012-r2 powershell-4.0


【解决方案1】:

启动“服务器”服务解决了问题

【讨论】:

    猜你喜欢
    • 2012-11-13
    • 1970-01-01
    • 2011-11-28
    • 2023-01-31
    • 2013-11-24
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2021-02-06
    相关资源
    最近更新 更多