Power Shell (Invoke-command) command failing

Hi,

I have been using Power shell command through IEM template but new experience with one command invoke-command which is not running through this template I don’t know why,

Power Shell Command

Invoke-command {Get-ItemProperty “HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash*” | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize} >>c:\temp\abc1.txt

IEM Action Info

Fixlet Debugger

There are a lot of suggestions that can come out of this so I’ll start by answering your question and then try to guide you to an alternative.

The issue is that { } tells BigFix to do Relevance Substitution. This means that it will take anything in curly brackets and run it as relevance and replace the { } with the result. Your Invoke-Command { is the culprit. To avoid this simply escape the opening curly bracket with two curly brackets {{

Invoke-command {{Get-ItemProperty "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash*" | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize} >>c:\temp\abc1.txt

It looks like you’re using this template from somewhere? You don’t need to wrap your powershell in “invoke-command” at all, you can just run:

Get-ItemProperty "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash*" | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize >>c:\temp\abc1.txt

Now onto the real part. It seems like you’re working around BigFix instead of working with BigFix. It looks like you’re using powershell to query the registry, outputting the result to a file, and then potentially reading that file in with an analysis?

You can avoid all of this by learning and using relevance. To get the Display Name and Version of Adobe Flash we can use a relatively simple relevance string:

values "DisplayName" of keys "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash" of x32 registry

We can return multiple values like this:

(values "DisplayName" of it, values "DisplayVersion" of it, values "Publisher" of it, values "InstallDate" of it) of keys "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash" of x32 registry
2 Likes

Thanks a lot, that’s work with Get-ItemProperty,