Find FrowardTo Outlook Rules via Powershell

Hello everyone!
We have Exchange 2010 organization and about 10000 user's mailboxes. Some of users have outlook rules, that forward to external addresses. There is a list of allowed domains in txt file. Now i need find all rules that forward to external addresses and not
in list of allowed domain. Please help me!!!
I can find all forward to external addresses rules, but how can i find only that not in allowed list?
get-mailbox -resultsize unlimited | get-inboxrule -ErrorAction:SilentlyContinue | ? {$_.ForwardTo -ne $null -and $_.ForwardTo -notmatch "EX:/"}

I hope this may be helpful for you 
http://serverfault.com/questions/283098/find-users-that-are-auto-forwarding-redirecting-their-email-in-exchange-2010-u
foreach ($i in (Get-Mailbox -ResultSize unlimited)) { Get-InboxRule -Mailbox $i.DistinguishedName | where {$_.RedirectTo -or $_.ForwardTo -and -not ($_.description -match "If the message") } | fl MailboxOwnerId,Description >> rules.txt }
Regards, Sourabh Kumar Jha | Please mark it as an answer if it solves your problem or vote as helpful if you like it. |

Similar Messages

  • Outlook Delegate via Powershell (Exchange Online)

    I'm trying to set a delegate for a mailbox via powershell in Exchange Online (Office 365), but the delegated user does not receive the "Meeting Accepted" messages. I've tested it with my account, and I don't get the meeting accept
    messages.
    I've read that the ResourceDelegates parameter for Get-CalendarProcessing is only for resource mailboxes, yet when I set the delegate as Editor on the Calendar and give
    them GrantSendonBehalfTo, it updates the ResourceDelegates to that user. 
    All of that aside, the fact that I got this to work before but I can't now is driving me absolutely insane. I know that you can set the delegate within Outlook, and then set it to forward the meeting messages to the delegate, but I can't seem to get it to work
    via powershell. Help?

    Hi,
    As Ed suggested, actually, we have a dedicated support team regarding the Microsoft Office 365. I recommend you ask your question on our Office 365 forum which is staffed by more experts specializing in this kind of problems. Thanks for your understanding.
    If you have any problem with Exchange server, welcome to our Exchange server forum.
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Multiple "FromAddressContainsWords" Conditions in One Rule via PowerShell?

    My organization recently moved to Exchange Online and I am looking at trying to convert the old mail rules from our old system (Sieve rules from Zimbra) to something that will work in Exchange Online.  My plan is to massage the Sieve output into New-InboxRule
    statements.  The massaging part is the easy part.  What I'm having difficult with is using PowerShell to recreate a rule that should have multiple -FromAddressContainsWords parameters.  Here's what I started off with:
    New-InboxRule -Name "Annoyances" -FromAddressContainsWords roxioemail.com -FromAddressContainsWords "Covalent Technologies" -FromAddressContainsWords process.con -FromAddressContainsWords [email protected] -DeleteMessage $true -StopProcessingRules -Mailbox George.Lenzer
    This didn't work as the -FromAddressContainsWords option can only be used once.  The error also suggested trying to do an array if the parameter would accept one.  I don't know, because that isn't documented anywhere.  The only thing mentioned
    in the help is that it will take a "MultivaluedProperty" which I assume means some sort of string or array that has multiple values in it.
    I then tried this:
    New-InboxRule -Name "Junk Mail" -FromAddressContainsWords {roxioemail.com; Covalent Technologies; process.com; [email protected]} -DeleteMessage $true -StopProcessingRules $true -Mailbox George.Lenzer
    While this worked, when I went into OWA to look at the rule and check the list of words, instead of each word on it's own line, had a single entry containing everything between { and }.  This doesn't look right, and I don't expect it would do what I
    want.  So how does one go about creating an Inbox rule from PowerShell that needs to check multiple conditions, some of the identical type?  It can be done from the GUI, so there must be a way to do it from PowerShell.  Any suggestions?

    Hi George.  Thanks for posting in the forums.  Looking at both of your code snippets, I can see where the problem is.  MultivaluedProperties in PowerShell are exactly as you describe: a set of properties presented as a single argument to a
    parameter.  The mistake you made was attempting to use the semicolon to separate the items in your multivalued property and then trying to present them as a single string.  This is why you get the whole blob of text between the squiggly braces.
    Before I give you the solution, let me say that what you want is to pass an array to -FromAddressContainsWords.  In PowerShell. the comma along with multiple quoted strings is what defines an array.  See here for a better explanation than I can
    give:
     http://theessentialexchange.com/blogs/michael/archive/2008/02/08/Multivalued-Parameters-.aspx
    With that said, here's the solution to your issue:
    New-InboxRule -Name "Junk Mail" -FromAddressContainsWords ("roxioemail.com", "Covalent Technologies", "process.com", "[email protected]") -DeleteMessage $true -StopProcessingRules
    $true -Mailbox George.Lenzer
    Hope this helps!

  • Creating Crawler impact rule through Powershell

    Hi All,
    I want to create a "Crawler Impact rule" for one web application, I found below script but its not working or it may be not the full script. As i am new in Powershell script writing, please help me writing the full PS script or please suggest any
    other script which can create a "Crawler Impact Rule".  Thank Yoyu
    New-SPEnterpriseSearchSiteHitRule -Name $DefaultWebApplicationName -Behavior 'SimultaneousRequests' -HitRate 64

    Hi Aditya,
    According to your description, my understanding is that you want to create a crawler impact rule via PowerShell.
    For the New-SPEnterpriseSearchSiteHitRule, there is not the Name parameter. So, please make sure the cmdlet is correct.
    More information about the New-SPEnterpriseSearchSiteHitRule, you can refer to the link:
    http://technet.microsoft.com/en-us/library/ff608048(v=office.14).aspx
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Adding a shared mailbox to a user's Outlook profile, who has reviewer rights only, via PowerShell

    Hello Everyone,
    I'm working on trying to create something like a knowledge base for my company, and what I'm trying to accomplish is to create a shared mailbox on 365, add users to have read-only rights to the Inbox (which I can achieve via PowerShell) so they can't delete
    the articles, but it seems that by just adding Reviewer permission to a user, it doesn't force the mailbox to open on the end-user's Outlook profile - it only seems to automatically populate if I go through the exchange admin console and allow Full Access
    through User Delegation. 
    Is there a way, via PowerShell, to open a shared mailbox in a user's Outlook profile?
    Thanks for all the help!

    Hi,
    We can create a PRF file that modifies the existing Outlook profile to add the shared mailbox.
    Please have a look at this thread which discussed a similar issue:
    http://social.technet.microsoft.com/Forums/systemcenter/en-US/374e5a31-1732-45b8-afdd-7c0987e04a7e/how-to-add-additional-mailboxes-in-outlook-for-exchange
    For more information about Customize Outlook profiles by using an Outlook Profile (PRF) file, see:
    http://technet.microsoft.com/en-us/library/cc179062(v=office.14).aspx
    Hope this helps.
    Regards,
    Steve Fan
    TechNet Community Support

  • Can you add delegate access to a user's calendar or mailbox folder via powershell?

    Basically I want to know if you can grant a user delegate access to another user's calendar or meeting room using native  powershell commands?
    I know you can do this via method 1, listed below, however when you grant permissions in this way and if a user wants to see who has delegate access to their calendar or inbox by going to delegate access in outlook they will not see user's who have access
    to their calendar or inbox.
    Method 1:
    Add-MailboxFolderPermission -Identity "userA:\Calendar" -User UserB -AccessRights editor
    The above is a nice and simple way of granting userB EDITOR access to UserA's calendar.
    But as stated above as you are using mailboxFolderPermissions and not DelegateAccess, this applies directly to this folder and if userA goes to their delegate access view in Outlook, they will not see that userB has access to their calendar.
    I know that you can use the below commands to see a list of user's who have delegate access to you calendar:
    Get-Mailbox userA | Get-CalendarProcessing | select resourcedelegates
    I am new to powershell and don't know if there is a way of setting delegate access to a user's calendar or inbox/folder via powershell commands, similar to the above.
    Any help with this query would be much appreciated!
    thanks

    Delegate access is simply a combination of folder rights (which you've described) and Send As right, which is conferred by Add-MailboxPermission or Send On Behalf of right, which I'm not sure if you can confer with PowerShell. Set-CalendarProesssing applies
    to resource mailboxes like conference rooms, not to user mailboxes.
    Update: "Send on Behalf of" is conferred this way:
    Set-Mailbox UserMailbox -GrantSendOnBehalfTo UserWhoSends
    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."

  • How to Add Multiple Driver Packages Using Reference File via PowerShell

    Hey All - 
    I've got a task I'm working on which would be much easier via PowerShell.  I tried figuring it out, but couldn't so thought I'd post.
    The Task
    I need to create about 50 new, empty driver packages (most are in the same folder in the console) and am trying to find a method of doing so where I may use a source text file / csv file as reference in the command line.  Each package has a unique name
    and source path.  Here are examples:
    - Latitude E5440 Win7 x86 [A01]   \\server\drivers\5440x86
    - Latitude E5440 Win7 x64 [A01]   \\server\drivers\5440x64
    The Structure
    All of the ones I want to add via PowerShell will go into the same folder in the console.  They will be in the folder "root\New Drivers\Dell CAB Drivers" 
    Any ideas or will this just take more time than it's worth for 50?  Thanks!
    Ben K.

    Also, the creation of the driver package won't be your biggest challenge, as it's as simple as New-CMDriverPackage (see:
    http://technet.microsoft.com/en-us/library/jj821724(v=sc.20).aspx).
    The biggest challenge is relating your models to a share name (unless they're all Latitude).
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • Since installing Microsoft two step verification for my Outlook account via my PC I can no longer send emails on this account on my iPad. How can I rectify this?

    Since installing Microsoft two step verification on my Outlook Account via my PC (Acer) I am unable to send emails on my iPad. I can neither remove two step verification or find a way to solve this. I would prefer to keep this email account as my prime one.

    You will probably need to create an app password for the Outlook account for use on the iPad...
    http://windows.microsoft.com/en-us/windows/two-step-verification-faq
    http://windows.microsoft.com/en-us/windows/app-passwords-two-step-verification

  • How to determine the database mirroring role via Powershell?

    Is there a way to determine the current mirroring role of a database via Powershell without the use of t-sql?
    With the Microsoft.SqlServer.Management.Smo namespace and database class I can determine the status, witness and partner of the mirrored database, but I can't determine the mirroring role of the current database. I basically want to get the same result
    as the following t-sql query in powershell without using t-sql:
    SELECT m.mirroring_role_desc 
    FROM   sys.database_mirroring m JOIN sys.databases d
    ON     m.database_id = d.database_id
    WHERE  d.name = 'databasename'
    I find it very strange that there is no class property to check for this, while it is an important property of the database. Of course I can use the output of this query in my powershell script for further processing, but I still hope that there is a property
    where I can get this information.
    TheSultan8

    Just to let you know, I've already found it. Here is a part of the code that I use for checking each mirrored database what mirroring role it has:
    $sqlconnection="MYLAPTOP\SQL2008R2"
    $smo = New-Object ('Microsoft.SqlServer.Management.Smo.Server') $sqlconnection
    $mirroreddbs=$smo.Databases | where {$_.IsMirroringEnabled -eq "True"}
    $sqlversionmajor=$smo.VersionMajor
    foreach ($database in $mirroreddbs)
    # Versions lower than SQL 2008 can't query a database in recovery mode
    if ($sqlversionmajor -ge 10) 
    $dbrolevalue=$database.DatabaseOptions.Properties | where {$_.Name -eq "MirroringRole"}
    $dbrole=$dbrolevalue.Value
    One catch though, this only works on SQL 2008 and higher version.
    TheSultan8

  • Removing rights to a mailbox via powershell issues

    I am trying to remove 2 rights to a mailbox via powershell.  the command I am running doesn't seem to work though.
    There are 2 service accounts that seem to have a deny setting on the mailbox; as shown in the screenshot.  user column is in
    Domain\User format.
    I am trying to remove these because I believe it is causing an integration issue between Cisco Unified messaging and outlook. (New voicemails do not show up in the inbox for this one user, even though tests from Cisco UM are ok.)
    Running this command doesn't seem to remove the entries I need:
    remove-MailboxPermission -Identity <USER ALIAS> -User
    <SERVICE ACCOUNT> -AccessRights FullAccess -InheritanceType all

    Hi BriGy,
    Base on my search, if you want to remove these service account permission, you need to remove from organizational level, not mailbox level.
    Please refer to the following thread, it may give you some hints:
    Deny permissions for Domain Admins on mailboxes
    Best regards,
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Niko Cheng
    TechNet Community Support

  • How to Create Windows Firewall Predefined rules using Powershell

    Windows Firewall Predefined rules using Powershell
    Following commands are working some time however sometimes it's giving errors. Any help would be appreciated
    WORKING ==> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True 
    Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Inbound
    NOT WORKING
    PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
    Set-NetFirewallRule : One of the port keywords is invalid.
    At line:1 char:1
    + Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
       t-NetFirewallRule], CimException
        + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
    PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
    Set-NetFirewallRule : One of the port keywords is invalid.
    At line:1 char:1
    + Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
       t-NetFirewallRule], CimException
        + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
    Anoop C Nair (My Blog www.AnoopCNair.com)
    - Twitter @anoopmannur -
    FaceBook Forum For SCCM

    The command:
    Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound
    produces the output:
    Name : FPS-NB_Session-In-TCP
    DisplayName : File and Printer Sharing (NB-Session-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Session-Out-TCP
    DisplayName : File and Printer Sharing (NB-Session-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-SMB-In-TCP
    DisplayName : File and Printer Sharing (SMB-In)
    Description : Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-SMB-Out-TCP
    DisplayName : File and Printer Sharing (SMB-Out)
    Description : Outbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Name-In-UDP
    DisplayName : File and Printer Sharing (NB-Name-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Name-Out-UDP
    DisplayName : File and Printer Sharing (NB-Name-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Datagram-In-UDP
    DisplayName : File and Printer Sharing (NB-Datagram-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Datagram-Out-UDP
    DisplayName : File and Printer Sharing (NB-Datagram-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP4-ERQ-In
    DisplayName : File and Printer Sharing (Echo Request - ICMPv4-In)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP4-ERQ-Out
    DisplayName : File and Printer Sharing (Echo Request - ICMPv4-Out)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP6-ERQ-In
    DisplayName : File and Printer Sharing (Echo Request - ICMPv6-In)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP6-ERQ-Out
    DisplayName : File and Printer Sharing (Echo Request - ICMPv6-Out)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-LLMNR-In-UDP
    DisplayName : File and Printer Sharing (LLMNR-UDP-In)
    Description : Inbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-LLMNR-Out-UDP
    DisplayName : File and Printer Sharing (LLMNR-UDP-Out)
    Description : Outbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    The command:
    (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound).DisplayName
    shows the display names of the 14 outbound rules in the FPS group:
    File and Printer Sharing (NB-Session-In)
    File and Printer Sharing (NB-Session-Out)
    File and Printer Sharing (SMB-In)
    File and Printer Sharing (SMB-Out)
    File and Printer Sharing (NB-Name-In)
    File and Printer Sharing (NB-Name-Out)
    File and Printer Sharing (NB-Datagram-In)
    File and Printer Sharing (NB-Datagram-Out)
    File and Printer Sharing (Echo Request - ICMPv4-In)
    File and Printer Sharing (Echo Request - ICMPv4-Out)
    File and Printer Sharing (Echo Request - ICMPv6-In)
    File and Printer Sharing (Echo Request - ICMPv6-Out)
    File and Printer Sharing (LLMNR-UDP-In)
    File and Printer Sharing (LLMNR-UDP-Out)
    If your output is different than this, it means rules have been removed (or added) to the File and Print Sharing group.
    For example, if you run the command:
    New-NetFirewallRule -DisplayName "My test rule 2" -group "File and Printer Sharing" -Enabled True -Protocol tcp -LocalPort 12346 -Direction Inbound
    This adds a new inbound firewall rule to the FPS group. Output looks like:
    Name : {06449724-944b-4048-834f-8870b9dce4f6}
    DisplayName : My test rule 2
    Description :
    DisplayGroup : File and Printer Sharing
    Group : File and Printer Sharing
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Inbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    This test rule is of course useless because there's no listener on TCP port 12346 on this particular machine..
    The new rule can also be viewed in Windows Firewall with Advanced Security:
    Now if you run the command:
    (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound).DisplayName
    the output will look like:
    File and Printer Sharing (Spooler Service - RPC)
    File and Printer Sharing (Spooler Service - RPC-EPMAP)
    My test rule 2
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)

  • Remove various accepted domains (exchange 2007) from a list file via powershell

    hello!
    i'm a newbie with powershell and i'm trying to find if is it possible to remove a lot of exchange 2007 accepted domains from a csv file using powershell.
    I want to delete accepted domains contained in a csv, it has only domains name and powershell requires the name , that is different from the domain.
    example of accepted domain in my organization:
    Name                           DomainName                DomainType            Default
    Domain0001        
    domain1.com     Authoritative         False 
    Domain0002 hello1.com
    Authoritative False
    I've only a csv with domains name:
    domain.csv:
    Domain
    domain1.com
    hello1.com
    Deleting an accepted domain via powershell requires the name so I need to extract first the name of , i've tried with this command and it works:
    Get-AcceptedDomain | Where{$_.DomainName -eq 'domain1.com'}
    This works only for 1 domain, I've a lot of domains to delete so it's inviable
    Now, i'm trying to launch this command without success:
    import-csv domain.csv | foreach {Get-AcceptedDomain | Where{$_.DomainName -eq '$_.Domain'}}
    Probably there is a syntax error, or maybe I just can't do it. 
    Any help? 
    Many thanks in advance!!

    Don't know what to tell you, then.  If I create a test file with that data, the Import-CSV works for me:
    Domain
    3414257440.domain.com
    domain1.domain.com
    '@ | set-content c:\testfiles\domain.csv
    $DomainNames =
    Import-CSV 'c:\testfiles\domain.csv' |
    Select -ExpandProperty Domain
    $DomainNames
    3414257440.domain.com
    domain1.domain.com
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • DPM 2012 - Get unprotected Clients via Powershell

    Hey,
    i want to get all unprotected Clients via Powershell (or SQL). In the DPM 2012 Console over the Management View it's easy to see, but i cannot find a cmdlet, so i want to create a Report about unprotected Clients.
    Thanks in advance! :)  

    Ok. Ensure that where you execute the script you have the AD Powershell Module and use this script:
    Import-Module ActiveDirectory
    $computers = Get-ADComputer -Filter *
    foreach ($computer in $computers){
    $computerName = $computer.DNSHostName
    $object = Get-WmiObject -ComputerName $computerName win32_service -filter "name='DPMRA'"
    if ($object -eq $null){
    Write-Host -ForegroundColor Red "The server $computerName has no DPM agent installed"
    } else {
    Write-Host -ForegroundColor Green "The server $computerName has the DPM agent installed"
    You can improve it with log, etc... Tell me if it works :-)

  • DELETE Windows Agents (agent monitored computers) via Powershell - HOW??

    It's really ridiculous that I have to ask this question, but as the shaft
    has clearly not given the countless scom customers of the world this information in an easy straightforward manner, I will ask the question.
    As bazillions of you have discovered through days of endless googling, there is NO easy way to simply delete windows agents (AGENT MANAGED COMPUTERS) from the scom console via powershell by using something as crazy and far out there as a ............cmdlet
    I could RING the necks of the shaft personnel who have not supplied the countless scom customers with this simple AND VERY NEEDED functionality - this is ground zero functionality, NOWHERE TO BE FOUND.  I did find old 2007 scripts, and scripts that
    just don't work, or poorly documented methods, etc.   
    So I wanted to ask if anyone out there has a straightforward, WORKING solution to do the following:
    completely DELETE windows agents (AGENT MANAGED COMPUTERS) from the scom console using
    powershell AND  a provided text list file of servers   (I.E.  C:\TEMP\serverlist.txt  )
    On behalf of the entire world, thanks in advance.

    There is no need to install anything, these commands will work on any server that has SCOM installed.
    This is a powershell script.
    If you need to use this to read from a text file  with one server per line (let's say C:\temp\agentlist.txt ), what you could do is copy this into a .ps1 file :
    function global:Delete-SCOMAgent([System.String[]] $agentNames)
    $administration = (get-scommanagementgroup).getadministration()
    $agentManagedComputerType = [Microsoft.EnterpriseManagement.Administration.AgentManagedComputer]
    $genericListType = [System.Collections.Generic.List``1]
    $genericList = $genericListType.MakeGenericType($agentManagedComputerType)
    $agentlist = new-object $genericList.FullName
    foreach ($agentName in $agentNames)
    $agent = Get-SCOMAgent -dnshostname $agentname*
    $agentlist.add($agent)
    $genericReadOnlyCollectionType = [System.Collections.ObjectModel.ReadOnlyCollection``1]
    $genericReadOnlyCollection = $genericReadOnlyCollectionType.MakeGenericType($agentManagedComputerType)
    $agentReadOnlyCollection = new-object $genericReadOnlyCollection.FullName @(,$agentList)
    $administration.DeleteAgentManagedComputers($agentReadOnlyCollection)
    $agentlist = Get-Content C:\temp\agentlist.txt foreach ($agent in $agentlist) {
    Delete-SCOMAgent $agent }
    and then run this from a powershell prompt with the command ./nameofthescript.ps1

  • Operations Manager 2012 R2 : how to find all my rules, monitors and alerts (all in one custom MP)

    How do I find all the rules, alerts, monitors and whatever in a give custom Management Pack?
    All the bits and pieces I have created I have stored in a MP called "1 - MYDOMAIN CUSTOM"
    Now suppose I want to review all my customisations. How do I do it? I had hoped that it would appear in a scope somewhere...
    CarolChi

    Many thanks
    1) I can't find this: in the Authoring Console I have
    management pack templates, distributed applications, groups, management pack objects
    In Management Pack Objects I have Attributes, Monitors, Rules, ... but no where can I find ALL the customisation I have done.
    2) Where can I find an example of powershell?
    3, 4) Where do I get the override explorer. I was hoping not to have to use other tools.
    5) I read that the Efffective Configuration Tool works with older versions of OpsMgr - is this true?
    6) Again can you help with a link to the MP Viewer Tool?
    CarolChi

Maybe you are looking for