Disable Inbox Rules for Disable Users

I have found that when our helpdesk disables an AD user account (terminated employee) that has an Outlook inbox rule to forward the email to an email address outside the organization, emails sent to the former employee are still forwarded to that outside
email address.  I would like to run a script each day that queries AD for all disabled accounts, removes any forwarding SMTP adresses, then removes all mailbox inbox rules.  I have been trying to use get-aduser against a DC and export the list of
disabled users, this works fine.  I then take that csv, import it and use -foreach-object to set the forwarding smtp address to null.  I would then like to use the same csv file to run the -removeinbox rule command against the list.  I am having
a hard time time combining the commands I need into a PS script that works against both AD and Exchange.
Anyone have some powershell kung fu to assist me?  Thank you!
~Eric

Hi Eric,
According to your description, I understand that you want a script to get a list of disabled AD user, then removes any forwarding SMTP addresses, then removes all mailbox inbox rules.
We can run following command to get a list of disabled AD user in PowerShell:
Get-ADUser -Filter 'Enabled -eq "false"' | select name,userprincipalname
More details about “How Can I Get a List of All the Disabled User Accounts in Active Directory? “, for your reference:
http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/12/how-can-i-get-a-list-of-all-the-disabled-user-accounts-in-active-directory.aspx
Also, run below command to disable forwarding SMTP address and inbox rule:
Get-Mailbox  -Identity xxxx | Set-Mailbox -DeliverToMailboxAndForward $false
Get-InboxRule –Mailbox xxxx | remove-InboxRule
However, we recommend use this disable AD user to disable mailbox.
By the way, this question will related to the script of Exchange server, please contact relevant team so that you can get more professional suggestions. For your convenience:
http://technet.microsoft.com/en-us/scriptcenter/dd742246.aspx
Best Regards,
Allen Wang

