2

我最近创建了一个定期执行的运行手册计划 - 周一每 1 周执行一次,没有到期日期。时间表的制定是完美无缺的。但是,当我想使用 powershell cmdlet 检索所有 Runbook 计划的列表时

Get-AzureAutomationSchedule -AutomationAccountName $automationAccountName 
i get an error message:
Get-AzureAutomationSchedule : Nie można znaleźć żądanej wartości 'Week'. (The value 'Week' could not be found)
+  Get-AzureAutomationSchedule -AutomationAccountName $automationAccoun ...
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureAutomationSchedule], ArgumentException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationSchedule

当我删除此特定时间表时,将出现可用时间表的完整列表。

我也有时间表,而不是每小时/每天运行,它们不会产生这样的问题。

任何帮助将非常感激。

Get-AzureRmAutomationSchedule -Name name_of_the_failing_schedule按照@4c74356b41 的建议运行命令后,我收到相同的错误消息。

在调试模式下运行 cmdlet 后,您可以在下面看到 http 响应的正文

{
  "id": "/subscriptions/XXXXXXXXX",
  "name": "orphaned objects",
  "properties": {
    "description": "",
    "startTime": "2016-11-28T09:00:00+01:00",
    "startTimeOffsetMinutes": 0.0,
    "expiryTime": "9999-12-31T23:59:59.9999999+01:00",
    "expiryTimeOffsetMinutes": 0.0,
    "isEnabled": true,
    "nextRun": "2016-11-28T09:00:00+01:00",
    "nextRunOffsetMinutes": 0.0,
    "interval": 1,
    "frequency": "Week",
    "creationTime": "2016-11-22T10:41:49.433+01:00",
    "lastModifiedTime": "2016-11-22T10:41:49.433+01:00",
    "timeZone": "UTC",
    "advancedSchedule": {
      "monthDays": null,
      "monthlyOccurrences": null,
      "weekDays": [
        "Monday"
      ]
    }
  }
4

1 回答 1

0

我在旧版本的 AzureRM.Automation PowerShell 模块上遇到同样的错误:

PS C:\Users\Joe> Get-AzureRmAutomationSchedule -Name Every1WeekOnMonday -AutomationAccountName DemoAccount -ResourceGroupName DemoGroup
Get-AzureRmAutomationSchedule : Requested value 'Week' was not found.
At line:1 char:1
+ Get-AzureRmAutomationSchedule -Name Every1WeekOnMonday -AutomationAcc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureRmAutomationSchedule], ArgumentException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.GetAzureAutomationSchedule


PS C:\Users\Joe> Get-Module -Name AzureRM.Automation

ModuleType Version    Name                                ExportedCommands                                                       
---------- -------    ----                                ----------------                                                       
Manifest   1.0.4      AzureRM.Automation                  {Export-AzureRmAutomationDscConfiguration, Export-AzureRmAutomationD...

升级到最新版本的 AzureRM PowerShell cmdlet 可以解决此问题:

PS C:\Users\Joe> Get-AzureRmAutomationSchedule -Name Every1WeekOnMonday -AutomationAccountName DemoAccount -ResourceGroupName DemoGroup


StartTime              : 11/22/2016 6:44:00 PM -08:00
ExpiryTime             : 12/31/9999 3:59:00 PM -08:00
IsEnabled              : True
NextRun                : 11/28/2016 6:44:00 PM -08:00
Interval               : 1
Frequency              : Week
MonthlyScheduleOptions : Microsoft.Azure.Commands.Automation.Model.MonthlyScheduleOptions
WeeklyScheduleOptions  : Microsoft.Azure.Commands.Automation.Model.WeeklyScheduleOptions
TimeZone               : America/Los_Angeles
ResourceGroupName      : DemoGroup
AutomationAccountName  : DemoAccount
Name                   : Every1WeekOnMonday
CreationTime           : 11/22/2016 6:15:08 PM -08:00
LastModifiedTime       : 11/22/2016 6:15:08 PM -08:00
Description            : 




PS C:\Users\Joe>  Get-Module -Name AzureRM.Automation

ModuleType Version    Name                                ExportedCommands                                                       
---------- -------    ----                                ----------------                                                       
Manifest   2.3.0      AzureRM.Automation                  {Export-AzureRmAutomationDscConfiguration, Export-AzureRmAutomationD...

因此,您可以通过升级到最新版本的 AzureRM PowerShell cmdlet来解决此问题。

于 2016-11-23T03:31:19.563 回答