Problem with replacereplicaonpfrecursive.ps1
I'm trying to start the process of removing an Exchange 2003 server after migrating to Exchange 2007. I'm having issues running this powershell command and I'm not sure why. The error looks like an issue with the script itself. I am running this with an account that has Exchange Enterprise admin access, public folder management, and recipient administrator permissions. I'm running this command from the scripts folder in the Exchange management shell. Here is what I get: PS] D:\Program Files\Microsoft\Exchange Server\Scripts>replacereplicaonpfrecurs ive.ps1 -toppublicfolder "\default public folders" -servertoadd "exchange2007server" -servertor emove exchange2003server" Get-PublicFolder : A parameter cannot be found that matches parameter name 'pub lic'. At line:1 char:17 + get-publicfolder <<<< -identity \default public folders -Recurse -resultsize unlimited Anyone know what's happening here?
January 6th, 2010 6:06pm

The script is passing "\default public folders" as a parameter to the command get-publicfolder, but it is being interpreted as get-publicfolder -identity \default public folders, e.g. public and folders are being viewed as other parameters. You'll need to escape the spaces in the name of your top level public folder. I think that will look like -toppublicfolder '\default` public` folders' Edit: Pay attention to the single quotes at the beginning and end and the backquotes that actually escape the space characters.
Free Windows Admin Tool Kit Click here and download it now
January 6th, 2010 8:17pm

Is “default public folders” here the root of the public folders? If yes, please try to cmdlet below: [PS] D:\Program Files\Microsoft\Exchange Server\Scripts>.\ReplaceReplicaOnPFRecursive.ps1 -TopPublicFolder "\" -ServerToRemove "MyEx2003Server" -ServerToAdd "SomeOtherExchangeServer"James Luo TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx) If you have any feedback on our support, please contact tngfb@microsoft.com
January 7th, 2010 5:12am

On Wed, 6-Jan-10 15:06:15 GMT, Camride wrote:>I'm trying to start the process of removing an Exchange 2003 server after migrating to Exchange 2007. I'm having issues running this powershell command and I'm not sure why. The error looks like an issue with the script itself. I am running this with an account that has Exchange Enterprise admin access, public folder management, and recipient administrator permissions. I'm running this command from the scripts folder in the Exchange management shell. Here is what I get: PS] D:\Program Files\Microsoft\Exchange Server\Scripts>replacereplicaonpfrecurs ive.ps1 -toppublicfolder "\default public folders" -servertoadd "exchange2007server" -servertor emove exchange2003server" Get-PublicFolder : A parameter cannot be found that matches parameter name 'pub lic'. At line:1 char:17 + get-publicfolder <<<< -identity \default public folders -Recurse -resultsize unlimited Anyone know what's happening here? You say that you surrounded the value with quotes, but the errordoesn't show the quotes around "\default public folders". The error iscoming from the cmdlet "get-publicfolder" within the script.Within the script are these lines:if ($server){ $getpfcmd = "get-publicfolder -server $Server -identity$TopPublicFolder -Recurse -resultsize unlimited"}else{ $getpfcmd = "get-publicfolder -identity $TopPublicFolder -Recurse-resultsize unlimited"}And the variable $getpfcmd is then used in a subsequentinvoke-expression.Try modifying the script by adding escaped quotes around the$TopPublicFolder. That should allow you to pass in a quotes string andstill have interpolation enabled when the command is finally executed.Like this:if ($server){ $getpfcmd = "get-publicfolder -server $Server -identity`"$TopPublicFolder`" -Recurse -resultsize unlimited"}else{ $getpfcmd = "get-publicfolder -identity `"$TopPublicFolder`"-Recurse -resultsize unlimited"}---Rich MatheisenMCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
January 7th, 2010 6:11am

Is “default public folders” here the root of the public folders? If yes, please try to cmdlet below: [PS] D:\Program Files\Microsoft\Exchange Server\Scripts>.\ReplaceReplicaOnPFRecursive.ps1 -TopPublicFolder "\" -ServerToRemove "MyEx2003Server" -ServerToAdd "SomeOtherExchangeServer" James Luo TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx) If you have any feedback on our support, please contact tngfb@microsoft.com That was it, though I got the answer from one of my co-workers earlier today. Thanks for the help! And yes, Default Public Folders was the root.
January 7th, 2010 6:41am

On Thu, 7-Jan-10 02:12:57 GMT, James-Luo wrote:>>>Is ?default public folders? here the root of the public folders? If yes, please try to cmdlet below: >>[PS] D:\Program Files\Microsoft\Exchange Server\Scripts>.\ReplaceReplicaOnPFRecursive.ps1 -TopPublicFolder "\" -ServerToRemove "MyEx2003Server" -ServerToAdd "SomeOtherExchangeServer"That'll work for the root of the public folders, but if he wants tomove some other branch of the hierarchy, and that public folder namecontains spaces (or some other character that PS considers aseparator), then the script will fail.The solution is for Microsoft to fix the script so it doesn't fail inunexpected ways. Let the principle of least suprise guide you. :-)---Rich MatheisenMCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
January 7th, 2010 6:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics