If you manage a large number of servers or workstations running Windows, sometimes it is useful to display basic information about the operating system and environment right on the Windows desktop. It will be especially convenient for your users if they connect the support and have to tell their IP or MAC address, computer or domain name, Windows version, memory size, CPU type, etc. Then they just need to look at their desktop. To show information about the operating system, hardware, and software environment on the desktop, we will use the BgInfo tool by Microsoft.
BgInfo allows to overlay text information over the user’s desktop wallpaper and replace the current wallpaper image.
Create a Bginfo Text Template to Display on the Desktop
First of all, you need to create a template file to be used by BgInfo to show information on a Windows desktop.
- Download the Bginfo (https://docs.microsoft.com/en-us/sysinternals/downloads/bginfo) and run the bginfo.exe;
- A default BgInfo configuration window appears. It contains a list of system information the tool displays by default;
- The BgInfo window is a simple text editor where you can add, remove, or edit any of the displayed values, change font color or size, select the screen position where to show the info, add your logo, etc;
- The values of the variables that BgInfo gets from an operating system are shown in the <Host name> format;
- I have created the following template displaying basic information about a computer and added support team contacts:
Device Info: Computer Name: <Host Name> Domain: <Machine Domain> Logon DC: <Logon Server> OS Version: <OS Version> User Name: <User Name> IP Address: <IP Address> Default Gateway: <Default Gateway> MAC Address: <MAC Address> System Info: Boot Time: <Boot Time> CPU: <CPU> Memory: <Memory> System Type: <System Type> ___________________________________ HelpDesk Team: +49-163-555-5555 [email protected] CRM Team: +49-163-555-5554 [email protected]
- Save the configuration to bg_config.bgi file.
Deploying BgInfo Config File to Workstations/Servers via GPO
Then create a new GPO (domain Group Policy Object) to apply the BgInfo configuration file to all domain computers and/or servers.
Create a Bginfo folder in SYSVOL on your domain controller and copy the bg_config.bgi and Bginfo.exe files to it.
Create apply_bginfo.bat script in the same folder. This file will be used to apply the BgInfo settings to a computer:
reg add HKEY_CURRENT_USER\Software\Sysinternals\BGInfo /v EulaAccepted /t REG_DWORD /d 1 /f
%logonserver%\NETLOGON\Bginfo\Bginfo.exe %logonserver%\NETLOGON\Bginfo\bg_config.bgi /silent /TIMER:00 /nolicprompt
- Open the Domain GPO editor (
gpmc.msc
), create a new Group Policy named bgInfoGPO and link it to the computers OU; - Switch to the GPO edit mode;
- Go to User Configuration -> Policies -> Windows Settings -> Scripts (Logon/Logoff) -> Logon -> Scripts -> Add and the UNC path to your script (for example,
\\woshub.loc\NETLOGON\Bginfo\apply_bginfo.bat
); - Enable the GPO loopback processing mode to apply the GPO to users: Computer Configuration –> Administrative Templates -> System -> Group Policy -> Configure user Group Policy loopback processing mode = Enabled (Merge);
- To apply the new Group Policy settings, you need to log on to the computer under a user account and make sure that the system information you configured is now shown on the desktop;
- Open the Domain GPO editor (
BgInfo copies the current desktop background to BGInfo.bmp to the user %Temp%
directory and puts your text on top of it. Then the file is set as the desktop wallpaper. However, if you set user desktop wallpaper using a domain GPO, note that the BgInfo policy must be applied after the wallpaper one. If needed, change the GPO links order.
Using VBS and PowerShell Scripts with BgInfo
BgInfo allows displaying not only preset parameters, but also any other computer, application, or Active Directory properties using WMI queries, VBS, or PowerShell scripts.
To add custom values to BgInfo, click Custom -> New.
The tool allows to display:
- A value of an environment variable
- A registry parameter value
- Results of a WMI query
- A file version
- A file contents
- Run a VBS script file
BgInfo even has a built-in WMI Explorer. For example, the following WMI query will display an operating system build on your desktop (it is especially relevant for Windows 10):
SELECT BuildNumber FROM Win32_OperatingSystem
The following VBS script will show computer model information on the desktop:
winmgt = "winmgmts:{impersonationLevel=impersonate}!//"
Set oWMI_Qeury_Result = GetObject(winmgt).InstancesOf("Win32_ComputerSystem")
For Each oItem In oWMI_Qeury_Result
Set oComputer = oItem
Next
If IsNull(oComputer.Model) Then
sComputerModel = "*no-name* model"
Else
If LCase(oComputer.Model) = "system product name" Then
sComputerModel = "Custom-built PC"
Else
sComputerModel = oComputer.Model
End If
End If
sComputer = Trim(sComputerModel)
Echo sComputer
Note that the value you want to see in BgInfo must be returned using Echo
by the VBS script.
Thus, using BgInfo you can display almost any information about a computer on the user desktop.