In Exchange life cycle we always bring in new Exchange servers and some times remove the old exchange servers. Some times decomission of exchange servers is bit challanging but really noting to worry. As you whould moved most of the users out and there will be no impact.
Once you remove public folder then most of the decomission goes smooth. Removing public folder some times can be bit tricky, in fact most of the time we have to fight with PF to remove it. Before removing the public folder you need to make sure that you remove all the replicas for that public folder Database.
This commands helps you get the list of all the public folder and there replicas
Get-publicfolder \ -recurse |ft Name,Replicas
This commands gets you all the system folders replicas
Get-publicfolder \NON_IPM_SUBTREE -recurse |ft Name,Replicas
If you wanted to move all the replica pointing from the decomission server to new server then below command does it all. Once you run this command you need to wait for some time. Time may vary, it can take few hours to days depending on the size of public folder.
.\MoveAllReplicas.ps1 -Server MySourceServer -NewServer MyTargetServer
If you dont wanted move the replica and some times all the pf folder will share the replica and it really does not make sense to move the replica to the database which already exists. Then you may wanted to use removereplicafrompfrecursive powershell script which is available in scripts, to remove all the replica for the server. Again it needs some time for the replication.
RemoveReplicaFromPFRecursive.ps1 –TopPubicFolder “\” -servertoRemove <servername>
Once all the replicas are romoved then you can delete public folder database using below command. Before that you also need to make sure that Mailbox database is not pointing to this PF database which you are removing
Get-publicfolderdatabase -server <decomservername> | remove-publicfolderdatabase