locked
Script to retrieve all users (less sales offices) RRS feed

  • Question

  • I am trying to create a script to retreive all of the users in our domain -Less users in remote sales offices OU, and test accounts.  I am starting with a simple get-maibox command that gives me all users.  Then I am trying to apply a filter for the "Sales Force"  OU (and all sub Sales Force OUs).  Then I am trying to add a variable that if the account has not been logged on to in 30 days to exclude it.  I haven't had any luck making this work can anyone assist?  Thanks in advance for any help.
    Friday, July 29, 2011 9:02 PM

Answers

  • How about this.

    Get-Mailbox | where {$_.DistinguishedName -notlike '*OU=Sales Force,*'}

     


    lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
    • Proposed as answer by Sukh828 Friday, July 29, 2011 9:39 PM
    • Marked as answer by Lasse Pettersson - Sunday, July 31, 2011 9:31 AM
    Friday, July 29, 2011 9:16 PM

All replies

  • How about this.

    Get-Mailbox | where {$_.DistinguishedName -notlike '*OU=Sales Force,*'}

     


    lasse at humandata dot se, http://anewmessagehasarrived.blogspot.com
    • Proposed as answer by Sukh828 Friday, July 29, 2011 9:39 PM
    • Marked as answer by Lasse Pettersson - Sunday, July 31, 2011 9:31 AM
    Friday, July 29, 2011 9:16 PM
  • Outstanding!  Thank You.
    Friday, July 29, 2011 9:25 PM