Query For Retention Policy On All Folders

I am looking for a way to query for the retention policy assigned to all user folders (per folder/per user). My client allows the user to set the folder retention policy per folder and would like to know how each user has that configured. This is for
a 700 user environment. I know any CSV generated as output could have thousands of rows.
thanks.
 

You will have to use EWS for that. Here's an example (for 2013):
$getRTResp=$exchangeService.GetUserRetentionPolicyTags()
function GetTagName($tagGUID) {
if (!$tagGUID) { return ($getRTResp.RetentionPolicyTags | ? {$_.Type -eq "All"}).DisplayName }
foreach ($tag in $getRTResp.RetentionPolicyTags) {
if ($tag.RetentionId -eq $tagGUID) { return $tag.DisplayName }
$FpageSize =100
$FOffset = 0
$folderView = new-object Microsoft.Exchange.WebServices.Data.FolderView($FpageSize,$FOffset,[Microsoft.Exchange.WebServices.Data.OffsetBasePoint]::Beginning)
$folderView.Traversal = [Microsoft.Exchange.WebServices.Data.FolderTraversal]::Deep
$folderView.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet(
[Microsoft.Exchange.WebServices.Data.BasePropertySet]::IdOnly,
[Microsoft.Exchange.WebServices.Data.FolderSchema]::DisplayName,
[Microsoft.Exchange.WebServices.Data.FolderSchema]::ArchiveTag,
[Microsoft.Exchange.WebServices.Data.FolderSchema]::PolicyTag,
[Microsoft.Exchange.WebServices.Data.FolderSchema]::FolderClass);
$oFindFolders = $exchangeService.FindFolders([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::MsgFolderRoot,$null,$folderView)
foreach ($folder in $oFindFolders.Folders) {
Write-host $folder.DisplayName "has Policy:" $(GetTagName $folder.ArchiveTag.RetentionId)
Obviously, it needs some work, a loop for all 700 users, proper error handling, etc. But hopefully it illustrates the idea. For older versions, its a bit more work to get the Name of the tag, but you can also use Get-RetentionPolicyTag for that.
Code adapted from:
http://blogs.msdn.com/b/akashb/archive/2012/01/12/stamping-retention-policy-tag-on-items-using-ews-managed-api-1-1-from-powershell-exchange-2010-part-2.aspx
http://blogs.msdn.com/b/mvpawardprogram/archive/2013/04/08/5-lesser-known-operations-in-exchange-web-services-on-exchange-2013.aspx

Similar Messages

  • Retention Policy - Archive All folders to archive-maibox (including inbox and send items)

    Hello,
    with exchange 2010 we have a retention policy to archive all mail older than 2 years to the archive-maiblox using the retention policy.
    The policy is having the setting "all other folders", so this isn`t working for the folder "inbox" "send items" etc.
    What can i change to have ALL folders moved to the archive-mailbox?
    Thx

    Hi,
    Did you means that you select "All other folders in the mailbox" as a tag type? Is right?
    If so, it will not work for the default folders (such as Inbox and Send Items..).
    Please refer to the following thread:
    Exchange 2010: Retention Policy Tag
    Type- All other folders in the mailbox
    Thanks.
    Niko Cheng
    TechNet Community Support

  • Script set to auto apply Retention policy to all new mailbox created and run everyday

      Script to set auto apply Retention policy to all new mailbox created and run everyday on Exchange 2007 , 2010 , and 2013.
     Could you please help me with the script will rename the policy name please help me with script..
     Thanks,
     Chandu

    Hi Chandu,
    Have you find the solution finally? Have you tried Pavan's suggestion?
    Sorry for my lacking of code and script. If your requirement still haven't been achieved, I suggest we can ask a question in Exchange Development forum and Script Center for more professional suggestion:
    Microsoft Exchange Development forum
    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads
    Script Center
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Regards,
    Winnie Liang
    TechNet Community Support

  • Apply Retention Policy to All New Mailboxes

    I have created a retention policy tag to “Delete and Allow Recovery” after 14 days of all items in the “Deleted Items” folder.
    I then created a Retention Policy to apply the tag. I see using the EMS I can run a command “Get-Mailbox | Set-Mailbox –RetentionPolicy “Empty Trash” to apply to all existing mailboxes but how do I apply this to all new mailboxes as
    well?
    I see a posting at
    http://www.proexchange.be/blogs/exchange2010/archive/2011/08/31/using-the-scripting-agent-to-automate-some-basic-housekeeping-tasks.aspx
    that describes using the Scripting Agent to automate this processes but it seems overkill for my simple requirement. If I go this route does this need to be applied to each Exchange Server? Is this the only way or is there a simpler way to apply a recipient
    policy to all existing and future mailboxes?
    Pacerfan9

    Hi,
    Any updates on this issue?
    If anything is unclear, please feel free to let us know. 
    Thanks,
    Evan Liu
    TechNet Subscriber Support
    in forum
    If you have any feedback on our support, please contact
    [email protected]  
    Evan Liu
    TechNet Community Support

  • Query for  customer and its all the underlying sites in AR

    Hi Expert,
      Please help me to build a query for a customer and its all the underlying sites .
    Thanks

    Please check this thread:
    Running Total in QLD
    Thanks,
    Gordon

  • Wmi query for group policy deployed software version

    I am trying to query the version of a deployed application within a GPO from active directory using wmi.
    Anyone know if this is possible?
    Thanks.

    I don't think you can query GPO information using WMI, but you can use WMI to read Resultant Set of Policy settings. See
    RSoP WMI Classes for more information.
    Is there any particular reason for using WMI in your case? You can easily retrieve this information using powerShell. The code below will list name and ver of all software install entries of a particular GPO:
    $gpo = get-gpo -Name "My GPO Name"
    $report = [xml] $gpo.GenerateReport([Microsoft.GroupPolicy.ReportType]::Xml)
    $report.gpo.Computer.ExtensionData.Extension | `
    Where-Object{ $_.type.contains( "SoftwareInstall" ) } | `
    foreach-object{
    foreach( $item in $_.ChildNodes )
    "`"{0}`" Ver. {1}.{2}" -F $item.name, $item.MajorVersion, $item.MinorVersion
    Gleb.

  • WQL Query for Last Policy Request

    I'm trying to create a collection based on workstations whose last policy request was more than 30 days ago and I'm having trouble with the query statement.  Any help would be greatly appreciated.

    You can query v_CH_ClientSummary to get last policy request and join
    v_r_system in order to get the comuter name.
    That SQL and cannot be used for building a collection ... 
    Torsten Meringer | http://www.mssccmfaq.de

  • SCCM query for taking report from all clients for a SW installed and its version

    Hi ,  I need to pull a report from all servers in my landscape to identify the servers where 'HP system management homepage' is installed and its version. I have SCCM 2007 R2 and need to run a query/report. Please help me how to do this. 
    I am a beginner in SCCM.
    Thanks in advance.
    Vivek Nambiar

    Hi Vivek,
    Try this SQL query and let us know if it helps. Use your SCCM SQL database or the 'Reports' feature on SCCM to run the same.
    SELECT
    dbo.v_R_System.Name0 as 'Host Name',
    dbo.v_R_System.User_Name0 as 'User Name',
    dbo.v_GS_OPERATING_SYSTEM.Caption0 AS 'Operating System',
    arp.DisplayName0 as 'Product Name',
    arp.Version0 as 'Product Version'
    FROM dbo.v_Add_Remove_Programs AS arp
    INNER JOIN dbo.v_R_System ON arp.ResourceID = dbo.v_R_System.ResourceID
    INNER JOIN dbo.v_GS_OPERATING_SYSTEM ON dbo.v_R_System.ResourceID = dbo.v_GS_OPERATING_SYSTEM.ResourceID
    WHERE arp.DisplayName0 LIKE 'HP system management homepage%' AND
    dbo.v_R_System.Operating_System_Name_and0 LIKE '%server%'
    ORDER BY arp.Version0, dbo.v_R_System.Name0
    ~ Rajeesh M | Blog: ScorpITs | Please remember to 'Mark as Answer' or 'Vote as Helpful' on the post that helps. It helps others reading the thread and
    recognizes useful contributions

  • Why am I getting the pop-up "the iTunes library file cannot be saved.  You do not have enough access privilieges for this operation?"  All folders set to appropriate permissions, tried deleting and reinstalling iTunes, can't get rid of it.

    Why am I getting the above pop up?  How to make it stop?

    Hello deborahjael,
    Thanks for using Apple Support Communities.
    To troubleshoot this error message in iTunes please follow the directions in the link below.
    Trouble adding music to iTunes library or importing audio CD
    http://support.apple.com/kb/ts1387
    Take care,
    Alex H.

  • "Permanently Delete" fail in outlook client after setting up the "Archive and Retention Policy" in Exchange 2010

    In Exchange 2010 server, we have setup a policy under "Default Archive and Retention Policy" as all messages under "Inbox", "Sent Items" and "Deleted Items" will be Permanently Delete after X months.
    However, one of our client found that some of the email messages was still found under his "Deleted Items". All other email messages under her outlook client (2010) were successfully deleted according to the policy.
    Is there any reason for this exception?
    Thank you

    Hi,
    Based on your description, you created retention policy tags for Inbox, Sent Items and Deleted Items folders. Then you linked them to the default archive and retention policy
    Default Archive and Retention Policy.
    Please check if this issue affects all users.
    Please create a different retention policy which is associated with these retention tags, and apply this policy to a test user to check result.
    Best regards,
    Belinda Ma
    TechNet Community Support

  • How do I find the files in all folders named Camera 1?

    Is there a way to search and find all of the video files in a certaint folder name? For example: I have many folders in different directories labled as Camera 1. I would like to be able to search for the files in all folders named Camera 1, but exclude any similar file types that might exist in other folders such as Camera 2, Camera 3, etc... Is there any way to do this?

    You should be able to sort by file name, file size, or last modified date by clicking the column heading. If the column headings are gone or you do not have all those details, there might be a way to reset your FireFTP settings but I've never researched it.

  • Query for local admins

    What is the query for finding out who all has local admin access on there workstations?

    Here are some examples:
    http://portal.sivarajan.com/2011/09/search-ad-and-list-local-administrator.html
    http://portal.sivarajan.com/2011/10/search-ad-collect-local-admin-group.html
    http://portal.sivarajan.com/2011/04/list-local-administrator-group-members.html
    Santhosh Sivarajan | Houston, TX | www.sivarajan.com
    ITIL,MCITP,MCTS,MCSE (W2K3/W2K/NT4),MCSA(W2K3/W2K/MSG),Network+,CCNA
    Windows Server 2012 Book - Migrating from 2008 to Windows Server 2012
    Blogs: Blogs
    Twitter: Twitter
    LinkedIn: LinkedIn
    Facebook: Facebook
    Microsoft Virtual Academy:
    Microsoft Virtual Academy
    This posting is provided AS IS with no warranties, and confers no rights.

  • Finding mailboxes with no retention policy applied and apply a policy?

    We manually apply retention policies at the time accounts are created.  However, some get missed and therefore, I assume that means they have no retention policy at all.  So, there is no true "default" policy that is automatically applied
    when you do not manually choose one?
    How can we find the ones that were missed and apply a retention policy to those?

    Hi
    This will return all the mailboxes without any policy set:
    Get-Mailbox -Filter 'retentionpolicy -eq $null'
    So you could do this:
    Get-Mailbox -Filter 'retentionpolicy -eq $null' | Set-Mailbox -RetentionPolicy <name of your policy>
    Steve

  • Query for collection "Quick Fix Engineering"

    Hi!
    I try to create query for collection,to find all workstation with install specific KB, from "Quick Fix Engineering".
    Added by this sample:
    http://myitforum.com/myitforumwp/2011/10/04/non-security-hotfix-detection-for-windows-7-2008/
    Maybe you can help? Can not find an example :(
    cenubit

    That's made a lot simpler in ConfigMgr 2012, as it can now simply be selected as an extra class in the
    Hardware Inventory of your client settings.
    Simply go in to your client settings, go to Hardware Inventory
    and click Set Classes. Here you can select the Quick Fix Engineering class to be part of your inventory.
    After an inventory you will be able to create your collection. Do keep in mind that this will also capture a lot of information that you will probably never use.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • How to force retention policy in Office365 for a mailbox

    Looking to run the MRM retention policy for a E3 mailbox and or Tenant.   I have an old PST file (2011 and older) that I have attached to their active Office365 mailbox Inbox Subfolder and have a policy in MRM to send the online Archive.  
    I know the MRM policy works because it has placed items in the "Online Archive" for the inbox and it's sub folders.
    The questions is how often does this MRM policy run on it's own?   Daily, hourly, weekly.
    How do I force the policy to take effect immediately?
    This is what I believe will do this via powershell:
    Set-executionpolicy remotesigned -force
    Set-executionpolicy unrestricted -force
    $LiveCred = Get-Credential
    Connect-msolservice -credential $LiveCred
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUrl
    https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection Import-PSSession $Session
      Set-Mailbox “mailbox name” -RetentionPolicy “Archive Policy”
     Start-ManagedFolderAssistant -Identity “mailbox name”

    Hi,
    In Exchange 2013, the Managed Folder Assistant is a throttle-based assistant.
    Throttle-based assistants are always running and don't need to be scheduled. The system resources they can consume are throttled. You can configure the Managed Folder Assistant to process all mailboxes on a Mailbox server within a certain period (known as
    a work cycle).
    You can use the following command to check work cycle.
    Get-MailboxServer –Identity ExServer | Format-List *WorkCycle*
    If you want to force the policy to take effect immediately, you can use the Start-ManagedFolderAssistant cmdlet.
    Here is an article for your reference, this article also applies to Exchange online.
    http://technet.microsoft.com/en-GB/library/dd297955(v=exchg.150).aspx
    Best regards,
    <o:p></o:p>
    Belinda Ma
    TechNet Community Support

Maybe you are looking for