Jump to content

Get Details for Users in a File

From wiki.oeser.name
Revision as of 13:50, 17 November 2021 by Udo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Prereqs:

  • TeamsAdmin Rights
  • Connect-MicrosoftTeams has to be done already!!!

Function:

  • Read user from .\users.txt (one user e-mail per line)
  • get fields to be verified
  • write results to .\UserDetails.csv delimited with ";"

Script

$UserNamesList = get-content -path ".\users.txt"
$exportPath = ".\UserDetails.csv"
 
foreach ($name in $UserNamesList){
  get-csonlineuser -identity $name | select DisplayName,WindowsEmailAddress,EnterpriseVoiceEnabled,OnPremLineUri,OnlineVoiceRoutingPolicy,TenantDialPlan | Export-CSV $ExportPath -Append -Delimiter ";" -NoTypeInformation
}