none
Is there a power shell command to pipe all public folders not modified or logged into for several years into a csv file RRS feed

  • Question

  • Is there a power shell command to pipe all public folders not modified or logged into for several years into a csv file. In exchange 2007. I need to clean up the public folder which were not in use or not modified. Is there any alternate way to do so.
    Server Admin
    Tuesday, August 2, 2011 9:28 AM

Answers

  • Hi,

    First, you can use Get-PublicFolderStatisticsto retrieve statistical information about public folders, such as folder name, folder size, item count and last logon time and so on. The following command is to export public folder information to C:\1.csv:

    Get-PublicFloderStatistics | Export –csv C:\1.csv

    And then you can use Remove-PublicFolder to remove existing public folders according to your need.

    Hope this helps.

    Thanks


    Sophia Xu
    • Proposed as answer by Sophia Xu Tuesday, August 9, 2011 1:23 AM
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Thursday, August 4, 2011 2:48 AM
  • On Tue, 9 Aug 2011 05:35:35 +0000, nanu4567 wrote:
     
    >
    >
    >Ok so if I pipe the lastmodificationtime it will give me the details of the folder. But I am inerested in the folder which are not in use . it can be done by confirming there is not new item added or removed from the folder. Till date I have ran few comdlets as below but its not giving me the correct info.
    >
    >Get-PublicFolderStatistics | where {$_.LastAccessTime -lt "08/01/2011"} | where {$_.LastModificationTime -lt "08/01/2011"} | where {$_.LastUserAccessTime -lt "08/01/2011"} | select-object Name, LastAccessTime, LastModificationTime, LastUserAccessTime | Export-CSV 'E:\Temp\Public-Folders.CSV'
    >
    >Just correct if something is wrong.
     
    The LastModificationTime refers to mofifications made to the folder,
    not to the contents of the folder.
     
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Wednesday, August 10, 2011 2:06 AM
  • Hi,

    You can try the following command:

    Get-PublicFolderStatistics | select Name, ItemCount, LastAccessTime, LastModificationTime, LastUserAccessTime | where {$_.LastModificationTime –lt “8/1/2011”} | where {$_.LastAccessTime –lt “8/1/2011”} | where {$_.LastuserAccessTime –lt “8/1/2011”}

    Get-PublicFolderStatistics | select Name, ItemCount, LastAccessTime, LastModificationTime, LastUserAccessTime | where {$_.LastModificationTime –lt “8/1/2011”} | where {$_.LastAccessTime –lt “8/1/2011”} | where {$_.LastuserAccessTime –lt “8/1/2011”} | Export –csv ‘E:\Temp\Public-Folders01.csv’

    Hope this helps.

    Thanks


    Sophia Xu
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Tuesday, August 16, 2011 6:28 AM

All replies

  • On Tue, 2 Aug 2011 09:28:59 +0000, nanu4567 wrote:
     
    >Is there a power shell command to pipe all public folders not modified or logged into for several years into a csv file. In exchange 2007. I need to clean up the public folder which were not in use or not modified. Is there any alternate way to do so.
     
    I don't think there's any sort of date associated with a public
    folder. Item _in_ a PF have a modified date, but that won't really
    tell you if there's been activity in the PF if the only activity was
    to delete items from it.
     
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    Wednesday, August 3, 2011 1:08 AM
  • Hi,

    First, you can use Get-PublicFolderStatisticsto retrieve statistical information about public folders, such as folder name, folder size, item count and last logon time and so on. The following command is to export public folder information to C:\1.csv:

    Get-PublicFloderStatistics | Export –csv C:\1.csv

    And then you can use Remove-PublicFolder to remove existing public folders according to your need.

    Hope this helps.

    Thanks


    Sophia Xu
    • Proposed as answer by Sophia Xu Tuesday, August 9, 2011 1:23 AM
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Thursday, August 4, 2011 2:48 AM
  • On Thu, 4 Aug 2011 02:48:15 +0000, Sophia Xu wrote:
     
    >
    >
    >Hi,
    >
    >First, you can use Get-PublicFolderStatisticsto retrieve statistical information about public folders, such as folder name, folder size, item count and last logon time and so on. The following command is to export public folder information to C:\1.csv:
    >
    >Get-PublicFloderStatistics | Export ?csv C:\1.csv
     
    When you're right, you're right. I forgot about that cmdlet. It *does*
    have the LastModificationTime property. But I think the modification
    time refers to the folder itself and not the last time content was
    added or removed or modified.
     
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    Thursday, August 4, 2011 4:05 AM
  • Ok so if I pipe the lastmodificationtime it will give me the details of the folder. But I am inerested in the folder which are not in use . it can be done by confirming there is not new item added or removed from the folder. Till date I have ran few comdlets as below but its not giving me the correct info.

    Get-PublicFolderStatistics | where {$_.LastAccessTime -lt "08/01/2011"} | where {$_.LastModificationTime -lt "08/01/2011"} | where {$_.LastUserAccessTime -lt "08/01/2011"} | select-object Name, LastAccessTime, LastModificationTime, LastUserAccessTime | Export-CSV 'E:\Temp\Public-Folders.CSV'

    Just correct if something is wrong.


    Server Admin
    Tuesday, August 9, 2011 5:35 AM
  • On Tue, 9 Aug 2011 05:35:35 +0000, nanu4567 wrote:
     
    >
    >
    >Ok so if I pipe the lastmodificationtime it will give me the details of the folder. But I am inerested in the folder which are not in use . it can be done by confirming there is not new item added or removed from the folder. Till date I have ran few comdlets as below but its not giving me the correct info.
    >
    >Get-PublicFolderStatistics | where {$_.LastAccessTime -lt "08/01/2011"} | where {$_.LastModificationTime -lt "08/01/2011"} | where {$_.LastUserAccessTime -lt "08/01/2011"} | select-object Name, LastAccessTime, LastModificationTime, LastUserAccessTime | Export-CSV 'E:\Temp\Public-Folders.CSV'
    >
    >Just correct if something is wrong.
     
    The LastModificationTime refers to mofifications made to the folder,
    not to the contents of the folder.
     
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Wednesday, August 10, 2011 2:06 AM
  • Hi,

    You can try the following command:

    Get-PublicFolderStatistics | select Name, ItemCount, LastAccessTime, LastModificationTime, LastUserAccessTime | where {$_.LastModificationTime –lt “8/1/2011”} | where {$_.LastAccessTime –lt “8/1/2011”} | where {$_.LastuserAccessTime –lt “8/1/2011”}

    Get-PublicFolderStatistics | select Name, ItemCount, LastAccessTime, LastModificationTime, LastUserAccessTime | where {$_.LastModificationTime –lt “8/1/2011”} | where {$_.LastAccessTime –lt “8/1/2011”} | where {$_.LastuserAccessTime –lt “8/1/2011”} | Export –csv ‘E:\Temp\Public-Folders01.csv’

    Hope this helps.

    Thanks


    Sophia Xu
    • Marked as answer by Sophia Xu Tuesday, August 16, 2011 6:46 AM
    Tuesday, August 16, 2011 6:28 AM