Fetching Data with Get-AzureADUser

Viewing 0 reply threads
  • Author
    • #474300
      Member Points: 1,217
      Rank: 3

      I am trying to add variables to my AzureAD script and running into syntax issue- not sure what I am missing. I came up with a workaround as below. Wonder if there’d be better and unified way.
      <pre class=”lang:ps decode:true”>$usrUPN = [string](Read-Host(‘Can I have the email ID of the user? e.g., me@mymail.edu ‘))
      $usrSearchHash = @{UserPrincipalName = $usrUPN}
      $skUserhash = @{Identity = “SIP:$usrUPN”}
      $filterstr = “userPrincipalName eq ‘”+$usrUPN+”‘”
      $azureUser = Get-AzureADUser -Filter $filterstr | select * #-SearchString “ratan”
      $msolUser = Get-msolUser @usrSearchHash | select * #-SearchString “ratan”
      $skypUser = Get-CsOnlineUser @skUserhash | select *
      I have defined my search arrays to  pick the data I wanted from the 3 variables $azureUser, $msolUser, $skypUser (as below) which work fine and store the data (both all and summary to files). I need help with the search… thanks. Please excuse me for the sketchy post- I am new to the forum and trying to orient myself.
      <pre class=””>$SkypUGet = @(‘DisplayName’,’Title’,’Enabled’,’WhenCreated’,’IsValid’,’VoicePolicy’,’UserPrincipalName’,’SamAccountName’,’LineURI’,’SipAddress’, `
      ‘RegistrarPool’,’OnPremLineURI’,’HostedVoiceMail’,’ServiceInstance’,’LastSyncTimeStamp’,’UserProvisonType’,’lastProvisionTimeStamp’, `

      $skypUser | Out-File -FilePath “$fldrPath\$usrUPN-skypeAll.txt” -Append
      $skypUser | select $SkypUGet | out-file “$fldrPath\$usrUPN-Summary.txt” -Append

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2021


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account