writeerrorexception using measure-command in ucs vcheck report - powershell

I'm trying to get this powershell report to work
https://github.com/FooBartn/vCheck-UCS
and the report works fine testing it in powershell ise. But when I try to schedule it using powershell.exe -ExecutionPolicy Bypass -File
I see the error below
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
The code being used is
$TTR = [math]::round((Measure-Command {$Details = . $_.FullName}).TotalSeconds, 2)
the basics of the scripts is the main vcheck script call plugins from a folder.And example of what $_.Fullname is
C:\Scripts\ucs-vcheck-sdc\Plugins\80 Finish\999 VeryLastPlugin Used to Disconnect.ps1
This line is actually what runs the plugins.From my research its a problem writing to the standard output, but I can't seem to locate the problem. I've looked at permissions, and I've removed the spaces from some of the other plugins but it doesn't seem to matter. I'm reaching out to the mainainter, but I wanted to see if anyone had an idea of what would be causing this.

Related

Issue with power shell solution checker script

I'm getting following error while running the powershell solution checker script for CI:
Get-PowerAppsCheckerRulesets : An error occurred while sending the request.
At C:\MSDynamics\BuildScripts\PowerShell\SolutionCheckerCI.ps1:31 char:13
+ $rulesets = Get-PowerAppsCheckerRulesets -Geography Europe -TenantId ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PowerAppsCheckerRulesets], HttpRequestException
+ FullyQualifiedErrorId : System.Net.Http.HttpRequestException,Microsoft.PowerApps.Checker.PowerShell.Cmdlets.GetPowerAppsCheckerRulesets

What does this Nuget error mean, although package was successfully installed?

I installed Golem v 2.2 into my project "Jupiter.Gole.ISM" by entering this command at the Package Manager Console.
PM> Install-Package Golem
Even though the system reported that Golem 2.2.1 was successfully installed to my project, two errors had appeared:
1) Value does not fall within the expected range.
2) You cannot call a method on a null-valued expression.
...
...
Executing script file 'C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1'
InstallPath: C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1
ToolsPath: C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools
Package: NuGet.PackageManagement.VisualStudio.ScriptPackage
Project: System.__ComObject
Value does not fall within the expected range.
At C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1:32 char:1
+ $mobFile = $project.ProjectItems.Item("Proxy").ProjectItems.Item("bro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException
You cannot call a method on a null-valued expression.
At C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1:33 char:1
+ $mobFile.Properties.Item("CopyToOutputDirectory").Value = 2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Successfully installed 'Golem 2.2.1' to Jupiter.Gole.ISM
PM>
Thanks for your feedback.
Arlene

Errors when opening Nuget Package Manage Console

Whenever I open the package manager console in new VS 2017 session, it shows the below two error messages, and the for all intents and purposes operates normally. At least for vanilla commands like Install-Package.
Join-Path : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ChildPath'. Specified method is not supported.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:13 char:57
+ ... rPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Join-Path], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.JoinPathCommand
and
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:14 char:44
+ ... erPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
The offending line for the first is:
$compilerPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
with the error at $compilerPackage.Name (i.e. "char:57")
The offending line for the second is:
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
with the error at $compilerPackageDirectory 'tools'.
Can anyone with more Nuget and or PowerShell skills than me explain why this is happening, and how I can fix it, please?

PowerShell strange execution error

I've created sample cmdlet as a file.ps1 with logic to check my new inbox emails iterative on required time. But when OS Task scheduler (Windows 7) executed it I get these errors:
The interface is unknown. (Exception from HRESULT: 0x800706B5)At
C:\SCRIPTS\my-userAgent.ps1:7 char:7
+ while($ie.busy -eq $true)
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Method invocation failed because [System.__ComObject] does not contain a
method named 'Navigate'.At C:\SCRIPTS\my-userAgent.ps1:18 char:2
+ $ie.Navigate($url)
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Navigate:String) [], RuntimeE
xception
+ FullyQualifiedErrorId : MethodNotFound
As far as I understand that they are caused by my COM_obj, But why when I execute the same script from PowerShell_ISE it passes and works without errors!?! I've tried to resolve it by:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
hoping that is user_privileges related, but no success so far.
Any help will be appreciated.

Powershell, interactively invoking a static method

I'm sitting at a PowerShell command prompt and following http://technet.microsoft.com/en-us/library/dd347632.aspx
PS C:\> [System.Math]::Sqrt (9)
Unexpected token '(' in expression or statement.
At line:1 char:22
+ [System.Math]::Sqrt ( <<<< 9)
+ CategoryInfo : PArserError: ((:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
Am I being tricked or did the tutorial give me something that has a syntax error?
How do I do a basic thing like invoke a static method?
Don't have the space after Sqrt:
[System.Math]::Sqrt(9)