简体   繁体   English

如何在活动目录中搜索组名?

[英]how to search for a group name within the active directory?

Hi I would like to find out where my AD group called BIDEV is located within my AD, as you can see on the pictures below. 嗨,我想找出我名为ADDEV的广告组位于广告中的位置,如下面的图片所示。

It exists, but where is it? 它存在,但是在哪里?

Also, any example of how I could do this using Powershell? 另外,关于如何使用Powershell进行此操作的任何示例?

在此处输入图片说明

在此处输入图片说明

#------------------------------
# first part search for a user
#------------------------------

Clear-Host 

$SearchFor = "mmartin"

import-module activedirectory 
Write-Host "Searching..." 
$all_users_list=Get-ADUser -filter * -properties SamAccountName,sn,GivenName,mail,EmailAddress,LastLogonDate,Country,DistinguishedName,CanonicalName |  
select-object SamAccountName,sn,GivenName,mail,EmailAddress,LastLogonDate,Country,DistinguishedName,CanonicalName -ErrorAction silentlycontinue 

foreach($u in $all_users_list)
{
    if($u.SamAccountName -like "*$SearchFor*")
    {
    $Output = $u.SamAccountName + " - " + $u.DistinguishedName
    Write-Host $Output 
    }
}

Write-Host "Done" 
#that will work
#just put what you want at the top in "SearchFor"
#mmartin my powershell guru - 16-july-2015


#------------------------------
# second part search for a group
#------------------------------


 Clear-Host 

$SearchFor = "BIDEV"

import-module activedirectory 
Write-Host "Searching..." 
$all_group_list=Get-ADGroup -filter * -properties * |  
select-object * -ErrorAction silentlycontinue 

foreach($u in $all_group_list)
{
    if($u.SamAccountName -like "*$SearchFor*")
    {
    $Output = $u.SamAccountName + " - " + $u.DistinguishedName
    Write-Host $Output 
    }
}

Write-Host "Done" 

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Active Directory获取组名和EmployeeID? - How to get group name and EmployeeID from Active Directory? 如何在 PowerShell 中从 csv 查找 Active Directory 组名称? - How to look for Active Directory group name from csv in PowerShell? 使用 Powershell,如何获取 Active Directory 组成员列表,包括用户和联系人,显示姓名、公司和 email - Using Powershell, how to get a list of Active Directory group members, including users and contacts, showing name, company, and email 如何从SQL Server存储的SID获取Active Directory组名? - How can I obtain an Active Directory Group name from a SQL Server stored SID? Active Directory WMI事件观察器,用于对特定OU中的组进行修改 - Active Directory WMI Event Watcher for a modification on a group within in specific OU 如何在用户的Active Directory中添加分散组? - How to add the distrubtion group in Active Directory for a user? Append 文本到 Active Directory 中通讯组显示名称的开头 - Append text to the beginning of a distribution group display name in Active Directory 添加名称中带有空格的Active Directory组会在PowerShell脚本中给出错误 - Adding Active Directory group with spaces in name gives error in PowerShell script Active Directory 查询包括成员列表的组名部分 - Active Directory query include group name part of members list PowerShell Active Directory 搜索 - PowerShell Active Directory search
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM