VSTS Release: NuGet Publisher Step Fails - azure-devops

I'm playing with Release features in Visual Studio Online. My project is built into a nuget package that I would like to publish to a nuget feed.
I'm successfully building nuget package and publish it into Artifacts and I can see required file when I try to browse Artifacts. Then I switch into VSO Release and as part of release I have Nuget Publisher step:
I'm using VSO internal nuget feed with address like this:
https://mytenant.pkgs.visualstudio.com/DefaultCollection/_packaging/myfeedname/nuget/v3/index.json
When I create new release this step fails:
Set workingFolder to default:
C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39 Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39\NuGetPublisher.ps1
[error]Cannot bind argument to parameter 'Path' because it is null.
[error]Cannot bind argument to parameter 'Path' because it is null. Check/Set nuget path Creating Nuget Arguments
[error]Cannot bind argument to parameter 'Path' because it is null.
[error]You cannot call a method on a null-valued expression.
Obviously nuget file path is not being passed to the script. Also I have tried to specify exact path to the nuget (selected from dropdowns):
$(System.DefaultWorkingDirectory)\Build & Test\nuget package\MyPackageName.1.1.16014.7.nupkg
But got the same error.
This step only fails when I use it in VSO Release. When I use Nuget Publisher step as a build step and specify same nuget feed address and "Path/Pattern to nupkg" as **\bin\MyPackageName.*.nupkg, I get the package published to the feed.
Any idea how to fix this error for VSO Release?
UPD: this is the log debug output
>Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39
>Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPublisher\0.1.39\NuGetPublisher.ps1
>[debug]Importing modules
>[debug]Loading module from path 'C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll'.
>[debug]Importing cmdlet 'Add-BuildAttachment'.
>[debug]Importing cmdlet 'Convert-String'.
>
>...SNIP...
>
>[debug]Importing cmdlet 'Find-Files'.
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[debug]Entering script System.Management.Automation.InvocationInfo.MyCommand.Name
>[debug]Parameter Values
>[debug]searchPattern = C:\a\0dbc15949\**\*.nupkg
>[debug]nuGetFeedType = internal
>[debug]connectedServiceName =
>[debug]feedName = https://MyName.pkgs.visualstudio.com/DefaultCollection/_packaging/MyFeedName/nuget/v3/index.json
>[debug]nuGetAdditionalArgs =
>[debug]nuGetPath =
>Check/Set nuget path
>Creating Nuget Arguments
>[debug]Using provided feed URL
>[error]System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Path' because it is null.
>[error] at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
>[error] at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
>[error] at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
>[error] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Here is the full log for Nuget Publisher step

This was a bug in the NuGet Publisher task. It was fixed with our Sprint 94 deployment.

Related

Azure DevOps task -- How do I connect to service fabric cluster?

