question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure PowerShell task (4.159.2) fails if c:\modules is not present

See original GitHub issue

Required Information

Entering this information will route you directly to the right team and expedite traction.

Type: Bug

Enter Task Name: Azure PowerShell@4 (version 4.159.2)

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

  • Server - Azure Pipelines or TFS on-premises?

    • If using TFS on-premises, provide the version:

    • If using Azure Pipelines, provide the account name, team project name, build definition name/build number: Account name: grd-wdx Project name: Projects-Cloud Release definition: RASW playground

  • Agent - Hosted or Private: Private

Agent version: 2.140.0 OS: Windows

Issue Description

During initialization of the Azure PowerShell task it fails with “Get-ChildItem : Cannot find path ‘C:\Modules’ because it does not exist.”

Workaround

Creating an empty c:\modules folder can be used as a workaround.

Task logs

2019-10-23T08:50:04.5259654Z ##[debug]STDERR: Get-ChildItem : Cannot find path 'C:\Modules' because it does not exist.
2019-10-23T08:50:04.5291853Z ##[debug]STDERR: At E:\VSTS\_work\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\4.159.2\Utility.ps1:66 char:26
2019-10-23T08:50:04.5318756Z ##[debug]
2019-10-23T08:50:04.5355020Z ##[debug]STDERR: + ... leFolders = Get-ChildItem -Directory -Path $($env:SystemDrive + "\Mod ...
2019-10-23T08:50:04.5375666Z ##[debug]
2019-10-23T08:50:04.5407368Z ##[debug]STDERR: +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-10-23T08:50:04.5427784Z ##[debug]
2019-10-23T08:50:04.5460032Z ##[debug]STDERR:     + CategoryInfo          : ObjectNotFound: (C:\Modules:String) [Get-ChildItem], ItemNotFoundException
2019-10-23T08:50:04.5478706Z ##[debug]
2019-10-23T08:50:04.5511742Z ##[debug]STDERR:     + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
2019-10-23T08:50:04.5533434Z ##[debug]
2019-10-23T08:50:04.5565113Z ##[debug]STDERR:  
2019-10-23T08:50:04.5583167Z ##[debug]
2019-10-23T08:50:04.5930268Z ##[error]Get-ChildItem : Cannot find path 'C:\Modules' because it does not exist.
At E:\VSTS\_work\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\4.159.2\Utility.ps1:66 char:26

+ ... leFolders = Get-ChildItem -Directory -Path $($env:SystemDrive + "\Mod ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (C:\Modules:String) [Get-ChildItem], ItemNotFoundException

    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
2019-10-23T08:50:04.5940533Z ##[debug]Processed: ##vso[task.logissue type=error]Get-ChildItem : Cannot find path 'C:\Modules' because it does not exist.%0D%0AAt E:\VSTS\_work\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\4.159.2\Utility.ps1:66 char:26%0D%0A%0D%0A+ ... leFolders = Get-ChildItem -Directory -Path $($env:SystemDrive + "\Mod ...%0D%0A%0D%0A+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0D%0A%0D%0A    + CategoryInfo          : ObjectNotFound: (C:\Modules:String) [Get-ChildItem%5D, ItemNotFoundException%0D%0A%0D%0A    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
niadakcommented, Oct 24, 2019

We have fixed this issue. Can you try and let us know if you are still facing the issue?

0reactions
brwilkinsoncommented, Oct 24, 2019

Thanks @niadak all good now, much appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure PowerShell 4.159.2 treats preview modules messages ...
Using preview packages in a PowerShell script, for example "az extension add --name application-insights" generates a warning message, v4.159.2 of Azure ...
Read more >
Azure Release Pipeline Powershell Task Fails - Stack Overflow
The 'Start-AzDataFactoryV2IntegrationRuntime' command was found in the module 'Az.DataFactory', but the module could not be loaded. For more ...
Read more >
AzurePowerShell@5 - Azure PowerShell v5 task
Run a PowerShell script within an Azure environment. ... This issue occurs when the PowerShell module is not available on the Hosted Agent....
Read more >
Running PowerShell Scripts in Azure DevOps Pipelines (2 of 2)
When the PowerShell task encounters an error, it may or may not fail the task in the pipeline. If you have a script...
Read more >
In-Depth Guide to Building a PowerShell Pipeline in Azure ...
You don't have to create a script ahead of time to run PowerShell or Bash code. Instead, you can insert the code directly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found