Similar Messages

  • How do I disable the ability for a user to setup/use the sync feature?

    I need to disable this feature for all users in a corporate environment, how do I do this? I would like to disable the "Sign in to Sync" on the menu and the tab in the Options window.

    You can look at:
    *CCK2 Wizard: https://addons.mozilla.org/firefox/addon/cck2wizard/
    *http://mike.kaply.com/2014/01/08/can-firefox-do-this/

  • Cannot disable compatibility mode for all users once enabled

    I work for a school district technology department. For a computer lab that is using an old version of adobe Photoshop, we tried turning compatibility mode to windows xp and set it to run as administrator for all users in hopes that it might fix some problems
    with the program. When students log on it now asks them for a password. They do not have local administrator rights to the computers. After going back in and disabling the compatibility settings, the students are still being asked for a password to run the
    program. I have even tried uninstalling and reinstalling photoshop and the computer is still asking for a password to open the program. Is there some way to undo this in a permanent fashion so students are not asked for a pssword?

    Hello Mike Witnauer,
    Please correct me if I have misunderstanding:
    1. The student account can ran the Photoshop without administrator password before you turn compatibility mode to Windows XP.
    2. Then, the students need the password to run the Photoshop no matter if you use compatible setting.
    Please take the following steps and check if this issue still exists.
    1. Enable built-in administrator account
    2. Use the following code
     runas /user:ComputerName\Administrator /savecred "Full path to program's exe file"
    For more information, please take a look at the answer in the following thread.
    How to run a program as an administrator from within a non-elevated command prompt?
    https://social.technet.microsoft.com/Forums/en-US/0339772f-9f9b-4381-b513-73b263e2cf2f/how-to-run-a-program-as-an-administrator-from-within-a-nonelevated-command-prompt?forum=w7itprogeneral
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • Disable right click for all users in a certain group

    I would like to disable the right click function for all users in a particular group, regardless of which computer is the domain they log in to. Is there any way to do this? Thanks.

    1. Create a new group policy and link it to the OU with the users you want to be affected.
    2. Edit the new policy - In the left pane navigate to:
    User Configuration \ Administrative Templates \ Windows Components \ Windows Explorer
    3. Enable the setting Remove Windows Explorer's Default Context Menu.
    Please let me know if you succeeded.
    Regards, Liran.

  • Disable rating service for anonymous user

    Hi,
    I'm trying to set permissions for anonymous users so they couldn't do anything else except displaying the documents in KM I want to disable their access to other services allowed for other users (e.g.. Subscription, Feedback, Discussion, Rating etc.).
    What I made so far: I've set permissions and service permissions to the Folders, created role with added Authentificated Users group and I added this role to property Roles with visibility in System administration/System configuration/Knowledge management/Content management/User interface/Commands/UI commands. This way, I set command permissions for every command I thought the anonymous user could see.
    Almost everything worked fine, i.e. anonymous user has disabled almost every unnecessary option, but he can still see Rating option in the context menu next to the file/folder. I set the permission to Rating UI command, but it didn't work.
    Can anyone suggest what else could be done so the anonymous user won't be able to rate documents?

    Thank you for your answer, but I know this note and I've done everything what's in it.
    I have functional anonymous login and anonymous user can only display documents, search them and RATE them. But I can't figure out how to disable the rating service just for anonymous user, not other users.
    That note won't help me with that.
    Marek

  • How can I disable pdf.js for all users?

    We as a company deal with a lot of PDF files.. Now while we can simply download the PDFs and there not be a problem, we're used to the Adobe Viewer and *not* downloading them.
    I've been told the new pdf.js viewer will not display most of the PDFs we throw at it on a day to day basis.
    Although there is a way to disable pdf.js (about:config), this only seems to change for the local user. We have FF 19 installed on terminal servers, and would like to know if there is a way to disable it for all users?

    hello, can you try it with the method described at [http://kb.mozillazine.org/Locking_preferences]?

  • Disabling TAB key for specific users

    Good day,
    I am new to SAPand the company will start pretty soon using SAP B1 8.8. We are facing the problem of disabling the TAB key function which give access to a complete list of some tables (in the particular case of financials, all G/L accounts) which is considered confidential and should not be available to any employee. Our actual SAP consultant says that the only solution is to make a special chargeable modification to standard SAP. I find it strange that SAP gives such an open an uncontrolled access to such vital information of the company. I am sure some one on this forum will give me a practical, elegant solution built in SAP authorization mecanism.

    Hello,
    Yes we can do it by Addional authorization
    You can do it by Additional Authorization windows using by Form ID.
    and then goto general authorization select Additinal Athorization as (No authorization) for selected user.
    now selected user can not open Buisness partner on any transaction form .
    then Make a Query for selected BP for selected User and set in on that field .
    1>
    First make new Authorization in Additional Authorization Creator window.
    And select Edit button fill 10001 as form ID.
    OK
    2 >
    Goto General Authorization select perticular user and select same Subject which was created in Additional Authorization window setup. and give no authorization for selected user. ok
    3.Make a FMS from OCRD ,but first you should make filter in master for selected user in SAP. so with the help of we can filetr the record on transaction .
    4.After make FMS with then help of UDF set it in where you want .
    Now Your system is ready for your client requirement.
    Please visit this link
    Re: BP according to user
    Thanks
    Manvendra Singh Niranjan

  • How to disable registration screen for all users

    Hi, can someone advice how I can disable the registration screen when user first startup Acrobat? I am using Acrobat 9
    Thanks

    I don't know if you can. Try this.
    Make a copy of the registry.
    Make a new copy of the registry after registering.
    Try to find the difference in the files after comparing registries. Then change the registry for all future installations.

  • How can I disable "Modify Dashboard" for specified USER?

    I want to disable "Modify Dashboard" for users. But I can't find which rights (in Manage privileges) is for this feature.
    SORRY duplicate with Link: disable edit dashboard for groups
    Edited by: Vlada on Sep 26, 2008 10:37 AM

    This is done in the "permissions"of the dashboard. You have to set it for each dashboard if the user some create dashboard rights.
    regards
    John
    http://obiee101.blogspot.com/

  • Disable password reset for developer users

    I want to disable the capability for developers to reset their passwords. Is there anyway to do that?

    Hi Eugene - What do you mean by "reset" ? Do you want to prevent developers from changing their password either from the current value to a new value, from the current value to the same value, or to prevent them from doing either? And why? What about the "Reset Password" feature on the login page? That actually performs what I'd call a reset.
    Scott

  • Disabling cprojects alerts for certain users only

    Hi
    I need that no email alerts are sent to certain roles/people who have authorizations in cprojects. There are numerous alerts sent as email for any change of dates, thresholds etc. I need to disbale any email being sent in this for certain users.
    How can it be done?
    Regards
    Senthil

    Hi Senthil,
    Would you please check the following
    Evaluations -> Business Add-Ins (BAdIs) -> Change Alerts from Severities in cProjects
    related method is CHANGE_ALERTS_OF_PROJECT, which has a change parameter:
    CT_LANGUAGE_OF_RECIPIENT. You can apply your own logic to remove some recipient of the table, so that they do not get the e-mail.
    Never tested, please check it out.
    Kind regards,
    Zhenbo

  • Business Rules for Business Users

    Folks,
    There is a requirement from my clients to use Business rules by Business users, apparently it is difficult to give them jdeveloper and ask to devlop, have you come across such situation? if so what is the best way to handle such scenarios.
    FYI: we're implementing 11g BRE
    TIA
    Srini

    The only way is to use Rules SDK. We had a similar requirement and had to develop a custom GUI with all CRUD operations using Rules SDK.
    The starting points are:
    http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e10663/toc.htm
    http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10227/toc.htm (especially RuleSession)
    or simply starting from the master index (search for Business rules)
    http://download.oracle.com/docs/cd/E12839_01/nav/portal_booklist.htm
    rgds

  • Reapply Rules for existing users

    Hello All IDMers;
    We have a group called Seasonal for which the member access is based on rule that has two fields one is set to true and also based on employee type which is "Seasonal".
    There are other users who are of different emp type BUT with the other field set to true.
    Now what we decided is to put all those who have field set to true into the this group irrespective of their employee type.
    So going forward for new users we can easily implement this because I am going to delete the Emp Type = Seasonal condition from Rule designer.
    But Can you please tell me if there is a easy way jus by using design or admin console to apply this condition to all existing users.
    I hope i didnt confuse you all.
    Regards;
    VSN

    oh.. my bad. I looked mainly the Subject and was thinking about the rules all the time...
    In your case, you can use the following function to add a user to a group. Please check in the Forum, there are lot of sample code for searching a user with a particular attribute value - then if you have the user key and group key, then you can use the below function to
    Map usermap = new HashMap();
    usermap.put("Users.User ID", User_id );
    usermap.put("Users.Status", "Active"); //put only active users in the hashmap
    Map grpmap = new HashMap();
    grpmap.put("Groups.Group Name", Group_Name);
    tcResultSet ts = userClient.findUsers(usermap); //find users - to get the ukey
    tcResultSet tg = groupClient.findGroups(grpmap); //find requireq group
    long ukey = ts.getLongValue("Users.Key");
    long gkey = tg.getLongValue("Groups.Key"); //find group key
    System.out.println("User Map: " + ts);
    System.out.println("User Key: " + ukey);
    System.out.println("Group Key: " + gkey);
    int usrNumRec = ts.getRowCount(); //get number of all user records in OIM
    System.out.println("There are: " + usrNumRec + " user records in OIM Dev");
    //ADD the Member now
    groupClient.addMemberUser(gkey,ukey); //add user back to a group
    System.out.println("GROUP Added");
    Search in google for the OIM functions such as addMemberUser - you will find better code in this forum or somewhere else...
    Regards
    Vijay Chinnasamy

  • Mountain Lion upgrade effects mail rules for all users

    After upgrading to Mountain Lion, the mail rules appear to be "shared" for all user on our Mac. When a user adds a rule, everyone sees this rule.  Some mail rules are lost in the process.  How can we fix this?

    If it is hanging on the 'upgrading database' portion please see this discussion and the solution posted by registerednderd at the bottom of the first page.  It worked for me at least to get past the 'upgrading database' hangup and then to import the old messages.
    https://discussions.apple.com/thread/4137441

  • *** SPAM *** - rule for all users

    hello.
    is it possible to create one rule to all users that move all emails with *** SPAM *** in subject line to specific folder eg SPAM? or push one rule to all users?
    SLES10+GW8
    regards
    Mirek

    On 3/29/2012 9:36 AM, leroyjjr wrote:
    >
    > Michael Bell;2186127 Wrote:
    >> On 3/29/2012 1:16 AM, mmadej wrote:
    >>>
    >>> Thank you,
    >>> I can change only subject, no add X-spam header.
    >>>
    >>> 3. every user create rule - simple and free
    >>>
    >>> regards
    >>> Mirek
    >>>
    >>>
    >> Well you have more talented users than most. ;)
    >
    > Michael,
    > Will that also work for GroupWise2012 on SLES11/OES11 as
    > well?
    >
    > Leroy Joseph
    > Visual Click Software
    > 'eDirectory Management and Reporting | DSRAZOR for eDirectory'
    > (http://www.visualclick.com/content/d...edirectory.htm)
    >
    >
    will WHICH work?
    1. yes, built into admin snapins, and gwia
    2. yes, but you'll need a windows workstation to run vertigo on, because
    it uses a mixture of soap and admin api, the latter only beig
    available on windows
    3. yes, but it depends on user education.

Maybe you are looking for