Cmdlets/Get-UniqueSitesFromSourceSiteMigrationManifest/Get-UniqueSitesFromSourceSiteMigrationManifest.psm1
function Get-UniqueSitesFromSourceSiteMigrationManifest { [cmdletbinding()] param( [parameter(Mandatory=$True, position=0, ParameterSetName="ManifestFile", HelpMessage="This should be a JSON file that was generated using New-SourceMigrationManifest")] [ValidateScript({ if($_.localpath.endswith("json")){$True}else{throw "`r`n`'InputFile`' must be a JSON file"} if(test-path $_.localpath){$True}else{throw "`r`nFile $($_.localpath) does not exist"} })] [URI]$SourceManifest, [parameter(Mandatory=$True, position=0, ParameterSetName="EntryObjects", ValueFromPipeline=$True, HelpMessage="This should be a collection of objects imported from the JSON file generated by New-SourceMigrationManifest")] [System.Object[]]$SourceEntries ) if($pscmdlet.ParameterSetName -eq "ManifestFile") { $SourceEntries = (Get-Content $SourceManifest.LocalPath | ConvertFrom-Json) } $UniqueSourceSites = ($SourceEntries | Select-Object "Source Site URL" -Unique) Return $UniqueSourceSites } |