A Modern bginfo solution – just a simple powershell script

Hey, I’ve been looking around for a bginfo solution. I tried the original one from sysinternal tools
but it always changes the background to “tile”, I don’t know why..
There are hotfixes out there but I don’t want a hotfix. I want a “real solution”

So I found this page.

So started with that, then I’ve worked further with it and now
it’s finally working as I want and the result is this:

So first, Download this script.
Link bginfo

Then just run the script either as a scheduled task or login script in GPO. No bginfo.exe is needed or anything extra.

If you want to change the information on the background, open the bginfo.ps1
then go to the
“#Writing info to the background” part, and then change what information that you want to use 🙂

And if you want to change the Background to be stretch instead of fit, you change this part, change the -style to stretch.

Another thing that is great is, if you want to force a background also, you change this part active, just take away the #

So that’s it

Good luck while using it

Thanks for all the good respons guys!

I saw in comments that you getting this error

I get this
WARNING: Failed to Exception calling “Save” with “2” argument(s): “A generic error occurred in GDI+.”

“Per Nell Grant’s Comment above, try changing the [string] $OutFile Parameter on Line 29, as follows.
[string] $OutFile= “$($env:temp)\BGInfo.bmp”,
[string] $OutFile=“$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”,”

So its changed on the updated version in the script now.

Thanks for helping out!

Have a great day!


