none
the output not it supposed RRS feed

  • Question

  • PowerShell script

    i am using a script getting email add from O365 the script is like that 

    Get-MsolUser -SearchString$textbox4.Text |selectUserPrincipalName

    the out put is   {UserPrincipalName= md @email  com} why not only the email ???

    i put space between = and the@ and come

    Monday, June 3, 2019 11:25 PM

Answers

All replies

  • Please do not post colorized code.

    Get-MsolUser <userid> | select -expand userprincipalname


    \_(ツ)_/

    Monday, June 3, 2019 11:44 PM
  • what do you mean by userid ???
    Tuesday, June 4, 2019 4:51 AM
  • You can also use a search string.

    \_(ツ)_/

    Tuesday, June 4, 2019 1:42 PM
  • hi I use this
    
    $textbox3.Text = Get-MsolUser -SearchString $textbox4.Text |selectUserPrincipalName
    in the $textbox4.text   i put the full name i mean a part  like "fran le"
    but it give me the result
    @{UserPrincipalName=flefebvre@email.com}
    
    in the $textbox3.Text


    • Edited by Martyboy05 Wednesday, June 5, 2019 1:44 AM
    Tuesday, June 4, 2019 9:26 PM
  • Please stop posting colorized text. Use the code posting tool provided.

    Please use the code as I posted.  YOu must use "Expand".


    \_(ツ)_/

    Tuesday, June 4, 2019 9:39 PM
  • here is the code

    sory bro

    well do you have Something ?

    $buttonEntrerInformation_Click = { (AddEm) $textbox3.Text = Get-MsolUser -SearchString.$textbox4.Text | select userprincipalname $textbox3.Visible = $true $textbox4.Visible = $true $textbox5.Visible = $true $labelEmailToResetPassword.Visible = $true $labelFullName.Visible = $true $labelNewPassword.Visible = $true }


    Wednesday, June 5, 2019 1:29 AM
  • Please try to understand PowerShell.  You need to use the "Expand" parameter.  I made that clear in my first post.  Why is that an issue.  The example is absolutely exact.

    JUST ADD "-EXPAND" TO THE CODE AS I HAVE ILLUSTRATED.


    \_(ツ)_/

    Wednesday, June 5, 2019 1:34 AM
  • Thanks it's working I appreciate
    Wednesday, June 5, 2019 12:08 PM