Forum Discussion

Jesper Stein's avatar
Jesper Stein
Brass Contributor
Jan 18, 2018
Solved

Find user without mailbox

Hi. Im trying to create a script that loads users from an AD Group and filter them based on an attribute. My goal is to have a script that loads users from a group, finde the ones that do not have a ...
  • AlexanderHolmeset's avatar
    Jan 18, 2018

    I dont have access to AD right now, but i think you could do something like this. ! in front of $user.msExchMailboxGuid means that if the variable is null(empty), it should create a mailbox, if its already have a mailbox, a message stating this is dispalyed. Hope this works, or sett you on the right track.



    $Users = Get-ADGroupMember -Identity "S_Enable_Exch2010User" | Get-ADUser -filter {msExchMailboxGuid -like "*"} foreach ($user in $users) { if(!$user.msExchMailboxGuid) { enable mailbox command } else { $user.firstname+"already have a email account." } }

Resources