+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, Hide Disabled accounts from Exchange GAL in Coding and Web Development; Hi, I have made up the following script to do the above. It finds the users i want to perform ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    14,094
    Thank Post
    735
    Thanked 1,396 Times in 1,223 Posts
    Blog Entries
    8
    Rep Power
    368

    Hide Disabled accounts from Exchange GAL

    Hi,

    I have made up the following script to do the above. It finds the users i want to perform the action on but itsnt hiding the users from the GAL.

    Any ideas please?

    Thanks

    Code:
    # Query Options #
    $searchRoot = "school.local/School Users/school/Students" # Where to begin your recursive search - If you use top-level (e.g. "domain.local/") make sure to have a trailing slash, otherwise do not use a slash (e.g. "domain.local/Users")
    $inactiveDays = 80 # Integer for number of days of inactivity (e.q. 90)
    
    ######################
    
    # Add Quest / Exchange Snaps
    Add-PSSnapin Quest.ActiveRoles.ADManagement # Adds Quest "qaduser" commands
    Add-PSSnapin Microsoft.Exchange.Management.Powershell.e2010 # Adds Exchange Shell Commands
    
    # Squelches error
    # $ErrorActionPreference="SilentlyContinue"
    
    $inactiveUsers = get-qaduser -SearchRoot $searchRoot -disabled -NotMemberof "No Auto Disable" -NotLoggedOnFor $inactiveDays -anr "SMTP:*" -ldapfilter "(!(msExchHideFromAddressLists=*))" -sizelimit 0 | select samaccountname
    
    foreach($user in $inactiveUsers){
    set-mailbox $name.samaccountname -HiddenFromAddressListsEnabled $true
    }
    
    # Force update of OAL Generator
    Get-OfflineAddressBook | Update-OfflineAddressBook
    
    # Pause script for 30 seconds
    Start-Sleep -s 30
    
    # Force update of OAB on CAS
    Get-ClientAccessServer | Update-FileDistributionService

  2. IDG Tech News
  3. #2

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    1,933
    Thank Post
    1
    Thanked 301 Times in 291 Posts
    Rep Power
    70
    Has it set the attribute on the mailbox? Is it a case of waiting fir OAB to be update on clinets?

  4. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    14,094
    Thank Post
    735
    Thanked 1,396 Times in 1,223 Posts
    Blog Entries
    8
    Rep Power
    368
    It hasn't set the attribute no.

  5. #4

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    1,933
    Thank Post
    1
    Thanked 301 Times in 291 Posts
    Rep Power
    70
    Quote Originally Posted by FN-GM View Post
    It hasn't set the attribute no.
    Is the samaccountname and alias the same?

  6. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    14,094
    Thank Post
    735
    Thanked 1,396 Times in 1,223 Posts
    Blog Entries
    8
    Rep Power
    368
    I think so, will check in the morning.

SHARE:
+ Post New Thread

Similar Threads

  1. Hide Disbaled Users From GAL Exchange 2010
    By FN-GM in forum Scripts
    Replies: 6
    Last Post: 5th June 2012, 02:13 PM
  2. [EXCHANGE 2007] Hide disabled users from GAL
    By glennda in forum Enterprise Software
    Replies: 6
    Last Post: 27th May 2012, 11:28 AM
  3. Enabling/disabling account from Command line
    By glennda in forum Windows
    Replies: 10
    Last Post: 5th March 2010, 10:33 AM
  4. Hide Staff emails from students with exchange 2003
    By bilbo in forum Network and Classroom Management
    Replies: 19
    Last Post: 8th March 2009, 11:14 AM
  5. Replies: 4
    Last Post: 11th October 2007, 12:50 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •