检索本地管理员组成员 [英] Retrieve Local Admin Group Members
问题描述
我需要一个vbscript来检索(通过回显)本地管理员组成员的用户列表,但会排除以下用户:xyz\Domain Admins,xyz \ User1和xyz \\ \\ user2
I need a vbscript that will retrieve (by echoing) the list of users that are member of the local administrators group but will exclude the following users: xyz\Domain Admins, xyz\User1, and xyz\User2
例如,如果计算机的本地管理员组包含以下内容:xyz\Test1,xyz\Domain Admins,xyz\Test2和xyz\User2。它只显示xyz\Test1和xyz\Test2
For example if the local admin group of the machine contains the following: xyz\Test1, xyz\Domain Admins, xyz\Test2, and xyz\User2. It will only display xyz\Test1 and xyz\Test2
推荐答案
嗨Ethan,
Hi Ethan,
您计划运行此服务器的客户端是什么。
What is the client on which you are planning to run this.
下面的脚本可以让您解压缩用户。
Below scripts should let you extract the users.
更复杂的东西,包括你感兴趣。
Something more complex, incase you are interested.
现在关于你的条件,它会排除一些用户。
Now regarding your condition that it will exclude some users.
在for语句之间添加一个switch case显示输出。希望您知道如何为被排除的用户找到DN。
Add a switch case between the for statement which displayes the output. Hope you know how to find the DN for the excluded users.
For Each item In oLocalGroup.Members
Select Case item.ADsPath
Case "CN=User1,CN=users,DC=xyz,DC=com"
'do nothing
Case "CN=User2,CN=users,DC=xyz,DC=com"
'do nothing
Case Else
Wscript.Echo strComputer.CN & " " & item.ADsPath
End Select
Next
这篇关于检索本地管理员组成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!