variable is filled, but still next command says it is empty

91 views Asked by At

Code

$PGroup = Invoke-Command -ComputerName "xx.example.net" -ScriptBlock {Get-DPMProtectionGroup -DPMServerName "xx.example.net" | ft name -HideTableHeaders}
    Invoke-Command -ComputerName "xx.example.net" -ScriptBlock {Get-DPMJob -ProtectionGroup $PGroup -Status Failed}

Error :-

Cannot validate argument on parameter 'ProtectionGroup'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. + CategoryInfo : InvalidData: (:) [Get-DPMJob], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.GetDpmJobCmdlet

1

There are 1 answers

1
OwlsSleeping On BEST ANSWER

Format-table converts your object for display in the terminal, but you don't want that if you're using it downstream for another purpose.