functions/platform-migration/Get-TssPlatformMigration.ps1
|
function Get-TssPlatformMigration { <# .SYNOPSIS Get a Delinea Platform migration run .DESCRIPTION Returns one Delinea Platform data migration run: status, start and end dates and the success and error counts per object type. Requires Delinea Platform integration on the Secret Server instance; without it the server returns an error (API_PlatformNotEnabled). .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Migration run ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssPlatformMigration -TssSession $session -Id 3 Returns migration run 3 .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Search-TssPlatformMigration -TssSession $session | Get-TssPlatformMigration -TssSession $session Returns the detail of every migration run .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/platform-migration/Get-TssPlatformMigration .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/platform-migration/Get-TssPlatformMigration.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.PlatformMigration.Migration')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('MigrationId')] [int[]] $Id ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation foreach ($currentId in $Id) { $restResponse = $null $uri = $TssSession.ApiUrl, 'platform-migration', 'migrations', $currentId -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Get-TssPlatformMigration request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.PlatformMigration.Migration](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.PlatformMigration.Migration])) } } } else { Write-Warning 'No valid session found' } } } |