I am creating a Azure DevOps task for the first time so please bear with me. I created a task which needs to connect to service fabric cluster which is hosted on azure. I borrowed a piece of code from serviceFabricDeployv1 task on github to connect to the cluster. When I published this task & used it, I got the following error: Cannot index into a null array. I then enabled debug mode and the error points to Connect-ServiceFabricClusterFromServiceEndpoint:
2019-04-05T17:43:58.7031978Z ##[debug]Entering D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1.
2019-04-05T17:43:58.7326382Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\ServiceFabricHelpers.psm1'.
2019-04-05T17:43:58.7457125Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\module.json
2019-04-05T17:43:58.7798307Z ##[debug]Loaded 17 strings.
2019-04-05T17:43:58.7852857Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:43:58.7877741Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:43:58.8294503Z ##[debug]Loaded 17 strings.
2019-04-05T17:43:58.8552233Z ##[debug]Entering Find-VstsFiles.
2019-04-05T17:43:58.8652603Z ##[debug] LiteralDirectory: 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers'
2019-04-05T17:43:58.8675211Z ##[debug] LegacyPattern: '*.ps1'
2019-04-05T17:43:59.5468797Z ##[debug]Entering Get-MatchingItems.
2019-04-05T17:43:59.5509999Z ##[debug] IncludePatterns: 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\*.ps1'
2019-04-05T17:43:59.5573606Z ##[debug] ExcludePatterns: ''
2019-04-05T17:43:59.5624335Z ##[debug] IncludeFiles: 'True'
2019-04-05T17:43:59.5666234Z ##[debug] IncludeDirectories: 'False'
2019-04-05T17:43:59.5684855Z ##[debug] Force: 'False'
2019-04-05T17:44:00.0606696Z ##[debug]Paths: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\
2019-04-05T17:44:00.0629904Z ##[debug] CommonHelpers.ps1
2019-04-05T17:44:00.0630803Z ##[debug] Connect-ServiceFabricClusterFromServiceEndpoint.ps1
2019-04-05T17:44:00.0631002Z ##[debug] Get-ServiceFabricEncryptedText.ps1
2019-04-05T17:44:00.0631429Z ##[debug] SFOperations.ps1
2019-04-05T17:44:00.0632558Z ##[debug]Leaving Get-MatchingItems.
2019-04-05T17:44:00.0796566Z ##[debug]Total found: 4
2019-04-05T17:44:00.0818584Z ##[debug]Leaving Find-VstsFiles.
2019-04-05T17:44:00.0836639Z ##[debug]Exporting function 'Connect-ServiceFabricClusterFromServiceEndpoint'.
2019-04-05T17:44:00.0854254Z ##[debug]Exporting function 'Remove-ClientCertificate'.
2019-04-05T17:44:00.0873015Z ##[debug]Exporting function 'Get-ServiceFabricEncryptedText'.
2019-04-05T17:44:00.0895219Z ##[debug]Exporting variable 'SF_Operations'.
2019-04-05T17:44:00.0913326Z ##[debug]Exporting function 'Publish-Telemetry'.
2019-04-05T17:44:00.0931512Z ##[debug]Exporting function 'Get-SfSdkVersion'.
2019-04-05T17:44:00.0948589Z ##[debug]Exporting function 'Trace-WarningIfCertificateNotPresentInLocalCertStore'.
2019-04-05T17:44:00.2293992Z ##[debug]Importing function 'Connect-ServiceFabricClusterFromServiceEndpoint'.
2019-04-05T17:44:00.2348563Z ##[debug]Importing function 'Get-ServiceFabricEncryptedText'.
2019-04-05T17:44:00.2364893Z ##[debug]Importing function 'Get-SfSdkVersion'.
2019-04-05T17:44:00.2365479Z ##[debug]Importing function 'Publish-Telemetry'.
2019-04-05T17:44:00.2365962Z ##[debug]Importing function 'Remove-ClientCertificate'.
2019-04-05T17:44:00.2366440Z ##[debug]Importing function 'Trace-WarningIfCertificateNotPresentInLocalCertStore'.
2019-04-05T17:44:00.2381806Z ##[debug]Importing variable 'SF_Operations'.
2019-04-05T17:44:00.2595362Z ##[debug]INPUT_NAME: 'Test'
2019-04-05T17:44:00.2618846Z ##[debug]INPUT_SERVICECONNECTIONNAME: '9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ'
2019-04-05T17:44:00.2743138Z ##[debug]ENDPOINT_URL_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: 'tcp://XXXXXXX-dev.eastus.cloudapp.azure.com:19000/'
2019-04-05T17:44:00.2768982Z ##[debug]ENDPOINT_AUTH_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: '********'
2019-04-05T17:44:00.2795548Z ##[debug]ENDPOINT_DATA_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: '{}'
2019-04-05T17:44:00.2825549Z ##[debug]INPUT_APPLICATIONTYPENAME: 'YYYYYYYYYAdminApplicationType'
2019-04-05T17:44:00.2851562Z ##[debug]INPUT_VERSIONSTOKEEP: '25'
2019-04-05T17:44:00.2859654Z Hello Test
2019-04-05T17:44:00.2940936Z
2019-04-05T17:44:00.3971664Z ##[debug]Entering Connect-ServiceFabricClusterFromServiceEndpoint.
2019-04-05T17:44:00.4005857Z ##[debug] ClusterConnectionParameters: ''
2019-04-05T17:44:00.4049759Z ##[debug] ConnectedServiceEndpoint: '#{Url=tcp://XXXXXXX-dev.eastus.cloudapp.azure.com:19000/; Data=; Auth=}'
2019-04-05T17:44:00.4073037Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_\TlsHelper_.psm1'.
2019-04-05T17:44:00.4131899Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_/module.json
2019-04-05T17:44:00.4222463Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4254490Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:44:00.4276566Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:44:00.4371091Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4389647Z ##[debug]Exporting function 'Add-Tls12InSession'.
2019-04-05T17:44:00.4408086Z ##[debug]Exporting function 'Assert-TlsError'.
2019-04-05T17:44:00.4427407Z ##[debug]Importing function 'Add-Tls12InSession'.
2019-04-05T17:44:00.4445734Z ##[debug]Importing function 'Assert-TlsError'.
2019-04-05T17:44:00.4468489Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\PowershellHelpers.psm1'.
2019-04-05T17:44:00.4520413Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\module.json
2019-04-05T17:44:00.4616048Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4644750Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:44:00.4665426Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:44:00.4762919Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4815247Z ##[debug]Exporting function 'Invoke-ActionWithRetries'.
2019-04-05T17:44:00.4833170Z ##[debug]Exporting function 'Get-TempDirectoryPath'.
2019-04-05T17:44:00.4852570Z ##[debug]Importing function 'Get-TempDirectoryPath'.
2019-04-05T17:44:00.4869307Z ##[debug]Importing function 'Invoke-ActionWithRetries'.
2019-04-05T17:44:00.8779229Z ##[debug]TLS 1.2 already present in session.
2019-04-05T17:44:01.1396847Z ##[debug]Leaving Connect-ServiceFabricClusterFromServiceEndpoint.
2019-04-05T17:44:01.3539036Z ##[debug]Leaving D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1.
2019-04-05T17:44:01.4231167Z ##[debug]Caught exception from task script.
2019-04-05T17:44:01.4260902Z ##[debug]Error record:
2019-04-05T17:44:01.4795495Z ##[debug]Cannot index into a null array.
2019-04-05T17:44:01.4807469Z ##[debug]At D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Connect-ServiceFabricClusterFromServiceEndpoint.ps1:183 char:9
2019-04-05T17:44:01.4819503Z ##[debug]+ $clusterConnectionParameters["ConnectionEndpoint"] = $connect ...
2019-04-05T17:44:01.4833117Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-04-05T17:44:01.4845957Z ##[debug] + CategoryInfo : InvalidOperation: (:) [], RuntimeException
2019-04-05T17:44:01.4858471Z ##[debug] + FullyQualifiedErrorId : NullArray
2019-04-05T17:44:01.4871142Z ##[debug]
2019-04-05T17:44:01.4891780Z ##[debug]Script stack trace:
2019-04-05T17:44:01.4933518Z ##[debug]at Connect-ServiceFabricClusterFromServiceEndpoint, D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Connect-ServiceFabricClusterFromServiceEndpoint.ps1: line 183
2019-04-05T17:44:01.4947432Z ##[debug]at <ScriptBlock>, D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1: line 33
2019-04-05T17:44:01.4961200Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-05T17:44:01.4976344Z ##[debug]at <ScriptBlock>, <No file>: line 22
2019-04-05T17:44:01.4991236Z ##[debug]at <ScriptBlock>, <No file>: line 18
2019-04-05T17:44:01.5004268Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-05T17:44:01.5024099Z ##[debug]Exception:
2019-04-05T17:44:01.5063789Z ##[debug]System.Management.Automation.RuntimeException: Cannot index into a null array.
2019-04-05T17:44:01.5078978Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2019-04-05T17:44:01.5092694Z ##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5107807Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5120140Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5414310Z ##[error]Cannot index into a null array.
2019-04-05T17:44:01.5423078Z ##[debug]Processed: ##vso[task.logissue type=error]Cannot index into a null array.
2019-04-05T17:44:01.5443902Z ##[debug]Processed: ##vso[task.complete result=Failed]
I have verified that all the required modules are included in the task & I am selecting the correct service fabric connection from the list.
Here is the powershell script that I am using to call the Connect-ServiceFabricClusterFromServiceEndpoint function:
Import-Module $PSScriptRoot\ps_modules\ServiceFabricHelpers
# Get inputs.
$inputName = Get-VstsInput -Name 'name' -Require
$serviceConnectionName = Get-VstsInput -Name serviceConnectionName -Require
$connectedServiceEndpoint = Get-VstsEndpoint -Name $serviceConnectionName -Require
$ApplicationTypeName = Get-VstsInput -Name 'ApplicationTypeName' -Require
$VersionsToKeep = Get-VstsInput -Name 'VersionsToKeep' -Require
Write-Host "Hello $inputName"
if ($connectedServiceEndpoint.Auth.Scheme -ne "None" -and !$connectedServiceEndpoint.Auth.Parameters.ServerCertThumbprint)
{
Write-Warning (Get-VstsLocString -Key ServiceEndpointUpgradeWarning)
if ($publishProfile)
{
$clusterConnectionParameters["ServerCertThumbprint"] = $publishProfile.ClusterConnectionParameters["ServerCertThumbprint"]
}
else
{
throw (Get-VstsLocString -Key PublishProfileRequiredServerThumbprint)
}
}
write-output $connectedServiceEndpoint
# Connect to cluster
$certificate = Connect-ServiceFabricClusterFromServiceEndpoint -ClusterConnectionParameters $clusterConnectionParameters -ConnectedServiceEndpoint $connectedServiceEndpoint
I am expecting the connection properties to be passed to Connect-ServiceFabricClusterFromServiceEndpoint function so that I can perform operation on the cluster.

