Error when trying to run powershell workflow/parallel foreach

Hi

I have been freaking out with google trying to find answer, but come up null. I hope someone on here maybe able to shed some light on the problem I am getting.

When we try to run a powershell workflow we get the error below.

Cannot find drive. A drive with the name ‘SQLSERVER’ does not exist.
11:47:54Error
At line:392 char:25
11:47:54Error
+ Receive-Job -Job $job -Wait -Verbose -Debug -ErrorAction …
11:47:54Error
_+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~_
11:47:54Error
_ + CategoryInfo : ObjectNotFound: (SQLSERVER:String) [], ParentContainsErrorRecordException_
11:47:54Error
_ + FullyQualifiedErrorId : DriveNotFound_
11:47:54Error
_ + PSComputerName : [localhost]_
11:47:54Error
11:47:54Fatal
The remote script failed with exit code 1

Quick snip example of the code used to produce the error.

workflow pararunner
{
param ($instances)
foreach -parallel ($instance in $instances)
{
inlinescript
{
add-content -path C:\deploytemp\log.txt “in line started”
}
}
}
pararunner -instances $instances

I am hoping this is something really simple and that I have not set a system variable right.

Octopus.Action.PowerShell.ExecuteWithoutProfile is set to true, which is the var which I thought would be the fix. But I am quite new to Octopus Deploy and I may be setting its or calling it wrong…

Any help would be greatly appreciated.

Thanks for reading

Steve

Managed to sort this by setting the location back to C prior to calling the workflow run using the command

Set-Location C:\

Cheers
Steve

Hi Steve,

Thanks for the update here! I’m glad you found the problem. :slight_smile:

Please don’t hesitate to get in touch if you have any further questions or run into any issues.

Best regards,
Daniel