Bug #14449
openWe can not execute powershell command using $_ variable
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).
Updated by Félix DALLIDET almost 6 years ago
Using single quote layout string can not solve the problem since it will prevents variable affectation.
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.9 to 5.0.10
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.10 to 5.0.11
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.11 to 5.0.12
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.12 to 5.0.13
Updated by Vincent MEMBRÉ over 5 years ago
- Target version changed from 5.0.13 to 5.0.14
Updated by François ARMAND over 5 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.
Updated by Vincent MEMBRÉ about 5 years ago
- Target version changed from 5.0.14 to 5.0.15
- Priority changed from 48 to 47
Updated by Vincent MEMBRÉ about 5 years ago
- Target version changed from 5.0.15 to 5.0.16
- Priority changed from 47 to 45
Updated by Alexis Mousset almost 5 years ago
- Target version changed from 5.0.16 to 5.0.17
- Priority changed from 45 to 44
Updated by Vincent MEMBRÉ over 4 years ago
- Target version changed from 5.0.17 to 5.0.18
- Priority changed from 44 to 43
Updated by Vincent MEMBRÉ over 4 years ago
- Target version changed from 5.0.18 to 5.0.19
Updated by Vincent MEMBRÉ over 4 years ago
- Target version changed from 5.0.19 to 5.0.20
Updated by Vincent MEMBRÉ about 4 years ago
- Target version changed from 5.0.20 to 797
Updated by Benoît PECCATTE over 3 years ago
- Target version changed from 797 to 6.1.14
Updated by Vincent MEMBRÉ over 3 years ago
- Target version changed from 6.1.14 to 6.1.15
Updated by Vincent MEMBRÉ over 3 years ago
- Target version changed from 6.1.15 to 6.1.16
Updated by Vincent MEMBRÉ over 3 years ago
- Target version changed from 6.1.16 to 6.1.17
Updated by Benoît PECCATTE about 3 years ago
- Project changed from 41 to Rudder
- Category changed from Generic methods to Generic methods
Updated by Vincent MEMBRÉ about 3 years ago
- Target version changed from 6.1.17 to 6.1.18
Updated by Vincent MEMBRÉ about 3 years ago
- Target version changed from 6.1.18 to 6.1.19
Updated by Vincent MEMBRÉ over 2 years ago
- Target version changed from 6.1.19 to 6.1.20
- Priority changed from 43 to 44
Updated by Vincent MEMBRÉ over 2 years ago
- Target version changed from 6.1.20 to 6.1.21
Updated by Vincent MEMBRÉ over 2 years ago
- Target version changed from 6.1.21 to old 6.1 issues to relocate
Updated by Alexis Mousset 8 months ago
- Target version changed from old 6.1 issues to relocate to 7.3.15
- Priority changed from 44 to 0
Updated by Vincent MEMBRÉ 7 months ago
- Target version changed from 7.3.15 to 7.3.16
Updated by Vincent MEMBRÉ 6 months ago
- Target version changed from 7.3.16 to 7.3.17