#Check a user that I know exists
[ADSI]::Exists("WinNT://localhost/micah,user") #True
#Check a group that I know exists
[ADSI]::Exists("WinNT://localhost/administrators,group") #True
#Check a group that DOESN'T exist
[ADSI]::Exists("WinNT://localhost/whoops,group") #False
#Check a user that DOESN'T exist (NOT specifying that the obect is a user)
[ADSI]::Exists("WinNT://localhost/test") #False (This works fine)
#Check a user that DOESN'T exist (specifying that the obect IS a user)
[ADSI]::Exists("WinNT://localhost/test,user")
#Throws exception "The user name could not be found"
(转)一个校验用户存在性的powershell命名,在AD的单站点上没有问题。
最新推荐文章于 2024-04-10 20:40:07 发布