none
Export-PublicFolderStatistics.ps1 problems from Ex2007 to Ex2013 RRS feed

  • Question

  • Hi there

    I am following document for migration from Exchange 2007 SP3 RU10 to Exchange 2013 CU1 with a supported scenario. 

    Document for PF Migration http://technet.microsoft.com/en-us/library/jj150486(v=exchg.150).aspx states "On the legacy Exchange server, run the Export-PublicFolderStatistics.ps1 script to create the folder name-to-folder size mapping file" 

    Script EXPORT-PublicFolderStatistics.ps1 is not present on Exchange 2010 or Exchange 2007 Scripts folder but it is only present on Exchange 2013. 

    Launching it from Exchange 2013 will result in an empty CSV (csv is not created) 

    [PS] C:\Program Files\Microsoft\Exchange Server\V15\Scripts>.\Export-PublicFolderStatistics.ps1 Exchange2007.addomain.com .\Folder2SizeMap.csv
    [08/04/2013 16:52:02] Enumerating folders under NON_IPM_SUBTREE...
    A parameter cannot be found that matches parameter name 'Server'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolder], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolder
        + PSComputerName        : Exchange2007.addomain.com
    
    [08/04/2013 16:52:02] Enumerating folders under NON_IPM_SUBTREE completed...0 folders found.
    Cannot process argument transformation on parameter 'Identity'. Cannot convert value ".\Folder2SizeMap.csv" to type
    "Microsoft.Exchange.Configuration.Tasks.ServerIdParameter". Error: "'.\Folder2SizeMap.csv' is not a valid value for
    the identity.
    Parameter name: identity"
        + CategoryInfo          : InvalidData: (:) [Get-ExchangeServer], ParameterBindin...mationException
        + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-ExchangeServer
        + PSComputerName        : Exchange2007.addomain.com
    
    [08/04/2013 16:52:02] Retrieving statistics from server Exchange2007
    A parameter cannot be found that matches parameter name 'Server'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolderStatistics], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolderStatistics
        + PSComputerName        : Exchange2007.addomain.com
    
    [08/04/2013 16:52:03] Retrieving statistics from server Exchange2007 complete...0 folders found.
    [08/04/2013 16:52:03] Total unique folders found : 0.
    [08/04/2013 16:52:03] Exporting statistics for 0 folders
    [08/04/2013 16:52:03] Exporting folders to a CSV file

    Copying the scripts folder to Exchange 2007 and executing from exchange 2007 will result in NO execution

    [PS] E:\Scripts>.\Export-PublicFolderStatistics.ps1 Exchange2007.addomain.com \\Exchange2007\C$\Maps\map.csv
    Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At E:\Scripts\Export-PublicFolderStatistics.ps1:16 char:168
    +         HelpMessage = "Full path of the output file to be generated. If only filename is specified, then the output file will be generated in the current directory.")] <<<<
    [PS] E:\Scripts>
    

    Any ideas? 

    Thanks in advance!

    Monday, April 8, 2013 2:58 PM

