header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Find Non Mail Enabled Users
Last Post 17 Jan 2012 01:55 PM by n1ckml007. 13 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
JamesUser is Offline
Basic Member
Basic Member
Posts:398
Avatar

--
05 Jan 2010 05:10 AM
    Hello,

    Is there a command that would allow me to check the whole of AD with some criteria which would allow me to check which users do not have a mail enabled account.

    So I will export it to a CSV file however I just dont know how to find a mail enabled user.

    I would have the criteria based on title which is fine This I can do..

    Get-QADUser -Title "teacher", "staff" | where {mailenableduser =false}| Export-Csv "C:\NonMailEnabledUsers.csv"

    Something like the above but where the mailenableduser=false would be whatever I require.

    I hope someone can assist.

    James
    Vishal RamnaniUser is Offline
    New Member
    New Member
    Posts:68
    Avatar

    --
    05 Jan 2010 06:00 AM
    Hi Again James,

    Mail Enabled users are users without mailbox in local exchange organization and have an external email address where the mails would be forwarded.
    Mailbox Users are users with the mailbox in local exchange organization servers.

    #To get the mail enabled users try below. This will filter only mail enabled users from AD and will not return mailboxes.
    Get-User -reslutsize unlimited | where {$_.RecipientType -like "MailUser" -and ($_.title -like "teacher" -or $_.title -like "staff")} | export-csv c:\mailenabledusers.csv

    #To obtain mailboxe users. This will return only mailboxes.
    Get-User -Resultsize unlimited | where {$_.RecipientType -like "MailboxUser" -and ($_.title -like "teacher" -or $_.title -like "staff")} | export-csv c:\MailBoxUsers.csv

    Get-QADUser can not differentiate btwn Mail enabled user and Mailbox user.

    Output files can be used to pipe into other cmdlets.

    Thanks.

    Vishal Ramnani
    MCITP - Exchange 2007, MCSE Messaging, MCTS - Win 2008 Config
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    05 Jan 2010 06:12 AM
    Hello,

    I have come accross some code I think from this site from a google link...
    #Add-PSSnapin Quest.ActiveRoles.ADManagement $User = Get-QADUser -Title "teacher", "staff" -SizeLimit 0 | Select RecipientType if ($user.RecipientType -ne "userMailbox") | Select-Object FirstName,LastName,SamAccountName,ParentContainer | Export-Csv "C:\NonMailEnabledUsers.csv"

    However its throwing me up the following error:

    Missing statement block after if ( condition ).
    At C:\nonmailenabledteachers.ps1:5 char:44
    + if ($user.RecipientType -ne "userMailbox") | <<<<

    Does anyone know why?

    Many Thanks

    James
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    05 Jan 2010 06:27 AM
    Hello,

    Sorry I thought that was the right terminology! My Mistake I apologise. I am indeed after the mailbox users which have a mailbox on the local exchange.

    I have the following:

    Get-User -ResultSize unlimited | where {$_.RecipientType -notlike "MailboxUser" -and ($_.title -like "teacher" -or $_.title -like "staff")} | Select-Object FirstName,LastName,SamAccountName,ParentContainer | Export-Csv "C:\NonMailBoxUsers.csv"

    Would this give me all the teachers and staff which DO NOT have a mailbox on the local exchange.

    As it seems to be pulling rather alot of users which I find hard to believe.

    Many Thanks

    James
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    05 Jan 2010 06:27 AM
    Oh and sorry I posted after yourself I didnt get the refreshed page!

    James
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    05 Jan 2010 06:50 AM
    See if this helps:

    Get-User -RecipientTypeDetails user -filter {Title -ne "teacher" -AND Title -ne "staff"} | select firstna
    me,lastname,samaccountname,DistinguishedName

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    05 Jan 2010 06:57 AM
    Shay,

    Would that not give me all the accounts which DONT have a title of teacher or staff?

    Many Thanks

    James
    Shay LevyUser is Offline
    PowerShell MVP, Admin
    Veteran Member
    Veteran Member
    Posts:1362
    Avatar

    --
    05 Jan 2010 07:08 AM
    Yes is should, and that do no have a mailbox account. Give it a try and judge by the result :)

    Shay Levy
    Windows PowerShell MVP
    http://PowerShay.com
    PowerShell Community Toolbar
    Twitter: @ShayLevy
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    05 Jan 2010 07:10 AM
    James:

    If you want Staff and Teachers, try this:

    Get-User -RecipientTypeDetails user -filter {Title -eq "teacher" -OR Title -eq "staff"} | select firstname,lastname,samaccountname,DistinguishedName

    Karl
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    JamesUser is Offline
    Basic Member
    Basic Member
    Posts:398
    Avatar

    --
    06 Jan 2010 12:42 AM
    Hello,

    That seems to work fine I have found out why there are so many results! Its becuase we imported loads of users last night but I didnt know!

    They match the schools who have been imported. I will give them accounts and re run my script.

    Many Thanks for your time and assistance

    James
    DomUser is Offline
    New Member
    New Member
    Posts:1
    Avatar

    --
    27 Apr 2010 08:14 PM
    Hey...

    Is there a way to pull from a txt file with get-content... find the users  (listed in the text file) that do not have mailboxes and then pipe that out to a file? The first text file would have a bunch of SAM account names and so would the results text file.

    I'm trying to do this based on what i'm seeing here and it just isn't working.

    Here's an example of what I have been trying to do.
    get-content C:\migration\checkmbx.txt | get-user RecipientTypeDetails user | ft SamAccountName,ServerName| out-file C:\migration\withoutmbx.txt

    RpaxtonUser is Offline
    New Member
    New Member
    Posts:1
    Avatar

    --
    29 Sep 2011 10:14 AM
    I would like to query users in a specific group or OU that are not mail enabled users. I have some students who have an AD account but have not been mail enabled.
    Karl MitschkeUser is Offline
    Basic Member
    Basic Member
    Posts:457
    Avatar

    --
    04 Oct 2011 02:28 PM
    Try this:
     Get-User -OrganizationalUnit "OU=Sales,DC=contoso,DC=com" -Filter {RecipientTypeDetails -eq "user"} |Select-Object SamAccountName |export-csv file.csv


    Karl
    http://unlockpowershell.wordpress.com
    Co-Author, Windows PowerShell 2.0 Bible
    -join("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    n1ckml007User is Offline
    New Member
    New Member
    Posts:28
    Avatar

    --
    17 Jan 2012 01:55 PM
    You can also mix quest with Exchange via a calculated property:

    Get-qaduser -sizelimit 0 | select-object name, displayname, samaccountname, description, notes, department, email, @{name="ExchangeVersion"; expression={ (get-mailbox $_.samaccountname).exchangeVersion}} | export-csv -notype "h:\mailboxes.csv"

    In this case I will instruct the customer to filter their spreadsheet on 'ExchangeVersion' to get the mail-enabled users. I also add a 'where-object' into this script as well.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer