powershellbatch-fileoutlooksccm

How does one read a registry value using SCCM


We would like to be able to detect if a user is running either 32-Bit or 64-bit Outlook. Based on the returned value, we'll be running the appropriate script.

Using SCCM, how can we read the value "Bitness" from the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\16.0\Outlook

WHAT WE'VE TRIED
We tried running a .bat file containing the command REG QUERY HKLM\SOFTWARE\Microsoft\Office\16.0\Outlook /v "Bitness", but when run from an SCCM package, it cannot read values from any key.

We tried a Powershell Script, all I saw was the working directory briefly pop-up on the screen and the script stopped running.

QUESTION

Any workable solution not investing in some new piece of software is acceptable.


Solution

  • It turns out that I could do this with my old batch file, but I needed to add a flag.

    TWO SAMPLE COMMAND LINES THAT ARE IN A BATCH FILE THAT IS LAUNCHED FROM SCCM

    This one does NOT find the "Bitness" registry value.
    REG QUERY HKLM\SOFTWARE\Microsoft\Office\16.0\Outlook /v "Bitness"

    This works. I added "/reg:64 flag"
    REG QUERY HKLM\SOFTWARE\Microsoft\Office\16.0\Outlook /v "Bitness" /reg:64