All replies

  • Hi,

    The problem here is that the parameters are being specified in the opposite order. You need to specify the output file first and the server name second.

    Two extra things to notice after you fix the parameter order:

    1. Make sure you have write access to the output directory. In your case it seems that you are running the script and writing the output to the same machine, so you could just give a local path instead.

    2. There is a known issue with the script running against an E12 server. Script will fail with unknown parameter -ResultSize error. A fix for that problem has already been created, but it's not yet available for download from TechNet. To get around that, you can edit the script and remove all occurrences of "-ResultSize:Unlimited" before running it. Since you are going to make a change to the script, that will break the script's signature, so you will also have to remove the signature blob from the script in order to be able to run it.

    Thanks,

    Fred

    • Proposed as answer by IT-Minister Wednesday, January 31, 2018 2:02 PM
    Monday, April 8, 2013 6:34 PM
  • I am also getting the same error:
    Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At E:\Scripts\Export-PublicFolderStatistics.ps1:16 char:168
    +         HelpMessage = "Full path of the output file to be generated. If only filename is specified, then the output file will be generated in the current directory.")] <<<<

    i have two labs in one LAB script is working with no issue and in one lab its giving me this error, i copied the script from the working environment but still getting the same error. I dont think its issue with script but it might be issue with Rollup update 10 not applied properly.

    Thanks,

    Tuesday, April 9, 2013 4:17 PM
  • I too am getting the following errors. I am currently working on this in a test environment. I have tried switching the parameters according to Fred's post as well as edited the script with no success. We have a lot of data in public folders and need to get this working to be able to migrated to 2013 in production from 2007.

    on exchange 2013 cu1

    [PS] C:\Program Files\Microsoft\Exchange Server\V15\Scripts>.\Export-PublicFolderStatistics.ps1 "c:\export\folder2sizemap.csv" contosombx.contoso.com
    [4/9/2013 11:07:35 AM] Enumerating folders under NON_IPM_SUBTREE...
    A parameter cannot be found that matches parameter name 'Server'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolder], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolder
        + PSComputerName        : contosoexch2.contoso.com

    [4/9/2013 11:07:36 AM] Enumerating folders under NON_IPM_SUBTREE completed...0 folders found.
    A parameter cannot be found that matches parameter name 'IncludePreExchange2007'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolderDatabase], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolderDatabase
        + PSComputerName        : contosoexch2.contoso.com

    On 2007 sp3 rollup10 I get the following

    [PS] C:\Program Files\Microsoft\Exchange Server\Scripts>.\Export-PublicFolderStatistics.ps1 "C:\PFMigration\folder2mapsize.csv"  contosombx.contoso.com
    Parameter declarations are a comma-separated list of variable names with option
    al initializer expressions.
    At C:\Program Files\Microsoft\Exchange Server\Scripts\Export-PublicFolderStatis
    tics.ps1:16 char:168
    +         HelpMessage = "Full path of the output file to be generated. If only
    filename is specified, then the output file will be generated in the current di
    rectory.")] <<<<

    Tuesday, April 9, 2013 4:27 PM
  • <object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{ED8CE225-BE9C-442A-9345-71989436AC04}" /></object>

    Same Problem here, in my test enviroment the script works fine, but on production site it doesn't work.

    anybody know's a solution?

     
    Friday, April 12, 2013 2:46 PM
  • ok, the solution is easy.

    Just Update Powershell v1 to Powershell v2 (Windows Management Framework)

    Now the script works fine ;)

    <object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{F2E6F546-2990-4503-9598-F9F68D1B28B7}" /></object>
    Friday, April 12, 2013 4:24 PM
  • Hi,

    The problem here is that the parameters are being specified in the opposite order. You need to specify the output file first and the server name second.

    Two extra things to notice after you fix the parameter order:

    1. Make sure you have write access to the output directory. In your case it seems that you are running the script and writing the output to the same machine, so you could just give a local path instead.

    2. There is a known issue with the script running against an E12 server. Script will fail with unknown parameter -ResultSize error. A fix for that problem has already been created, but it's not yet available for download from TechNet. To get around that, you can edit the script and remove all occurrences of "-ResultSize:Unlimited" before running it. Since you are going to make a change to the script, that will break the script's signature, so you will also have to remove the signature blob from the script in order to be able to run it.

    Thanks,

    Fred

    Fred, thanks for your explaination. I have tried your suggestion but I still have problems. Could you please help me understand where I am wrong?

    If I execute the script (after switching parameters order and removing signatures and resultsize) from E12 server (after copying the script folder), I get this

    [PS] E:\Scripts>.\Export-PublicFolderStatistics.ps1 'C:\PFMigration\Map1.csv' Exchange2007.addomain.com
    
    Parameter declarations are a comma-separated list of variable names with optional initializer expressions.
    At E:\Scripts\Export-PublicFolderStatistics.ps1:16 char:168
    +         HelpMessage = "Full path of the output file to be generated. If only filename is specified, then the output file will be generated in the current directory.")] <<<<

    If I execute the script from Exchange 2013 I get this

    [PS] C:\Program Files\Microsoft\Exchange Server\V15\Scripts>.\Export-PublicFolderStatistics.ps1 c:\pfmig\map1.csv Exchange2007.addomain.com
    
    [13/04/2013 18:44:15] Enumerating folders under NON_IPM_SUBTREE...
    A parameter cannot be found that matches parameter name 'Server'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolder], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolder
        + PSComputerName        : Exchange2007.addomain.com
    
    [13/04/2013 18:44:15] Enumerating folders under NON_IPM_SUBTREE completed...0 folders found.
    A parameter cannot be found that matches parameter name 'IncludePreExchange2007'.
        + CategoryInfo          : InvalidArgument: (:) [Get-PublicFolderDatabase], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-PublicFolderDatabase
        + PSComputerName        : Exchange2007.addomain.com
    
    [13/04/2013 18:44:16] Exporting statistics for 0 folders
    [13/04/2013 18:44:16] Exporting folders to a CSV file
    [PS] C:\Program Files\Microsoft\Exchange Server\V15\Scripts>
    
    
    

    Am I missing anything?

    Saturday, April 13, 2013 4:46 PM
  • Simply copy the scripts folder from the exchange 213 server to the exchange 2007 sever and run the scripts directly from the scripts folder.

    Gil Gross | Project Manager & Technical Consultant | G-Net Network Solutions | www.g-net.co.il

    • Proposed as answer by Gil Gross Tuesday, April 16, 2013 7:33 AM
    Tuesday, April 16, 2013 7:33 AM
  • http://www.microsoft.com/en-us/download/details.aspx?id=38407

    Use the above scripts which has recently published for the issue.

    Monday, April 22, 2013 3:40 PM
  • Please also check if Powershell version 2.0 or above has installed on the server.

    http://blogs.msdn.com/b/brijs/archive/2011/03/11/how-to-check-current-installed-version-of-powershell.aspx

    Monday, April 22, 2013 9:12 PM
  • The lack of PowerShell 2.0 was my issue.  Thank you!!!!
    Tuesday, July 2, 2013 5:41 PM
  • 1. Install PowerShell 2.0

    2. Edit the file "Export-PublicFolderStatistics.ps1" and find this text in file "$_.MapiIdentity" and replace it with "$_.Identity"

    • Proposed as answer by inezm Friday, September 2, 2016 3:46 PM
    Thursday, August 25, 2016 7:07 PM
  • Hello together,

    I can confirm that replacement from $_.MapiIdentity to $_.Identity work. Cause I ran recently into the same problem and the renaming helped.

    Wednesday, February 22, 2017 7:10 AM