%appdata%\Microsoft\MigrationTool\<domain-name>
This is a quick-n-dirty script to collect all the reports from SPMT and package it up as a ZIP archive. The script is designed to be ran in the root of the SPMT report folder, %appdata%\Microsoft\MigrationTool\<domain-name>
.
$jobs = @{} ls | foreach { $rpt = "$_\Report" $summary = import-csv "$rpt\SummaryReport.csv" $id = split-path -leaf $_ $summary | foreach { $lastrun = $_.{Start time} $lastrun = [datetime]::parseexact($lastrun, 'M/d/yyyy h:m:s tt', $null) $sitename = split-path -leaf $_.Source $job = [PSCustomObject]@{ id = $id sitename = $sitename src = $_.Source rpt = $rpt lastrun = $lastrun } if ($jobs.Keys -notcontains $job.src) { $jobs[$job.src] = $job } else { if ($job.lastrun -gt $jobs[$job.src].lastrun) { $jobs[$job.src] = $job } } } } foreach ($job in $jobs.GetEnumerator()) { $job = $job | select -ExpandProperty value write-host "$env:TEMP\$($job.sitename)_$($job.id)" Compress-Archive -Path $job.rpt -DestinationPath "$env:TEMP\$($job.sitename)_$($job.id)" }
When a site is renamed the redirect URL needs to be deleted if you want to create a new site with the name previously used by the renamed site.
# List all redirect URLs Get-SPOSite -Template REDIRECTSITE#0 # Delete a redirect URL Remove-SPOSite -Identity <redirect URL>