Zero Hour Sleep
18Dec/095

Managing spaces in AddReplicaToPFRecursive.ps1 script

If you are familiar with Microsoft Exchange 2007 you already know about the AddReplicaToPFRecursive.ps1 script that can be found in the "X:\Program Files\Microsoft\Exchange Server\Scripts", however this script has a bug it doesn't look to support public folders which names contains spaces.

It is quite common to enclose parameters that contains spaces with "quotations" but that doesn't work here.

If you simply try to use the following it will fail.

AddReplicatoPFRecursive.ps1 -TopPublicFolder “\PublicFolder with space” -ServerToAdd “servername”

The solution turned out to be to use single quotes inside the double quotes so it should be something like

AddReplicatoPFRecursive.ps1 -TopPublicFolder “'\PublicFolder with space'-ServerToAdd “servername”

That's really weird and not standard but it works !

Enjoyed the post, what is next?

Grab our FULL RSS feed! or Email Updates then share it

About Antoine Khater

I have been working in IT consultancy and solution integration since 1998 and I consider myself lucky to be, one in a few, making a living out of my passion. I am also member of the famous Experts Exchange (profile here) online community where I try my best to share what I have learned along the road.
  • Tawney
    Just a note, perhaps explain why it needs to be encapsulated twice? I know the reason why, but others may not understand the concept. It is because it passes that string to the script, but the script ommits the quotation marks. Because shell scripts accept both ' and " to encapsulate spaces, it accepts the ' inside the script - but ommits the " as it passes through the value.
  • Excellent Thank You
    staffs964 (experts exchange)
  • Steffen
    How do i recursivly remove a server?
  • Anis Achek
    Thanks for the clue. Very helpful.
  • mir
    That must have been tricky to catch
blog comments powered by Disqus
Content Twitter

RSS Feed

RSS by email