none
Dumb powershell question

    Question

  • Hey Guys very simple question. 

    i'm trying to get information form a user using get-mailbox command and i can't seem to get the filter to work...

    here is my simple code

    $mb = get-mailbox | where-object {$_.samaccountname -eq 'my_user'}

    get-casmailbox -filter {Guid -eq $mb.guid}

    if i manually put the GUID word great. i am sure its powershell 2.0 and its limitation with the "." but i tried a whole bunch of combinations and can't get it to work (with select-object and expand, etc....)

    i can use the "where-object" but its much slower... (its in a loop with 600 users... i want to speed things up)

    any help would be appreciated...


    Anthony Cartier-Info

    Thursday, May 10, 2018 1:07 AM

Answers

All replies

  • Have you tried:

    $mb = get-mailbox | where-object {$_.samaccountname -eq 'my_user'}
    $mb | get-casmailbox
    


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!


    Thursday, May 10, 2018 2:06 AM
  • omg... 

    $Get-CasMailbox $mb.guid.guid .

    didnt try that! 

    Anthony Cartier-Info

    • Marked as answer by Anthony A Thursday, May 10, 2018 2:15 AM
    Thursday, May 10, 2018 2:15 AM
  • My way should work too.

    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!

    Thursday, May 10, 2018 2:16 AM