- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
01-25-2021 06:31 AM
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.
Thanks
roger
01-25-2021 07:01 AM
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.
01-25-2021 07:01 AM
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.
01-26-2021 01:52 AM
Thank you MBeauchamp
That helped me. My script is now runinng 🙂
cheers
roger
08-24-2022 12:42 PM
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.
08-24-2022 03:09 PM - edited 08-24-2022 04:08 PM
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
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!