Wildcard in script block generates ObjectNotFOund and CommandNotFoundException

book

Article ID: 103932

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio) CA Release Automation - DataManagement Server (Nolio)

Issue/Introduction

I am trying to execute the action: PowerShell - Run Script Block
with a wildcard in the Script Block field value.
Example of Script Block field value being used: .\partial*\path\with\wildcard\mytestps.1


Full Error:

The term '.\partial*\path\with\wildcard\mytest.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path as included, verify that the path is correct and try again. 

At C:\Users\Administrator\AppData\Local\Temp\tempz_4483325711476630141951.ps1:4 char:17 + .\partial*\path\with\wildcard\mytest.ps1 <<<< + CategoryInfo : ObjectNotFound: (.\partial*\path\with\wildcard\mytest.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Cause

​Per the tooltip, if you hover your mouse over "Script Block", it confirms that it was designed for accepting full path to whatever file you would like it to execute. 

Tooltip for Script Block: 
A PowerShell script-block (inline commands) to be run locally. i.e. get-date; write-host "hello" or Full path for a file. Please do NOT add curly braces {} to enclose the input. 
 

Environment

CA Release Automation 5.x and above
CA Release Automation Powershell Action Pack (nolio-microsoft-powershell-actions-10.8.1805.1.jar)
 

Resolution

Specify the Full path for executing a file (.ps1) in the script block field. 
Example of proper Script Block field value when pointing to a .ps1 script: C:\partial1\path\with\wildcard\mytest.ps1