Project

General

Profile

Actions

Bug #14449

open

We can not execute powershell command using $_ variable

Added by Félix DALLIDET about 5 years ago. Updated 1 day ago.

Status:
New
Priority:
N/A
Assignee:
-
Category:
Generic methods
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Priority:
0
Name check:
Fix check:
Regression:

Description

When we write a command powershell to a parameter in the technique editor or in the directives using a $_ variable like in :
(Get-ItemProperty 'Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' | where-object { $_.DisplayName -eq "Rudder agent (DSC)" } )

It will fail on the agent. The complete string will end up under double quotes BUT, in powershell, the $_ sign is interpreted before assignment if enclosed in double quotes. Resulting in an unusable command line.
see: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-6

Dirty solution would be to let the user make the escape of the $ sign, but this is not possible since it needs a ` char which will automatically be escaped with another ` by Rudder.

I have no idea of what the correct solution is. Since the user should not know that a backquote is needed before its $ sign in this specific case (depends on the code).

Actions #1

Updated by Félix DALLIDET about 5 years ago

Using single quote layout string can not solve the problem since it will prevents variable affectation.

Actions #2

Updated by Vincent MEMBRÉ about 5 years ago

  • Target version changed from 5.0.9 to 5.0.10
Actions #3

Updated by Vincent MEMBRÉ almost 5 years ago

  • Target version changed from 5.0.10 to 5.0.11
Actions #4

Updated by Vincent MEMBRÉ almost 5 years ago

  • Target version changed from 5.0.11 to 5.0.12
Actions #5

Updated by Vincent MEMBRÉ almost 5 years ago

  • Target version changed from 5.0.12 to 5.0.13
Actions #6

Updated by Alexis Mousset almost 5 years ago

  • Category set to Generic methods
Actions #7

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 5.0.13 to 5.0.14
Actions #8

Updated by François ARMAND over 4 years ago

  • User visibility set to Operational - other Techniques | Rudder settings | Plugins
  • Priority changed from 0 to 48

A possible workaround for now is to be able to write such command in a script file.

Actions #9

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 5.0.14 to 5.0.15
  • Priority changed from 48 to 47
Actions #10

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 5.0.15 to 5.0.16
  • Priority changed from 47 to 45
Actions #11

Updated by Alexis Mousset about 4 years ago

  • Target version changed from 5.0.16 to 5.0.17
  • Priority changed from 45 to 44
Actions #12

Updated by Vincent MEMBRÉ about 4 years ago

  • Target version changed from 5.0.17 to 5.0.18
  • Priority changed from 44 to 43
Actions #13

Updated by Vincent MEMBRÉ almost 4 years ago

  • Target version changed from 5.0.18 to 5.0.19
Actions #14

Updated by Vincent MEMBRÉ over 3 years ago

  • Target version changed from 5.0.19 to 5.0.20
Actions #15

Updated by Vincent MEMBRÉ over 3 years ago

  • Target version changed from 5.0.20 to 797
Actions #16

Updated by Benoît PECCATTE almost 3 years ago

  • Target version changed from 797 to 6.1.14
Actions #17

Updated by Vincent MEMBRÉ almost 3 years ago

  • Target version changed from 6.1.14 to 6.1.15
Actions #18

Updated by Vincent MEMBRÉ almost 3 years ago

  • Target version changed from 6.1.15 to 6.1.16
Actions #19

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.16 to 6.1.17
Actions #20

Updated by Benoît PECCATTE over 2 years ago

  • Project changed from 41 to Rudder
  • Category changed from Generic methods to Generic methods
Actions #21

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.17 to 6.1.18
Actions #22

Updated by Vincent MEMBRÉ over 2 years ago

  • Target version changed from 6.1.18 to 6.1.19
Actions #23

Updated by Vincent MEMBRÉ about 2 years ago

  • Target version changed from 6.1.19 to 6.1.20
  • Priority changed from 43 to 44
Actions #24

Updated by Vincent MEMBRÉ almost 2 years ago

  • Target version changed from 6.1.20 to 6.1.21
Actions #25

Updated by Vincent MEMBRÉ almost 2 years ago

  • Target version changed from 6.1.21 to old 6.1 issues to relocate
Actions #26

Updated by Alexis Mousset 1 day ago

  • Target version changed from old 6.1 issues to relocate to 7.3.15
  • Priority changed from 44 to 0
Actions

Also available in: Atom PDF