Saturday, April 20, 2024
HomePowershellPowerBGInfo - PowerShell different to Sysinternals BGInfo

PowerBGInfo – PowerShell different to Sysinternals BGInfo


As soon as DesktopManager was able to get and set wallpaper, Imageplayground allowed me to change wallpapers. I used to be ready to create PowerBGInfo, an alternative choice to Sysinternals BGInfo made straight in PowerShell. I will admit I’ve not spent ages testing this module concerning the position of the textual content, which ought to most likely be improved. The trick with Desktop Background is that your picture will not be at all times a direct match to the decision. That is why Microsoft added the power to suit (aka set place) desktop background to present decision utilizing one of many choices resembling Heart, Match, Stretch, Fill, Span, or Tile. Because of this whereas ImagePlayground can add textual content to the precise backside nook of the display screen, or the highest left nook of the display screen with out a lot of a problem, relying on the decision and place of the wallpaper, it might conceal PowerBGInfo content material from the display screen. Chances are you’ll wish to play with it to know the habits. What I believe might be a future resolution is to create a brand new desktop background (and never reuse the present one) that could be a direct match for the present display screen decision, however nonetheless, that will be completely different from server to server and the individual utilizing it. Let’s dive into easy methods to play with PowerBGInfo and obtain the specified outcomes.

New-BGInfo -MonitorIndex 0 {
    # Lets add laptop identify, however lets use builtin values for that
    New-BGInfoValue -BuiltinValue HostName -Colour Pink -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, however with none values, kinf of like part beginning
    New-BGInfoLabel -Title "Drives" -Colour LemonChiffon -FontSize 16 -FontFamilyName 'Calibri'

    # Lets get all drives and their labels
    foreach ($Disk in (Get-Disk)) {
        $Volumes = $Disk | Get-Partition | Get-Quantity
        foreach ($V in $Volumes) {
            New-BGInfoValue -Title "Drive $($V.DriveLetter)" -Worth $V.SizeRemaining
        }
    }
} -FilePath $PSScriptRootSamplesPrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRootOutput -PositionX 100 -PositionY 100 -WallpaperFit Heart

What you see above is following my ordinary mannequin of constructing PowerShell modules. There is a main perform known as New-BGInfo, which then accepts nested instructions New-BGInfoValue and New-BGInfoLabel. The central order it would be best to use is New-BGInfoValue which has three predominant parameters. These are Label, Worth, and BuiltinValue. You’ll be able to both use Label and Worth and supply the identify and worth nevertheless you want, or you need to use BuiltinValue, which has some built-in choices to save lots of effort and time to create it your self. In the event you want, you may at all times use solely built-in values, however there usually are not so many decisions for now.

New-BGInfo -MonitorIndex 0 {
    # Lets add laptop identify, however lets use builtin values for that
    New-BGInfoValue -BuiltinValue HostName -Colour Pink -FontSize 20 -FontFamilyName 'Calibri'
    New-BGInfoValue -BuiltinValue FullUserName -Colour White
    New-BGInfoValue -BuiltinValue CpuName -Colour White
    New-BGInfoValue -BuiltinValue CpuLogicalCores -Colour White
    New-BGInfoValue -BuiltinValue RAMSize -Colour White
    New-BGInfoValue -BuiltinValue RAMSpeed -Colour White
} -FilePath "C:SupportGitHubPowerBGInfoExamplesSamplesTapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRootOutput -PositionX 75 -PositionY 75 -WallpaperFit Fill

Some parameters assist fashion each the label and the worth. You should utilize FontFamilyName, FontSize, or Colour to fashion labels and values. If you’d like, you may also fashion worth individually through the use of ValueFontFamilyName, ValueFontSize, and ValueColor.

New-BGInfo -MonitorIndex 0 {
    # Lets add laptop identify, however lets use builtin values for that
    New-BGInfoValue -BuiltinValue HostName -Colour Pink -FontSize 20 -FontFamilyName 'Calibri'
    New-BGInfoValue -BuiltinValue FullUserName -Colour White
    New-BGInfoValue -BuiltinValue CpuName -Colour White
    New-BGInfoValue -BuiltinValue CpuLogicalCores -Colour White -ValueColor Pink
    New-BGInfoValue -BuiltinValue RAMSize -Colour White
    New-BGInfoValue -BuiltinValue RAMSpeed -Colour White -ValueColor ([SixLabors.ImageSharp.Color]::Aquamarine)
} -FilePath "C:SupportGitHubPowerBGInfoExamplesSamplesTapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRootOutput -PositionX 75 -PositionY 75 -WallpaperFit Match

You’ll be able to construct your individual BGInfo to set in your desktop or server with simply three little capabilities, and you do not have to resort to utilizing something then a PowerShell module.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments