在ucs vcheck报告中使用measure-command的writeerrorexception

时间:2017-06-28 14:53:15

标签: powershell

我正在努力让这个PowerShell报告正常工作

https://github.com/FooBartn/vCheck-UCS

并且报告在powershell ise中进行了很好的测试。但是当我尝试使用powershell.exe -ExecutionPolicy Bypass -File

安排它时

我看到下面的错误

C:\Scripts\ucs-vcheck-sdc\Plugins\00
Initialize\00_Connection_Plugin_for_UCS.ps1 : Exception of type
'Microsoft.PowerShell.Commands.WriteErrorException' was thrown.
At C:\Scripts\ucs-vcheck-sdc\vcheck.ps1:672 char:59
+ ... TR = [math]::round((Measure-Command {$Details = . $_.FullName}).Total 
...
+                                                     ~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,00_Connection_Plugin_for_UCS.ps1

C:\Scripts\ucs-vcheck-sdc\vcheck.ps1 :
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,vcheck.ps1

正在使用的代码是

 $TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSeconds, 2)

脚本的基础是来自文件夹的主要vcheck脚本调用插件。$ _。Fullname是

的示例
C:\Scripts\ucs-vcheck-sdc\Plugins\80 Finish\999 VeryLastPlugin Used to Disconnect.ps1  

这一行实际上是运行插件的。从我的研究来看,它写入标准输出的问题,但我似乎找不到问题。我已经查看了权限,并且我从其他一些插件中删除了空格,但这似乎并不重要。我正在接触到维护者,但我想知道是否有人知道会造成什么原因。

0 个答案:

没有答案