Guest User

Untitled

a guest
Jan 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. # Make sure the report is in the $report variable. Then just copy and paste this into Exchange Management Shell.
  2.  
  3. $report.Report.MailboxVerification | WHERE { $_.FolderIsMissing } | % {
  4. $path = $_.FolderSourcePath
  5. if (!($path.StartsWith("/IPM_SUBTREE"))) {
  6. continue
  7. }
  8.  
  9. $path = $path.Substring(12).Replace("/", "\")
  10. $lastSlashIndex = $path.LastIndexOf("\")
  11. $folderName = $path.Substring($lastSlashIndex + 1)
  12. if ($lastSlashIndex -eq 0) {
  13. "Creating root folder: $folderName"
  14. New-PublicFolder $folderName
  15. } else {
  16. $parent = $path.Substring(0, $lastSlashIndex)
  17. "Creating new child folder in parent: $parent"
  18. "Child folder: $folderName"
  19. New-PublicFolder -Path $parent -Name $folderName
  20. }
  21. }
Add Comment
Please, Sign In to add comment