mailbox accounts got hidden - Please help
Hi Everyone, We are in crunchy situation here. We are not sure how did it happen, but after running some powershell scripts, around 1000 accounts got hidden. please see below part of code. ## now actually call the functions ## Commented out to speed up running. #get-exbanner #get-tip # # TIP: You can create your own customizations and put them in My Documents\WindowsPowerShell\profile.ps1 # Anything in profile.ps1 will then be run every time you start the shell. # $error.clear() $UserID = Get-Content H:\Scripts\Disable\uid.txt $zzUserID = "zz_" + $UserID $LogFile = Get-Content H:\Scripts\PSTrans\PSLog.txt Set-Mailbox -Identity $UserID -MaxSendSize 0mb -MaxReceiveSize 0mb if($error.count -gt 0){$error | out-file $LogFile} if($error.count = 0) | add-content $LogFile "POWERSHELL CONFIRMS: Max. Send and Recieve size both set to 0mb" $error.clear() Get-Mailbox $UserID | Set-Mailbox -Alias $zzUserID -HiddenFromAddressListsEnabled $true if($error.count -gt 0){$error | out-file $LogFile} if($error.count = 0) | add-content $LogFile "POWERSHELL CONFIRMS: Alias set to $zzUserID and account hidden from GAL" $error.clear() It should disable only 4 accounts which were mentioned in txt file. If we want to enable them, is there any way? Has anyone faced this before? Please help. Thanks in advance.
February 18th, 2011 5:01am

Did it also append "zz_" onto the userID of the accounts that were hidden
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2011 5:18am

yes.
February 18th, 2011 6:14am

If you open up Exchange management console and select recipient configuration and then mailboxes, you should then be able to list all the mailboxes by name. As the affected mailboxes begin with zz_ they should all be grouped together. If you then select all the mailboxes begining with zz_ and then right click and click properties this should then bring up the properties dialogue box. If you click on the General tab and deselect the Hide From Exchange address list box and click apply. It will then ask you if you want to modify the HiddenFromAddressListsEnabled attribute on all the selected mailboxes. Just click OK and the accounts should then appear in the mail box. You can do the same with the storage limits using the Mailbox settings tab and selecting storage quotas JohnM
Free Windows Admin Tool Kit Click here and download it now
February 18th, 2011 8:35am

On Fri, 18 Feb 2011 09:56:13 +0000, MadForMsi wrote: >We are in crunchy situation here. We are not sure how did it happen, but after running some powershell scripts, around 1000 accounts got hidden. please see below part of code. Wow. Best guess? One of the four is a relatively short string of characters that match (using Ambiguous Name Resolution) lots of other longer names. The fact that you say "around 1000" is a pretty good indication that's what happend -- the default "-resultsize" is 1000. :-) If you're unsure of the matches you'll get it's a good idea to use "-resultsize 1". At least that way you'll limit the damage if you supply a non-unique value. Better, use SMTP addresses (which are almost always unique in the AD unless someone's managed to use LDAP and creare duplicates) instead of sAMAccountname or mailNickname values to define the mailboxes you want to deal with. Or use "-Identity" instead of the the default -Anr" to limit the search scope. Oh . . . and ALWAYS check to be sure you don't have an empty value in your input -- using that would be the same as doing a "get-mailbox" with no arguments (which will also get you the default of 1000 results). Long ago, but BTDT. :-( >## now actually call the functions >## Commented out to speed up running. >#get-exbanner >#get-tip > ># ># TIP: You can create your own customizations and put them in My Documents\WindowsPowerShell\profile.ps1 ># Anything in profile.ps1 will then be run every time you start the shell. ># > >$error.clear() >$UserID = Get-Content H:\Scripts\Disable\uid.txt >$zzUserID = "zz_" + $UserID >$LogFile = Get-Content H:\Scripts\PSTrans\PSLog.txt > >Set-Mailbox -Identity $UserID -MaxSendSize 0mb -MaxReceiveSize 0mb >if($error.count -gt 0){$error | out-file $LogFile} >if($error.count = 0) | add-content $LogFile "POWERSHELL CONFIRMS: Max. Send and Recieve size both set to 0mb" >$error.clear() > >Get-Mailbox $UserID | Set-Mailbox -Alias $zzUserID -HiddenFromAddressListsEnabled $true >if($error.count -gt 0){$error | out-file $LogFile} >if($error.count = 0) | add-content $LogFile "POWERSHELL CONFIRMS: Alias set to $zzUserID and account hidden from GAL" >$error.clear() > >It should disable only 4 accounts which were mentioned in txt file. > >If we want to enable them, is there any way? Has anyone faced this before? Please help. There's no guaranty that running the same set of data through the code will return the same results because the order of the result set is undefined. You might get the same result, or you may get a different set of 1000 results. If you've made no other changes to the users you could look for the lastModified date and the "zz_*" aloas value. A lot of the behavior of powershell cmdlets is downright dangerous if you're not feeding them unique values or verifying that what you asked for is really what you got. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
February 18th, 2011 5:53pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics