Azure PowerShell task (4.159.2) fails if c:\modules is not present
See original GitHub issueRequired 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:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
We have fixed this issue. Can you try and let us know if you are still facing the issue?
Thanks @niadak all good now, much appreciated.