35 Replies to “A Modern bginfo solution – just a simple powershell script”

  1. Fantastic alternative and works very well on Windows 10. Does not work on Windows 7 though. Any ideas on how to modify to work on both versions?


  2. Thanks for your efforts Pontus and for sharing!

    I’d like the option to locate the info to the lower-left of the desktop instead of top-right. Is that possible?

    Liked by 2 people

  3. There’s a few things that can go wrong here. 1) Your BMP save will try to save to the same file name every time the script runs. If the file already exists and it’s already set as the background, your save will fail with a generic GDI+ error. To fix that, you will need to make the $Outfile name unique every time it runs. 2) This does not work with multiple monitors where there is a combination of both landscape and portrait mode. This is because the script takes the entire resolution of the desktop and the ‘tallest’ y axis measurement brings the information off the screen. Perhaps messing with alignment could fix this. But generally this is not dynamic enough for crazy monitor setups, which seems to be more common these days.

    Still though, very cool script. I appreciate this at least being an option since BGinfo from SysInternals has its own silly limitations with resolution and scaling.


    1. aha that’s why,I always got that error, was trying to figure that, but didn´t solved it.

      Aha, think it will be hard to solve that issue, will think about it.

      Yes, got tired of bginfo in Sysinternals, register fixes need to get it to work properly.

      Thanks for everyone that uses this, feel free to improve it!



      1. for the $outfile, i used:
        [string] $OutFile= “$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”, to randomize it, and allow for multiple logins.

        What you may also want to introduce is a way to choose the “input background” as well, to start fresh if possible. I know you can set the background as it is, but if there is a default install, you should be using that background instead of re-writing the same


  4. Additionally, changed the info gathering to something I was able to use better:

    $systemInfo = ( .\systeminfo.exe )
    $memory = ( $systemInfo | Select-String ‘Total Physical Memory:’).ToString().Split(‘:’)[1].Trim()
    $osType = ( $systemInfo | Select-String ‘OS Name:’).ToString().Split(‘:’)[1].Trim()
    $osVersion = ( $systemInfo | Select-String ‘OS Version:’ )[0].ToString().Split(‘:’).Trim()[1]
    $BootTime = ( $systemInfo | Select-String ‘System Boot Time’ ).ToString().Substring(27)
    $domaincontroller = $env:LOGONSERVER.split(“\”)[2]

    $t = @”
    Server Computer Name : $env:COMPUTERNAME
    Currently logged on User : $env:USERNAME
    Logon Domain Controller : $domaincontroller
    Last System Start Time : $BootTime
    Total Memory count : $memory
    Total CPU core count : $env:NUMBER_OF_PROCESSORS
    Operating System Type: $osType
    Operating System Version : $osVersion
    Server Logon Domain : $env:USERDNSDOMAIN

    The extra spaces cleaned up the view when it is placed on the desktop.


  5. The script is great.

    I found these useful additions:

    $BuildInfo =(Get-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion” -Name ReleaseId).ReleaseId
    $IPAddress =(Get-NetIPAddress -AddressFamily ipV4 | Where-Object {$_.IPAddress -notlike ‘127.0.*’} | Select -expandproperty IPAddress)
    $ServiceTag =(Get-WmiObject Win32_BIOS | Select -expandproperty SerialNumber)

    $t = @”

    Host Name: $env:COMPUTERNAME
    Service Tag: $ServiceTag
    IP Adress: $IPAddress
    User Name: $env:USERNAME
    Logon Domain: $env:USERDNSDOMAIN
    Logon Server: $env:LOGONSERVER
    OS Version: $OSVersion
    Build Info: $BuildInfo


    1. Thank you for posting, Eric.

      Unfortunately, I ran into an unforeseen problem w/ your Script.
      In most circumstances, your script updates should work, as intended.

      However, I have several NordVPN Adapters, which contain an APIPA Address (169.254.X.X), when the VPN is Deactivated.

      As a result, Four IP Addresses were Listed (,,,

      I ended up making a small update to the IP Address portion of your Script, to display only the working IP Address (

      $IPAddress = (Get-NetIPAddress -AddressFamily ipV4 | Where-Object {$_.IPAddress -notlike ‘127.0.*’} | Select -expandproperty IPAddress)

      $IPAddress = (Get-NetIPAddress -AddressFamily ipV4 | Where-Object {$_.IPAddress -notlike ‘127.0.*’ -and $_.IPAddress -notlike ‘169.254.*’} | Select -expandproperty IPAddress)

      $t = @”
      IP Address: $IPAddress

      On a related note, there may be instances where you want to display an APIPA Address, since they are a good indicator of DHCP related Issues, etc.

      Therefore, I thought I’d share an alternative method of acquiring the IP Address.

      $IPAddress = ( Get-NetIPConfiguration | Where-Object { $_.IPv4DefaultGateway -ne $null -and $_.NetAdapter.Status -ne “Disconnected” } ).IPv4Address.IPAddress

      $t = @”
      IP Address: $IPAddress

      Thanks again!


  6. I have the script working how I want it. But every time I run it, the text is cut off by the edge of the screen. The script never changes the background settings from fill to stretch. Any ideas on how to get the text info to align correctly at the top right of the screen?


    1. Depends which background you are using, if you have windows original it should work, if you have a corporate background try to make it as windows background in size


  7. AVERTISSEMENT : Failed to Exception lors de l’appel de « Save » avec « 2 » argument(s) : « Une erreur générique s’est produite dans GDI+. »

    Any way to fix this ?


    1. Per Nell Grant’s Comment above, try changing the [string] $OutFile Parameter on Line 29, as follows.

      [string] $OutFile= “$($env:temp)\BGInfo.bmp”,

      [string] $OutFile=“$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”,

      Hope that helps.


    1. Hello Gearlos,

      As “Nell Grant” pointed out above, the [string]$OutFile Parameter (on Line 29) needs to be Updated, to Randomize the File Name, thereby allowing Multiple Logins, etc.

      [string] $OutFile= “$($env:temp)\BGInfo.bmp”,

      [string] $OutFile=“$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”,

      Give that a try and see if it resolves your issue.


  8. Hello,

    I am using this opportunity to write that this is very simple and good alternative to bginfo. I was using it for couple of months without issues but after september/october update 2020, script can not be run (Powershell has stopped working error).

    Detailed error: Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    Have anyone experienced the same type of error?


  9. Getting this message when running

    WARNING: Failed cannot find the current wallpaper C:\Users\UserAccount\AppData\Local\Temp\BGInfo.bmp


  10. Maybe not enough coffee this morning but testing this out and one issue I have is running this at login with scheduled task and the first time it sets the info, I have the wallpaper #out since I don’t want to change it on the user. Works great, but the 2nd time they restart and login the info is over writing the old start time, so you end up with text on top of text but just for system boot time, what am I doing wrong?

    #Gather information

    $systemInfo = ( systeminfo )

    $BootTime = ( $systemInfo | Select-String ‘System Boot Time’ ).ToString().Substring(27)

    $BuildInfo =(Get-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion” -Name ReleaseId).ReleaseId
    $IPAddress = (Get-NetIPAddress -AddressFamily ipV4 | Where-Object {$_.IPAddress -notlike ‘127.0.*’ -and $_.IPAddress -notlike ‘169.254.*’} | Select -expandproperty IPAddress)

    #Writing info to the background
    $t = @”
    Computername: $env:COMPUTERNAME
    Username: $env:USERNAME
    Build Info: $BuildInfo
    System Start Time : $Boottime
    IP Address: $IPAddress

    #Format etc
    $BGHT = @{
    Text = $t;
    Theme = “Current” ;
    FontName = “Segoe UI” ;
    UseCurrentWallpaperAsSource = $true ;

    $WallPaper = New-BGinfo @BGHT

    #Runing the function
    Set-Wallpaper -Path $WallPaper.FullName -Style stretch


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s