Service Fabric - Deploy new version of app without code changes

is there a way in Service Fabric to deploy a new version of an app even though the code hasn't changed?
SF is constantly complaining about this whenever the devs rebuild the repo because something outside of the package changed but don't change the actual code of the app, and the version of the application gets bumped up by the build pipeline.
SF then says "you're trying to deploy a newer version of an application that already exists even though there are no code changes" and then fails.
Any way to change this behaviour?
Edit:
Here's a trace of the actual deployment error:
2018-11-07T06:07:23.1289545Z ##[debug]Processed: ##vso[telemetry.publish
area=TaskHub;feature=ServiceFabricDeploy]{"OperationId":"GetApplicationType","ExceptionData":"System.Management.Automation.MethodInvocationException;System.Management.Automation.RuntimeException;System.Management.Automation.RuntimeException;|D:\\a\\_tasks\\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\\1.7.27\\ServiceFabricSDK\\Utilities.ps1|597","JobId":"ae65e85b-a04b-4de4-ac32-c9a821fba222","SDKVersion":"3.2.176.9494"}
2018-11-07T06:07:23.5491048Z ##[debug]Leaving D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\deploy.ps1.
2018-11-07T06:07:23.5537752Z ##[debug]Caught exception from task script.
2018-11-07T06:07:23.5570190Z ##[debug]Error record:
2018-11-07T06:07:23.6347435Z ##[debug]Invoke-ActionWithRetries : Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.."
2018-11-07T06:07:23.6359357Z ##[debug]At D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1:597 char:12
2018-11-07T06:07:23.6371643Z ##[debug]+ return Invoke-ActionWithRetries -Action $getAppTypeAction `
2018-11-07T06:07:23.6383668Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-11-07T06:07:23.6395763Z ##[debug] + CategoryInfo : NotSpecified: (:) [Invoke-ActionWithRetries], MethodInvocationException
2018-11-07T06:07:23.6408095Z ##[debug] + FullyQualifiedErrorId : RuntimeException,Invoke-ActionWithRetries
2018-11-07T06:07:23.6420176Z ##[debug]
2018-11-07T06:07:23.6439430Z ##[debug]Script stack trace:
2018-11-07T06:07:23.6475478Z ##[debug]at Invoke-ActionWithRetries, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ps_modules\PowershellHelpers\Helpers.ps1: line 61
2018-11-07T06:07:23.6487812Z ##[debug]at Wait-ServiceFabricApplicationTypeRegistrationStatus, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1: line 597
2018-11-07T06:07:23.6500061Z ##[debug]at Register-ServiceFabricApplicationTypeAction, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1: line 516
2018-11-07T06:07:23.6512541Z ##[debug]at Publish-NewServiceFabricApplication, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1: line 296
2018-11-07T06:07:23.6524254Z ##[debug]at <ScriptBlock>, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\deploy.ps1: line 194
2018-11-07T06:07:23.6536298Z ##[debug]at <ScriptBlock>, <No file>: line 1
2018-11-07T06:07:23.6548158Z ##[debug]at <ScriptBlock>, <No file>: line 22
2018-11-07T06:07:23.6559801Z ##[debug]at <ScriptBlock>, <No file>: line 18
2018-11-07T06:07:23.6572215Z ##[debug]at <ScriptBlock>, <No file>: line 1
2018-11-07T06:07:23.6591191Z ##[debug]Exception:
2018-11-07T06:07:23.6634400Z ##[debug]System.Management.Automation.MethodInvocationException: Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.." ---> System.Management.Automation.RuntimeException: Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.. ---> System.Management.Automation.RuntimeException: Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same..
2018-11-07T06:07:23.6646133Z ##[debug] --- End of inner exception stack trace ---
2018-11-07T06:07:23.6657929Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-11-07T06:07:23.6670688Z ##[debug] at <ScriptBlock>(Closure , FunctionContext )
2018-11-07T06:07:23.6683139Z ##[debug] at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
2018-11-07T06:07:23.6694796Z ##[debug] at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
2018-11-07T06:07:23.6707020Z ##[debug] at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
2018-11-07T06:07:23.6719153Z ##[debug] at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
2018-11-07T06:07:23.6731325Z ##[debug] at System.Management.Automation.ScriptBlock.DoInvoke(Object dollarUnder, Object input, Object[] args)
2018-11-07T06:07:23.6742915Z ##[debug] at CallSite.Target(Closure , CallSite , ScriptBlock , Object )
2018-11-07T06:07:23.6754590Z ##[debug] --- End of inner exception stack trace ---
2018-11-07T06:07:23.6766838Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-11-07T06:07:23.6778543Z ##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6791071Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6802711Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6814797Z ##[debug] at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6826406Z ##[debug] at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
2018-11-07T06:07:23.6838645Z ##[debug] at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
2018-11-07T06:07:23.6850253Z ##[debug] at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
2018-11-07T06:07:23.6862534Z ##[debug] at System.Management.Automation.CommandProcessorBase.Complete()
2018-11-07T06:07:23.6921240Z ##[error]Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.."
In AzDo / VSTS the option "Use Diff Package" on the "Service Fabric Application Deployment" task is set.
This has been already answered here and here
You should make differencial packaging instead, or update the version of all services.
Answering the main question:
No, it's not possible to change this behaviour, you have to update the versions or do differential packaging.

