Pshell - remove trailing spaces from alias attrib
Hi - We are in migrating public folders (10,000+) over to 2010 from 2003. All replicas are in sync but at least 1500 folders have invalid aliases i.e. spaces and characters like () - I need to fix these in one go and thought the code below was the answer
but I get the error about ' pipeline not executing because pipeline is already executing' - I know the answer to this is to do with using variables, but drawn a blank with my efforts so far. Any shell gurus that can show me how this should look ?
Get-PublicFolder -Identity "\" -Recurse -ResultSize Unlimited | Get-MailPublicFolder | Where {$_.Alias -like "* *"} | ForEach-Object { Set-MailPublicFolder $_.identity -Alias:($_.Alias -Replace " ","") }
February 28th, 2011 6:01pm
You're on the right track, did you try just below?
Get-MailPublicFolder | Where {$_.Alias -like "* *"} | ForEach-Object { Set-MailPublicFolder $_.identity -Alias:($_.Alias -Replace " ","") }James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
February 28th, 2011 6:43pm
thanks for the suggestion - but still get the 'pipelines cannot be run concurrently' error. If I use the -identity "\foldername" with the above then the alias is updated as expected, but dont fancy this approach for 1500 broken aliases!
February 28th, 2011 7:20pm
Try this.
Get-PublicFolder -Identity "\" -Recurse -ResultSize Unlimited | Where {$_.name -like "* *"} | ForEach-Object {Set-MailPublicFolder $_.identity -name:($_.name -Replace " ","")}
James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
February 28th, 2011 7:59pm
Get-PublicFolder -Identity "\" -Recurse -ResultSize Unlimited | Where {$_.name -like "* *"} | ForEach-Object {Set-MailPublicFolder $_.identity -name:($_.name -Replace " ","")}
James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
February 28th, 2011 7:59pm
Hi James - Tried this. No changes are made to the folders. Even if I add the -identity "\foldername" to target a single folder in isolation, no change gets made. Thanks for the help so far.
Free Windows Admin Tool Kit Click here and download it now
March 1st, 2011 9:10am
For some reason it's only updating the PF directory object in Micrsoft Exchange System Objects in ADUC and not the PF in EMC. I'll have to do some more testing.James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
March 1st, 2011 11:03am
I've managed to fix this by following the steps here in regard to 'bypassing remoting' - Although the blog states that this is not supported, I fixed all my broken aliases using my the shell command in my first post in the Admin shell window (the blue one!
)
http://www.mikepfeiffer.net/2010/02/exchange-management-shell-error-pipelines-cannot-be-executed-concurrently/
you can do this by starting a standard PowerShell instance on a machine with the Exchange tools installed and loading the Exchange PSSnapin using the Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 command:
Get-PublicFolder -Identity "\" -Recurse -ResultSize Unlimited | Get-MailPublicFolder | Where {$_.Alias -like "* *"} | ForEach-Object { Set-MailPublicFolder $_.identity -Alias:($_.Alias -Replace " ","") }
job done! - Took a while to run through. Had a few folders with strange characters (not many) to fix manually but the majority had their aliases trimmed as I'd hoped for. Hope this helps someone else!
Free Windows Admin Tool Kit Click here and download it now
March 1st, 2011 4:23pm