Hey, I’ve been looking around for a bginfo solution. I tried the original one from sysinternal tools
https://docs.microsoft.com/en-us/sysinternals/downloads/bginfo
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.
https://p0w3rsh3ll.wordpress.com/2014/08/29/poc-tatoo-the-background-of-your-virtual-machines/
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
Pontus
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.
Before:
[string] $OutFile= “$($env:temp)\BGInfo.bmp”,
After:
[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!
Pontus
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?
LikeLike
Thanks! Hmm thinks some commands is needed by Powershell5, thats why it doesnt work, havent tried tho. Can try to get it work👍
LikeLike
Yea if this could work on win 7 it would be amazing, really solve my bginfo issue
LikeLike
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?
LikeLiked by 2 people
Would also love to know how to change the position of this. Great script!
LikeLiked by 1 person
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.
LikeLike
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!
Cheers.
LikeLike
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
LikeLike
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.
LikeLike
Thanks Neil, Hope you liked it!
LikeLike
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
“@
LikeLike
Thanks Eric, Glad you liked it!
LikeLike
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 (169.254.43.40, 169.254.30.3, 192.168.1.127, 169.254.57.70).
I ended up making a small update to the IP Address portion of your Script, to display only the working IP Address (192.168.1.127).
Before:
$IPAddress = (Get-NetIPAddress -AddressFamily ipV4 | Where-Object {$_.IPAddress -notlike ‘127.0.*’} | Select -expandproperty IPAddress)
After:
$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!
LikeLike
Ah good! yes you can customize is how you want, thats the best part! 🙂
LikeLike
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?
LikeLike
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
Pontus
LikeLike
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 ?
LikeLike
Per Nell Grant’s Comment above, try changing the [string] $OutFile Parameter on Line 29, as follows.
Before:
[string] $OutFile= “$($env:temp)\BGInfo.bmp”,
After:
[string] $OutFile=“$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”,
Hope that helps.
LikeLike
Changed the script now, thanks for helping out !
LikeLike
Hi, try to download the new version of the script, should work
Pontus
LikeLike
I get this
WARNING: Failed to Exception calling “Save” with “2” argument(s): “A generic error occurred in GDI+.”
LikeLike
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.
Before:
[string] $OutFile= “$($env:temp)\BGInfo.bmp”,
After:
[string] $OutFile=“$($env:temp)\” + ( ( get-date ).TimeOfDay.TotalSeconds ) + “BGInfo.bmp”,
Give that a try and see if it resolves your issue.
LikeLike
Added in script! thanks!
LikeLike
Try download the new version of the script
Pontus
LikeLike
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?
LikeLike
Ive been running on october patches, with no problem, Which windows version are you using excactly?
Pontus
LikeLike
I forgot to mention that this is happening on Windows 10 OS.
LikeLike
Getting this message when running
WARNING: Failed cannot find the current wallpaper C:\Users\UserAccount\AppData\Local\Temp\BGInfo.bmp
LikeLike
Never seen that, try make a new profile and then run again /pontus
LikeLike
Pontus (and the rest)… thx for a great script! Just what I was searching for 🙂
LikeLike
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
LikeLike
I am having the same issue when the IP Address changes
LikeLike
Line 265, you need to enable “Set-Wallpaper” and set the source image.
LikeLike
The point of it is to not have any wallpaper over write, issue is there no matter. I actually ended up ditching the whole putting into on the desk top and instead created a little info box that runs in the task area
https://pastebin.com/J2V5V9P4
LikeLike