AntiMalware Status

PowerShell – Get user’s Manager, Department and Title information

Here is another quick helper for Help Desk guys to pull quickly information about user in PowerShell:

  1. SamAccountName
  2. Title
  3. Department
  4. Manager

In this case the manager will be show as FirstName and LastName instead of the Distinguished Name and output is formatted to list output.

1
2
3
4
5
6
7
Clear-Host
Import-Module ActiveDirectory
$user = Read-Host "[ Enter User.Name ]"
Clear-Host
Write-Host [ Manager Report ] -Foregroundcolor white -BackgroundColor red
Get-ADUser -identity $user -Properties * |
Select-Object -Property SamAccountName,Title, Department, @{label='Manager';expression={$_.manager -replace '^CN=|,.*$'}} |format-list

Enjoy!

Leave a Reply