Jump to content

Get Details for Users in a File: Difference between revisions

From wiki.oeser.name
Udo (talk | contribs)
Created page with "Category: Powershell Script Examples bla"
 
Udo (talk | contribs)
No edit summary
 
Line 1: Line 1:
[[Category: Powershell Script Examples]]
[[Category: Powershell Script Examples]]


bla
==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
}

Latest revision as of 13:50, 17 November 2021


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
}