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.

PowerShell workflow default param string value shows error

See original GitHub issue

System Details

  • Operating system name and version: Windows 10 1607 x64
  • VS Code version: 1.11.1
  • PowerShell extension version: 12.2
  • Output from $PSVersionTable: (the code commands don’t have any output on my system?)
PS C:\> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
0      12     1      0

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14393.953
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.953
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

in powershell workflow, a string default parameter is showing an error saying it needs to be a “simple value” like an int or a string. and it is a string.

Attached Logs

image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
SeeminglySciencecommented, Jan 8, 2019

@dotps1 I know you’re probably not looking for an answer anymore, but it’s because the parameter is typed as a string array. Even though the default value specified in the script is a string, it would need to first be converted to an array for the typing to match. Workflows are compiled, so they tend to be a good deal more strict than normal PowerShell.

0reactions
robe070commented, Aug 1, 2020

@dotps1 Hi Thomas, do you debug Workflows in VS Code? Can you point me at any resources that can instruct me how to do it? Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

PowerShell Workflows: Restrictions - Scripting Blog
Updated value of A is: 3 The workflow starts by defining a variable, $a = 22, and then displaying its value. In an...
Read more >
Simplify Your PowerShell Script with Parameter Validation
Simply put, parameter validation is a means for Windows PowerShell to validate a parameter's value before the body of the script or function ......
Read more >
Handling Errors the PowerShell Way - Scripting Blog
When you use the -ErrorVariable parameter in a call to a command, the error is assigned to the variable name that you specify....
Read more >
about_ActivityCommonParameters - Microsoft Learn
Describes the parameters that Windows PowerShell Workflow adds to activities.
Read more >
Create and Use Default Values in PowerShell Scripts
The command and its associated error are shown in the following image. ... By using the Param statement and assigning a default value, ......
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