"The group name could not be found"
"The group name could not be found"
当我尝试 运行 ([adsi]"WinNT://$env:ComputerName/$Username").SetPassword($Password)
命令时,我遇到了以下错误。
The following exception occurred while retrieving member "SetPassword": "The group name could not be found."
At D:\Install\ScriptsP12.InstallSQL2016.ps1:9 char:1
+ ([adsi]"WinNT://$env:ComputerName/$Username").SetPassword($Password...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMember
我什至试过“”的答案,但没有成功。任何帮助将不胜感激。
谢谢。
如果 Microsoft.PowerShell.LocalAccounts 模块在您的系统上可用,您可以尝试使用以下代码。
$UserAccount = Get-LocalUser -Name $Username
$UserAccount | Set-LocalUser -Password $(ConvertTo-SecureString -String $Password -AsPlainText -Force)
希望对您有所帮助!
当我尝试 运行 ([adsi]"WinNT://$env:ComputerName/$Username").SetPassword($Password)
命令时,我遇到了以下错误。
The following exception occurred while retrieving member "SetPassword": "The group name could not be found." At D:\Install\ScriptsP12.InstallSQL2016.ps1:9 char:1 + ([adsi]"WinNT://$env:ComputerName/$Username").SetPassword($Password... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], ExtendedTypeSystemException + FullyQualifiedErrorId : CatchFromBaseGetMember
我什至试过“
谢谢。
如果 Microsoft.PowerShell.LocalAccounts 模块在您的系统上可用,您可以尝试使用以下代码。
$UserAccount = Get-LocalUser -Name $Username
$UserAccount | Set-LocalUser -Password $(ConvertTo-SecureString -String $Password -AsPlainText -Force)
希望对您有所帮助!