Exception calling "Put" with "0" argument(s): "" on Win32_TerminalServiceSetting

I have created a Powershell function to enable or disable session logons remotely on a server. It is basically the Powershell equivalent of "change logon /enable".
It works on most machines, but for some reason I don't understand, for some it returns the following error :
Exception : System.Management.Automation.MethodInvocationException: Exception calling "Put" with "0" argument(s): "" ---> System.IO.FileNotFoundException
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.Put(PutOptions options)
at System.Management.ManagementObject.Put()
at Put(Object , Object[] )
at System.Management.Automation.MethodInformation.Invoke(Object target, Object[] arguments)
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[]
originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[]
originalArguments)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation,
PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.DotNetAdapter.MethodInvoke(PSMethod method, PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.PSMethod.Invoke(PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.PSMethod.Invoke(Object[] arguments)
at System.Management.Automation.Language.PSInvokeMemberBinder.InvokeAdaptedMember(Object obj, String methodName, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : DotNetMethodException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
The error stack trace doesn't help me.
I'm running the same code with the same local admin user on all machines.
Here is the actual code snippet :
$TSConnector = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace "root/cimv2/terminalservices" -Authentication PacketPrivacy
$TSConnector.Logons = 0
$TSConnector.Put()
Any idea ?
So it turns out that, on Windows Server 2008R2, if the Remote Desktop Session Host role is not installed, the server is configured for "Remote Desktop for Administration".
As explained on this technet article :
The following are limitations of Remote Desktop for Administration:
The default connection (RDP-Tcp) only allows a maximum of two simultaneous remote connections.
Licensing settings cannot be configured.
RD Connection Broker settings cannot be configured.
User logon mode cannot be configured.
So in the end I had to catch that exception and revert back to using change logon /disable in that particular case.
Kudos to #GrigorySergeev for pointing me in the right direction!

BMC Remedy AR Driver crashes powershell

My situation is fairly specific so I am hoping that someone has some insight that could help me.
Code
$id = Get-Credential "REMEDY\$($env:USERNAME)"
$userId = $id.UserName.split("\")[1].tolower()
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($id.password)
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$cn = New-Object -comobject ADODB.Connection
$rs = New-Object -comobject ADODB.Recordset
$b = "Group5"
$c = "DSN=AR System ODBC Data Source;ARServer=remedyServer;ARServerPort=7130;UID=$userId;PWD=$password"
$cn.Open($c)
$q = "SELECT AuditTrail FROM HPD_HelpDesk WHERE AssignedToGroup='$b'"
$rs.Open($q, $cn)
while (!$rs.EOF) {
$rs.Fields.item(0).value
$rs.MoveNext()
}
$rs.close()
$cn.close()
Driver:
Name: AR System ODBC Driver
Version: 7.06.04.30000
File: ARODBC7604_BUILD02.DLL
Issue
Under Windows 7 32bit, powershell v4, everything works 100% of the time without error.
Under Windows 10 64bit, it works roughly 5% of the time (forcing powershell x86 or it wont see the ODBC driver at all, but that's more annoying than an issue)
Error
I had a hard time even getting the error because Powershell completely closes instantly when this occurs, however running it from a CMD lets me see the output before it closes. Here is the error I get, and again the exact same code does occasionally work. The line that is actually crashing is the $rs.fields.item(0).value line
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at IDispatchInvoke(IntPtr , Int32 , INVOKEKIND , DISPPARAMS& , Variant& , ExcepInfo& , UInt32& )
at System.Management.Automation.ComInterop.UnsafeMethods.IDispatchInvoke(IntPtr dispatchPointer, Int32 memberDispId, INVOKEKIND flags, DISPPARAMS& dispParams, Variant& result, ExcepInfo& excepInfo, UInt32& argErr)
at CallSite.Target(Closure , CallSite , ComObject )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CallSite.Target(Closure , CallSite , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.DlrScriptCommandProcessor.Complete()
at System.Management.Automation.CommandProcessorBase.DoComplete()
at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.DlrScriptCommandProcessor.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.DlrScriptCommandProcessor.Complete()
at System.Management.Automation.CommandProcessorBase.DoComplete()
at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(CommandProcessorBase commandRequestingUpstreamCommandsToStop)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
at System.Management.Automation.Runspaces.PipelineThread.WorkerProc()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Could you please update the Driver and check it. This seems more like a driver issue than the script. Still I would recommend you to try in some other 64bit system and see if it works. In that way, at least you would be able to narrow down the issue.
Hope it gives you a set off.
I have NO idea why this works, while the previous method failed, but this works
$id = Get-Credential "REMEDY\$($env:USERNAME)"
$userId = $id.UserName.split("\")[1].tolower()
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($id.password)
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
write-host "Running Query"
##### Start the database connection and set up environment
$DbString="DSN=AR System ODBC Data Source;UID=$userID;PWD=$password"
$DBConnection=New-Object System.Data.Odbc.OdbcConnection
$DBCommand=New-Object System.Data.Odbc.OdbcCommand
$DBConnection.ConnectionString=$DbString
$DBConnection.Open()
$DBCommand.Connection=$DBConnection
$SelectStatement="SELECT AuditTrail FROM HPD_HelpDesk WHERE AssignedToGroup='Group5'"
$DBCommand.CommandText=$SelectStatement
$DBResult=$DBCommand.ExecuteReader()
$UserTable=New-Object system.data.datatable
$UserTable.load($DBResult)
$UserTable
sleep 3
}
I would love an explanation for why this is the case, but at least its working :)

Error while loading PowerShell ISE. Unable to run cmdlets

When I try to open PowerShell in my server it shows below error on loading:
The following error occurred while loading the extended type data
file: Microsoft.PowerShell.Core, C
:\Windows\System32\WindowsPowerShell\v1.0\types.ps1xml: The file was
skipped because of the followin g validation exception: File
C:\Windows\System32\WindowsPowerShell\v1.0\types.ps1xml cannot be
loade d because its operation is blocked by software restriction
policies, such as those created by using Group Policy.. Errors
occurred while loading the format data file:
Microsoft.PowerShell.Core, , C:\Windows\System32
\WindowsPowerShell\v1.0\DotNetTypes.format.ps1xml: The file was
skipped because of the following val idation exception: File
C:\Windows\System32\WindowsPowerShell\v1.0\DotNetTypes.format.ps1xml
cannot be loaded because its operation is blocked by software
restriction policies, such as those created b y using Group Policy..
Errors occurred while loading the format data file:
Microsoft.PowerShell.Core, , C:\Windows\System32
\WindowsPowerShell\v1.0\FileSystem.format.ps1xml: The file was skipped
because of the following vali dation exception: File
C:\Windows\System32\WindowsPowerShell\v1.0\FileSystem.format.ps1xml
cannot be loaded because its operation is blocked by software
restriction policies, such as those created by using Group Policy..
Errors occurred while loading the format data file:
Microsoft.PowerShell.Core, , C:\Windows\System32
\WindowsPowerShell\v1.0\PowerShellCore.format.ps1xml: The file was
skipped because of the following validation exception: File
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShellCore.format.ps1xml
c annot be loaded because its operation is blocked by software
restriction policies, such as those cre ated by using Group Policy..
The 'set-variable' command was found in the module
'Microsoft.PowerShell.Utility', but the module could not be
loaded.For more information, run 'Import-Module
Microsoft.PowerShell.Utility'.At line:0 char:0
Rest of the logged in users are able to run scripts but i'm unable to.
When I try to run any cmdlet for example
write-host 'test'
I get an error like this
writeErrorStream : True Exception :
System.Management.Automation.CommandNotFoundException: The
'write-host' command was found in the module
'Microsoft.PowerShell.Utility', but the module could
not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'. --->
System.Management.Automation.CmdletInvocationException: File
C:\windows\system32\windowspowershell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psm1
cannot be loaded because its operation is
blocked by software restriction policies, such as those created by using Group Policy. --->
System.Management.Automation.PSSecurityException: File
C:\windows\system32\windowspowershell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psm1
cannot be loaded because its operation is
blocked by software restriction policies, such as those created by using Group Policy. --->
System.UnauthorizedAccessException: File
C:\windows\system32\windowspowershell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psm1
cannot be loaded because its operation is
blocked by software restriction policies, such as those created by using Group Policy.
--- End of inner exception stack trace ---
at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo
commandInfo, CommandOrigin origin, PSHost host)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.GetScriptInfoForFile(String
fileName, String& scriptName, Boolean checkExecutionPolicy)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo
parentModule, String fileName, String moduleBase, String prefix,
SessionState
ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean&
found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleNamedInManifest(PSModuleInfo
parentModule, ModuleSpecification moduleSpecification, String
moduleBase, Boolean searchModulePath, String prefix, SessionState ss, ImportModuleOptions options,
ManifestProcessingFlags manifestProcessingFlags, Boolean
loadTypesFiles, Boolean loadFormatFiles, Object privateData, Boolean& found, String shortModuleName)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(String
moduleManifestPath, ExternalScriptInfo scriptInfo, Hashtable data,
Hashtable
localizedData, ManifestProcessingFlags manifestProcessingFlags, Version version, Version requiredVersion,
Nullable1 requiredModuleGuid,
ImportModuleOptions& options, Boolean& containedErrors)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModuleManifest(ExternalScriptInfo
scriptInfo, ManifestProcessingFlags manifestProcessingFlags,
Version version, Version requiredVersion, Nullable1 requiredModuleGuid, ImportModuleOptions& options)
at Microsoft.PowerShell.Commands.ModuleCmdletBase.LoadModule(PSModuleInfo
parentModule, String fileName, String moduleBase, String prefix,
SessionState
ss, Object privateData, ImportModuleOptions& options, ManifestProcessingFlags manifestProcessingFlags, Boolean&
found, Boolean& moduleFileFound)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ImportModule_LocallyViaName(ImportModuleOptions
importModuleOptions, String name)
at Microsoft.PowerShell.Commands.ImportModuleCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable
input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace
rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1
input, PSDataCollection1 output, PSInvocationSettings
settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1
input, PSDataCollection1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.InvokeT
at System.Management.Automation.CommandDiscovery.AutoloadSpecifiedModule(String
moduleName, ExecutionContext context, SessionStateEntryVisibility
visibility, Exception& exception)
--- End of inner exception stack trace ---
at System.Management.Automation.CommandDiscovery.TryModuleAutoDiscovery(String
commandName, ExecutionContext context, String originalCommandName,
CommandOrigin commandOrigin, SearchResolutionOptions searchResolutionOptions, CommandTypes
commandTypes, Exception& lastError)
at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String
commandName, CommandTypes commandTypes, SearchResolutionOptions
searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String
commandName, CommandOrigin commandOrigin, Nullable1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String
command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor
pipe, CommandParameterInternal[] commandElements, CommandBaseAst
commandBaseAst,
CommandRedirection[] redirections, ExecutionContext context)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input,
Boolean ignoreInput, CommandParameterInternal[][] pipeElements,
CommandBaseAst[]
pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction6.Run(InterpretedFrame
frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame) TargetObject : write-host CategoryInfo :
ObjectNotFound: (write-host:String) [], CommandNotFoundException
FullyQualifiedErrorId : CouldNotAutoloadMatchingModule ErrorDetails
: InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 1
PipelineIterationInfo : {}
please suggest me a solution to overcome this error.
On the context, I can see that powershell is not able to load any of the default modules. Not only that but also it is failing to understand the ps1xml files.
This issue happens when a system is having some critical issue.
I believe you should do a system restore or you should try a deep scan using sfc.
Hope this helps you