+ 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
    16,376
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468

    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. #2

    Join Date
    Dec 2008
    Location
    Essex
    Posts
    2,144
    Thank Post
    1
    Thanked 326 Times in 316 Posts
    Rep Power
    78
    Has it set the attribute on the mailbox? Is it a case of waiting fir OAB to be update on clinets?

  3. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,376
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468
    It hasn't set the attribute no.

  4. #4

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

  5. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,376
    Thank Post
    906
    Thanked 1,811 Times in 1,559 Posts
    Blog Entries
    12
    Rep Power
    468
    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, 03:13 PM
  2. [EXCHANGE 2007] Hide disabled users from GAL
    By glennda in forum Enterprise Software
    Replies: 6
    Last Post: 27th May 2012, 12:28 PM
  3. Enabling/disabling account from Command line
    By glennda in forum Windows
    Replies: 10
    Last Post: 5th March 2010, 11: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, 12:14 PM
  5. Replies: 4
    Last Post: 11th October 2007, 01: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
  •