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.

Import-Module ActiveDirectory
$user = Read-Host "[ Enter User.Name ]"
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


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.