Get command arguments in Powershell scripts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get command arguments in Powershell scripts

L3 Networker

Hi all

 

I'm trying to get Command-Arguments in a self-made script in Powershell.

 

On Python it is:
demisto.args().get('<command-argument>')

 

What is it in Powershell? Because I tried it with:
$demisto.Args()["<command-argument>"]

But this didn't worked on my self-made script. 

 

(Cortex XSOAR Version: 6.0.2 Build: 94597)

 

Thanks

roger

 

1 accepted solution

Accepted Solutions

L4 Transporter

You can get the args passed in like this:

 

$value = $demisto.Args().value

$demisto.Results($value)

 

If you create a new automation script, and switch the type to Powershell, there is some example code provided.

View solution in original post

4 REPLIES 4

L4 Transporter

You can get the args passed in like this:

 

$value = $demisto.Args().value

$demisto.Results($value)

 

If you create a new automation script, and switch the type to Powershell, there is some example code provided.

Thank you MBeauchamp

 

That helped me. My script is now runinng 🙂

 

cheers

roger

L0 Member

Well, maybe it is the age of the post, but the "there is some example code provided" does not show any sample code nor have any links, even if you click (multiple times) on "View solution in original post".  A real let down when the reply from the question asker is, "That helped me. My script is now running" (ok, "runinng") so don't come after me the spelling police.

L6 Presenter

I do not use Cortex, but I believe the above accepted response is meaning that when you go into Cortex and create a new automation script, selecting Powershell as the script type, some sample code will appear in the new automation script. The sample is not in the post above (except for the example variable definition).

 

See the Cortex Automations Playbook document on creating new scripts and the script helper page:

https://docs.paloaltonetworks.com/cortex/cortex-xsoar/6-6/cortex-xsoar-admin/playbooks/automations

https://xsoar.pan.dev/docs/concepts/xsoar-ide#the-script-helper

 

 

  • 1 accepted solution
  • 4021 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!