检索本地管理员组成员 [英] Retrieve Local Admin Group Members

查看:92
本文介绍了检索本地管理员组成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个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.

如何列出属于本地$ b的域组的成员$ b管理员组?

现在关于你的条件,它会排除一些用户。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