Deploying Win32 app BGInfo with Intune

Deploying the well known Sysinternals tool BGInfo is popular since a very long time. Often people use it for more visibility of vital OS parameter to end users. It is used mostly to support in-house help desk personal. Today I’m using this approach, to provide a handy solution for your development or test environment to quickly identify your devices and logged on user including their permissions (local admin or standard user) in that session like this:

The undiscovered need for this was there all the time, e.g. during intensive testing in my development environments with a lot of virtual test devices and during class room training’s to make student life’s easier. I often test various features so Windows Version and Edition is important to know for me. As a nice addition I added the local permissions of the logged on user. Following an user logged on to an Autopilot device with standard user permission and a device without Autopilot and local administrator permissions:

Now you know my intention for this blog post. I was inspired by Nick Hogarth blog post (Intune – Win32 app Deploying BGInfo) about this and re-discovered my need 🙂 and took his solution and developed it a little further for my needs (thanks Nick!). I can recommend to read his blog as well as he has a nice walk through how to create and upload the Intunewin package for Intune and trace the installation itself. Like Nick I only focus on the x64 Edition of BGInfo64 as I’m not dealing with x86 devices for a long time now.

First I had to came up with a way to identify if the user is a local admin. BGInfo supports various ways to get OS information and one option is to use vbs scripts. So I wrote a short vbs script to verify local Administrators group membership. To handle this in a way to be language independent I’m resolving the local Administrators group SID S-1-5-32-544 (read about well known SIDs here) to the localized display name to finally enumerate account membership.

The vbs script is dynamically written by the install script as CheckAdmin.vbs to the BGInfo install folder (C:\Program Files\BGInfo) during install. This way I do not have to maintain several files, only my install script. I followed the same way and created an install.ps1 to install BGInfo64.exe with the custom background information file custom.bgi. In addition I modified the startup shortcut creation to create the shortcut with the ActiveX object WScript.Shell in the PowerShell install script. The startup shortcut is needed to always have actual information on the background. Following the complete install.ps1:

As always when dealing with Intune Win32 apps we need to package it as .intunewin and upload the package to Intune. Use the Packaging tool from here: https://github.com/Microsoft/Intune-Win32-App-Packaging-Tool. The complete conversion can be done in an one liner when the conversion tool is in the same folder structure level as the BGInfo folder with all needed files:

As the detection rule we use a simple file exists for BGInfo64.exe in the install folder:

C:\Program Files\BGInfo
Bginfo64.exe

Finally you can assign it to your devices or users. I assigned it to all my devices as I like to have it on all my test devices:

If successfully installed you should see the following files:

Because it is installed in System context we need to logon once to trigger the startup shortcut to finally execute BGInfo in user context and create the background information. If everything runs fine you should get nice information about the device you are currently using and in which context you are running (admin or user permission).

I hope it may help you as it helps me and gives you an idea how to dynamically get OS parameters for BGInfo and display them.

Post navigation

13 replies to Deploying Win32 app BGInfo with Intune

Hi Oliver,
Some strange thing is happening or i just plain dont understand 🙂
I create a folder BGInfo with all files in it, the setup and the ps1 script.
When i run IntuneWinAppUtil and enter the source folder, setup file and output the intunewin file get’s created OK.
When i open the intunewin file with 7zip and look into the Content folder i only see the bginfo setup file and the ps1 files are missing, is this expected behaviour ?

Hey RKast,
the content is archived two times within the content folder there is also a .intunwin file. This intunewin file is encrypted with the encryption key information from the detection.xml file from the folder metadata. So what you see is totally normal all files are archived and encrypted into a .intunewin, then the folder structure with content and metadata is created and all this in archived agein to a .intunewin. For a detailed analysis look at the post https://oliverkieselbach.com/2019/01/03/how-to-decode-intune-win32-app-packages/ there I described the process in detail in the beginning.
best,
Oliver

Oh my god and shame on me.
Due to truncation of the 7zip window i indeed did not see all the files 😦 and the intunewin file in the intunewin file 🙂 had the same name as the installer so missed the extension.
Should have stayed in bed today…
But the installer failed so i presumed files were missing.
I owe you a beer 😉

It is basically the folder where the script itself is stored. In this case the .intunewin from the content folder gets transferred to the client decrypted and extracted to the cache folder of the SideCar. So basically in that cache folder the bginfo64.exe, custom.bgi, install.ps1 and uninstall.ps1 is then in that folder. $PSScriptRoot references then to this folder. 👍

Hi Oliver, I’m looking to deploy this via Intune but seem to be struggling. I can create the intunewin file and it deplys as expected however I am missing certain information and get a specific error when checking the custom.bgi config settings

I get
COMPUTERNAME
Microsoft Windows 10 Pro
10.0.18363

Firstname.Lastname ()

I seem to be missing the build number and the user type – The error I get when opening the custom.bgi file in C:\Program Files\BGInfo is

I think something went wrong during install. The install.ps1 (https://github.com/okieselbach/Intune/blob/master/Win32/BGInfo64/install.ps1) will create a CheckAdmin.vbs file here: C:\Program Files\BGInfo\CheckAdmin.vbs. I guess this failed due to whatever reason. Can you check and make sure that the install.ps1 is successful in creating all the necessary files under C:\Program Files\BGInfo. Have a look for BGInfo.exe, custom.bgi and CheckAdmin.vbs

I just wanted to let you know that I had the same issue as Nathan. I found that if I opened the VBS file that the powershell script creates in notepad, I can copy all of the text in to a new VBS file and then replace the old VBS file with the copy. This seems to resolve the issue. I wonder if the powershell script is adding some hidden character to the start of the VBS file it creates.