Powershell 对自动化变量';s值导致runbook失败并挂起

Powershell 对自动化变量';s值导致runbook失败并挂起,powershell,azure-automation,azure-runbook,Powershell,Azure Automation,Azure Runbook,我正在尝试在类型为Powershell的自动化运行手册中使用以下代码打印Azure自动化帐户的自动化变量的值类型 $var1 = ((Get-AzureRmAutomationVariable -Name "ArrayVar" -ResourceGroupName "automation-ps-rg" -AutomationAccountName "automation-ps-aa").Value).GetType() $var1 我发现这会导致runbook失败并重试3次,最终失败并显示以下

我正在尝试在类型为Powershell的自动化运行手册中使用以下代码打印Azure自动化帐户的自动化变量的值类型

$var1 = ((Get-AzureRmAutomationVariable -Name "ArrayVar" -ResourceGroupName "automation-ps-rg" -AutomationAccountName "automation-ps-aa").Value).GetType()
$var1
我发现这会导致runbook失败并重试3次,最终失败并显示以下消息

Suspended
The runbook job was attempted 3 times, but it failed each time. 
有什么原因会导致失败吗


谢谢

如果您只需要类型名,请尝试
(…).GetType().FullName


书写系统似乎有问题。请将对象键入作业流,因此请尝试选择您真正感兴趣的属性,而不是整个对象。

您可能正在调用
$null
上的
GetType()
。也就是说,括号内代码的结果可能不会产生任何对象。如果删除
GetType()
,会得到什么?当我删除get-type方法调用时,我看到的值是正确的。当我用get-AutomationVariable cmdlet替换get-AzurerAutomationVariable cmdlet时,也会发生这种情况谢谢。成功了。在这里发布反馈