top of page

PowerShell - Get-ADUser

  • Writer: Jon Boyette
    Jon Boyette
  • Oct 12, 2022
  • 1 min read

Get ADUser, OU, Name, Username, and direct Manager, save as whatever name.ps1 suits you, make this 2 lines below, first stops at "second" DistinguishedName call, then the next 4 lines are 1 line.

$ou=Get-ADOrganizationalUnit -Filter * | Select-Object -Property DistinguishedName| Out-GridView -PassThru -Title "Choose the OU where Users Reside" | Select-Object -ExpandProperty DistinguishedName

get-aduser -filter * -searchbase $ou -properties manager |select DistinguishedName,name,samaccountname,@{Name = "Manager";Expression = {%{(Get-AdUser $_.Manager -Properties DisplayName).DisplayName}}}|export-csv c:\temp\ADUser_OU_Name_UserName_Manger.csv -nti


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page