运行以下脚本时,我很少遇到错误。 我编写了脚本来从SCVMM服务器获取数据并将其复制到CSV文件。此脚本每15分钟运行一次。我们使用我们的调度程序安排了这个。但这里的问题是,有时它会低于警告并且不会将所需数据复制到CSV文件中。大部分时间它都在运行。极少数情况下它会抛出错误:
Get-SCCloud:VMM无法连接到VMM管理服务器calo-infvmm-01.calocosn.local,因为无法解析指定的计算机名称。
2016-05-15 19:01:30,334 INFO running system command: C:\cc-working\scripts\PowerShell\VMHours\Sydney\GetStorageDetails.bat -d 20160515 > C:\cc-working\usage_files\VMUphours\Sydney\Output\VMHours_20160515.csv 2016-05-15 19:01:33,874 WARN Get-SCCloud : VMM is unable to connect to the VMM management server 2016-05-15 19:01:33,874 WARN calo-infvmm-01.calocosn.local because the specified computer name could not be 2016-05-15 19:01:33,890 WARN resolved. (Error ID: 1601) 2016-05-15 19:01:33,890 WARN 2016-05-15 19:01:33,890 WARN Ensure that the computer name is correct, and then try the operation again. If 2016-05-15 19:01:33,890 WARN the problem persists, contact your network administrator. 2016-05-15 19:01:33,890 WARN At C:\cc-working\scripts\PowerShell\VMHours\Sydney\usage.ps1:7 char:11 2016-05-15 19:01:33,890 WARN + $clouds = Get-SCCloud -VMMServer $VMMServer 2016-05-15 19:01:33,890 WARN + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2016-05-15 19:01:33,890 WARN + CategoryInfo : ReadError: (:) [Get-SCCloud], CarmineException 2016-05-15 19:01:33,890 WARN + FullyQualifiedErrorId : 1601,Microsoft.SystemCenter.VirtualMachineManage 2016-05-15 19:01:33,890 WARN r.Cmdlets.GetSCCloudCmdlet 2016-05-15 19:01:34,373 INFO command completed successfully with an exit value of '0' 2016-05-15 19:01:34,389 INFO reader charset from auto-detect: ASCII 2016-05-15 19:01:34,389 INFO INPUT: file [C:\cc-working\usage_files\VMUphours\Sydney\Output\VMHours_20160515.csv] 2016-05-15 19:01:34,404 INFO collection feed: Sydney-VMHours-Collection
以下是我的剧本:
{{1}}