Jump to content

Protect cloud task-run command issue


jxtemp
 Share

Recommended Posts

    I want use 'run command' tast to  install the.exe program. currently, only simple commands can be executed. How do I run powershell commands that include conditions and have multiple quotes like the following?  thanks.

"$installed = $null 
$Application = "ABC"
$installed = Get-WMIObject -Query "SELECT * FROM Win32_Product Where Vendor Like '%$Application%'"
if(!$installed) {
$Arguments = @(
    "AP_ID=7eXXXe-XXXxx"
    "/install"
    "/quiet"
    "/norestart"
)
Start-Process "./ABC.exe" -ArgumentList $Arguments -Wait -NoNewWindow 
Write-Host "$Application was Installed Successfully"
} else{
Write-Host "$Application Already Installed: $installed"
}"
 

eset_RunCommd.png

Link to comment
Share on other sites

  • ESET Staff

I would recommend to test locally to find out how to adapt it - what happens when task is executed is that standard BAT file is created with content of task configuration (with some pretty standard encoding-related commands in the beginning), so it is crucial to find out how such BAT file can be created. There are definitely few special characters that has to be escaped to be used in BAT file, for example "%" and possibly also "!".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...