turranx
-
Total Posts
:
59
- Scores: 0
-
Reward points
:
0
- Joined: 2/7/2006
- Location: Cincinnati, OH
-
Status: offline
|
Find Exchange 2007 Public Folders with trailing spaces
Friday, June 27, 2008 10:45 AM
( permalink)
We had a couple hundred Public Folders (PF) on our Exchange 2000 server. These all needed to be migrated to the Exchange 2007 server. I added the Ex2007 server as a replica to each PF and waited about a week while the replication took place. While reading http://msexchangeteam.com/archive/2007/06/25/445429.aspx to learn how to remove the Ex2000 server from the replication list, I found that a number of the PFs had trailing spaces upon them; Ex2007 doesn't like this at all. [sm=s14.gif] I whipped up this one-liner to list out which PFs had this problem so I could manually correct it. This run successfully on my Ex2007 SP1 server within the Exchange Management Shell.
Get-PublicFolder -recurse |
foreach
{
if ($_.name.endswith(' '))
{
if ($_.ParentPath -ne $null)
{
if ([int]$($_.ParentPath.get_length()) -gt 1)
{
$i = $_.ParentPath + "\" + $_.name
}
else
{
$i = "\" + $_.name
}
};
$i
}
}
Get-PublicFolder -recurse | foreach {if ($_.name.endswith(' ')) { if ($_.ParentPath -ne $null) { if ([int]$($_.ParentPath.get_length()) -gt 1) {$i = $_.ParentPath + "\" + $_.name} else {$i = "\" + $_.name}};$i}}
I know this pales in comparison to some of the VBS stuff I churned out in the past, but I am brand spanking new to PowerShell. Start small, work my way to gargantuan.
|
|
|
|
dm_4ever
-
Total Posts
:
3687
- Scores: 82
-
Reward points
:
0
- Joined: 6/29/2006
- Location: Orange County, California
-
Status: offline
|
RE: Find Exchange 2007 Public Folders with trailing spaces
Saturday, June 28, 2008 8:32 AM
( permalink)
Thanks for sharing....we're not using Exchange 2007 at work yet, but this may come in handy when we finally do.
|
|
|
|