变量已填充,但下一个命令仍然说它是空的
variable is filled, but still next command says it is empty
代码
$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}
错误:-
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
Format-table 转换您的对象以在终端中显示,但如果您在下游将其用于其他目的,则您不希望这样。
代码
$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}
错误:-
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
Format-table 转换您的对象以在终端中显示,但如果您在下游将其用于其他目的,则您不希望这样。