使用 SecureString 设置密码

ror*_*.ap 5 .net security directoryservices active-directory

为什么不System.DirectoryServices.AccountManagement.UserPrincipal.SetPassword()使用 aSystem.Security.SecureString作为新密码?是否有另一种方法来更改使用的密码SecureString

Mvd*_*vdD 4

遗憾的是,并非 .NET 中的所有密码处理 API 都使用SecureString。不知道为什么,因为该SecureString课程早DirectoryServices.AccountManagement.UserPrincipal于几个版本。

您可以使用 PowerShell cmdlet Set-ADAccountPassword,它需要一个SecureString.