AnsweredAssumed Answered

Passing Parameters into Powershell Script

Question asked by ElwynnMartin on Feb 4, 2016
Latest reply on May 30, 2017 by j.barger

I'm trying to pass a 'Process.' variable into PowerShell script using the parameters built into the Run Script operator but without an success.

Below is what I currently have in the Inline Script box:

 

param([string]$var1);

Get-ChildItem -Path \\%%%source path%%% -Recurse | Where-Object {$_.Name -Like "*$var1"} | Move-Item -Destination \\%%%destination path%%%

 

Is there a less verbose way to pass that variable into the Where-Object?

 

I was reading the documentation here and liked the concept at the bottom of just using '%1' but haven't had any luck getting that to work.

https://docops.ca.com/display/CATPA422/Run+Script+Operator

 

I also found a post in the community but it didn't have an code samples

ITPAM and PowerShell

 

Any thougts or suggestions on how to streamline passing in variables?

 

Outcomes