Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Version: 1.0
Author: Oliver Kieselbach (
Date: 15.12.2018
Install BGInfo64 with custom background scheme where hostname and logged on user incl. membership (Admin|User) is shown.
It is especially usefull when dealing with virtual test environments where different devices, users, and different
Autopilot profiles are used. It enhanced viability of hostname, username and available permissions of the user.
Thanks to Nick Hogarth for inspiring me with his initial version. I basically extended his solution.
His version can be found here:
Release notes:
Version 1.0: Original published version.
The script is provided "AS IS" with no warranties.
New-Item -ItemType Directory -Force -Path "c:\Program Files\BGInfo" | Out-Null
#Start-BitsTransfer -Source "" -Destination "C:\Program Files\BGInfo"
Copy-Item -Path "$PSScriptRoot\Bginfo64.exe" -Destination "C:\Program Files\BGInfo\Bginfo64.exe"
Copy-Item -Path "$PSScriptRoot\custom.bgi" -Destination "C:\Program Files\BGInfo\custom.bgi"
$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\BGInfo.lnk")
$ShortCut.TargetPath="`"C:\Program Files\BGInfo\Bginfo64.exe`""
$ShortCut.Arguments="`"C:\Program Files\BGInfo\custom.bgi`" /timer:0 /silent /nolicprompt"
$ShortCut.IconLocation = "Bginfo64.exe, 0";
$CheckAdminScript = @"
Dim WshShell, colItems, objItem, objGroup, objUser
Dim strUser, strAdministratorsGroup, bAdmin
bAdmin = False
On Error Resume Next
Set WshShell = CreateObject("WScript.Shell")
strUser = WshShell.ExpandEnvironmentStrings("%Username%")
winmgt = "winmgmts:{impersonationLevel=impersonate}!//"
Set colItems = GetObject(winmgt).ExecQuery("Select Name from Win32_Group where SID='S-1-5-32-544'",,48)
For Each objItem in colItems
strAdministratorsGroup = objItem.Name
Set objGroup = GetObject("WinNT://./" & strAdministratorsGroup)
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
bAdmin = True
Exit For
End If
On Error Goto 0
If bAdmin Then
Echo "Admin"
Echo "User"
End If
$CheckAdminScript | Out-File -FilePath "C:\Program Files\BGInfo\CheckAdmin.vbs" -Encoding utf8 -Force -Confirm:$false
Return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment