Once DesktopManager was ready to get and set wallpaper, Imageplayground allowed me to modify wallpapers. I was prepared to create PowerBGInfo, an alternative to Sysinternals BGInfo made directly in PowerShell. I'll admit I've not spent ages testing this module regarding the placement of the text, which should probably be improved. The trick with Desktop Background is that your image is not always a direct fit to the resolution. That's why Microsoft added the ability to fit (aka set position) desktop background to current resolution using one of the options such as Center, Fit, Stretch, Fill, Span, or Tile. This means that while ImagePlayground can add text to the right bottom corner of the screen, or the top left corner of the screen without much of an issue, depending on the resolution and position of the wallpaper, it may hide PowerBGInfo content from the screen. You may want to play with it to understand the behavior. What I think could be a future solution is to create a new desktop background (and not reuse the existing one) that is a direct fit for the current screen resolution, but still, that would be different from server to server and the person using it. Let's dive into how to play with PowerBGInfo and achieve the desired results.
New-BGInfo -MonitorIndex 0 {
# Lets add computer name, but lets use builtin values for that
New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri'
New-BGInfoValue -BuiltinValue FullUserName
New-BGInfoValue -BuiltinValue CpuName
New-BGInfoValue -BuiltinValue CpuLogicalCores
New-BGInfoValue -BuiltinValue RAMSize
New-BGInfoValue -BuiltinValue RAMSpeed
# Lets add Label, but without any values, kinf of like section starting
New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri'
# Lets get all drives and their labels
foreach ($Disk in (Get-Disk)) {
$Volumes = $Disk | Get-Partition | Get-Volume
foreach ($V in $Volumes) {
New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining
}
}
} -FilePath $PSScriptRoot\Samples\PrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRoot\Output -PositionX 100 -PositionY 100 -WallpaperFit Center
What you see above is following my usual model of building PowerShell modules. There's a primary function called New-BGInfo, which then accepts nested commands New-BGInfoValue and New-BGInfoLabel. The central order you will want to use is New-BGInfoValue which has three main parameters. Those are Label, Value, and BuiltinValue. You can either use Label and Value and provide the name and value however you like, or you can use BuiltinValue, which has some built-in options to save time and effort to create it yourself. If you prefer, you can always use only built-in values, but there are not so many choices for now.
New-BGInfo -MonitorIndex 0 {
# Lets add computer name, but lets use builtin values for that
New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri'
New-BGInfoValue -BuiltinValue FullUserName -Color White
New-BGInfoValue -BuiltinValue CpuName -Color White
New-BGInfoValue -BuiltinValue CpuLogicalCores -Color White
New-BGInfoValue -BuiltinValue RAMSize -Color White
New-BGInfoValue -BuiltinValue RAMSpeed -Color White
} -FilePath "C:\Support\GitHub\PowerBGInfo\Examples\Samples\TapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRoot\Output -PositionX 75 -PositionY 75 -WallpaperFit Fill
Some parameters help style both the label and the value. You can use FontFamilyName, FontSize, or Color to style labels and values. If you want, you can also style value separately by using ValueFontFamilyName, ValueFontSize, and ValueColor.
New-BGInfo -MonitorIndex 0 {
# Lets add computer name, but lets use builtin values for that
New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri'
New-BGInfoValue -BuiltinValue FullUserName -Color White
New-BGInfoValue -BuiltinValue CpuName -Color White
New-BGInfoValue -BuiltinValue CpuLogicalCores -Color White -ValueColor Red
New-BGInfoValue -BuiltinValue RAMSize -Color White
New-BGInfoValue -BuiltinValue RAMSpeed -Color White -ValueColor ([SixLabors.ImageSharp.Color]::Aquamarine)
} -FilePath "C:\Support\GitHub\PowerBGInfo\Examples\Samples\TapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRoot\Output -PositionX 75 -PositionY 75 -WallpaperFit Fit
You can build your own BGInfo to set on your desktop or server with just three little functions, and you don't have to resort to using anything then a PowerShell module.