Runas currentuser

Im trying to run a cmd using runas=currentuser, but i keeo getting a “Relevance substitution failed” error

simple action script:
override wait
hidden=false
runas=currentuser
wait cmd /c powershell.exe -ExecutionPolicy Bypass -command “$MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq ‘Virtru for Outlook’}”; $MyApp.Uninstall()

{ character on ActionScript is special - “Substitution” - https://developer.bigfix.com/action-script/guide/substitution.html

I’m not near my computer but you can replace { with {{ as an escape character.

Try the following example -
ActionScript Example:
folder create "C:\Temp"
delete "C:\Temp\ScriptName.ps1"
createfile until EOF
$MyApp = Get-WmiObject -Class Win32_Product | Where-Object{{$_.Name -eq ‘Virtru for Outlook’}”
$MyApp.Uninstall()
EOF
copy __createfile "C:\Temp\ScriptName.ps1"
parameter “PowerShellExe” = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
action uses wow64 redirection {not x64 of operating system}
override wait
hidden=false
runas=currentuser
wait {parameter “PowerShellExe”} -ExecutionPolicy Unrestricted -File “C:\Temp\ScriptName.ps1”

References:
https://developer.bigfix.com/action-script/reference/execution/action-uses-wow64-redirection.html

2 Likes

This Worked!!! Thank you!!

1 Like