├── .github └── FUNDING.yml ├── .gitignore ├── Build └── Manage-PowerBGInfo.ps1 ├── CHANGELOG.MD ├── Docs ├── New-BGInfo.md ├── New-BGInfoLabel.md ├── New-BGInfoValue.md └── Readme.md ├── Examples ├── Output │ ├── PrzemyslawKlysAndKulkozaurr.jpg │ └── TapN-Evotec-1600x900.jpg ├── Run.BGInfo1.ps1 ├── Run.BGInfo2.ps1 ├── Run.BGInfo3.ps1 └── Samples │ ├── LogoEvotec.png │ ├── PrzemyslawKlysAndKulkozaurr.jpg │ ├── TapC-Evotec-2560x1080.jpg │ ├── TapN-Evotec-1600x900.jpg │ └── TapN-Evotec-2048x1536.jpg ├── License ├── PowerBGInfo.psd1 ├── PowerBGInfo.psm1 ├── Public ├── New-BGInfo.ps1 ├── New-BGInfoLabel.ps1 └── New-BGInfoValue.ps1 └── README.MD /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: PrzemyslawKlys 4 | custom: https://paypal.me/PrzemyslawKlys -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Ignore/* 2 | .vs/* 3 | .vscode/* 4 | Examples/Output/* 5 | Releases/* 6 | Artefacts/* 7 | ReleasedUnpacked/* 8 | Lib/Default/* 9 | Lib/Standard/* 10 | Lib/Core/* 11 | Sources/.vs 12 | Sources/*/.vs 13 | Sources/*/obj 14 | Sources/*/bin 15 | Sources/*/*/obj 16 | Sources/*/*/bin 17 | Sources/packages/* -------------------------------------------------------------------------------- /Build/Manage-PowerBGInfo.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | 3 | Invoke-ModuleBuild -ModuleName 'PowerBGInfo' { 4 | # Usual defaults as per standard module 5 | $Manifest = [ordered] @{ 6 | # Minimum version of the Windows PowerShell engine required by this module 7 | PowerShellVersion = '5.1' 8 | # prevent using over CORE/PS 7 9 | CompatiblePSEditions = @('Desktop', 'Core') 10 | # ID used to uniquely identify this module 11 | GUID = '91b9c52d-6a39-4a65-a276-409b9390ee04' 12 | # Version number of this module. 13 | ModuleVersion = '1.0.X' 14 | # Author of this module 15 | Author = 'Przemyslaw Klys' 16 | # Company or vendor of this module 17 | CompanyName = 'Evotec' 18 | # Copyright statement for this module 19 | Copyright = "(c) 2011 - $((Get-Date).Year) Przemyslaw Klys @ Evotec. All rights reserved." 20 | # Description of the functionality provided by this module 21 | Description = 'PowerBGInfo is a module that allows you to create background images with information about your environment.' 22 | # Tags applied to this module. These help with module discovery in online galleries. 23 | Tags = @('windows', 'image', 'monitor', 'bginfo') 24 | # A URL to the main website for this project. 25 | ProjectUri = 'https://github.com/EvotecIT/PowerBGInfo' 26 | 27 | IconUri = 'https://evotec.xyz/wp-content/uploads/2022/12/PowerBGInfo.png' 28 | 29 | LicenseUri = 'https://github.com/EvotecIT/PowerBGInfo/blob/master/License' 30 | 31 | DotNetFrameworkVersion = '4.7.2' 32 | } 33 | New-ConfigurationManifest @Manifest 34 | 35 | New-ConfigurationModule -Type RequiredModule -Name 'PSSharedGoods' -Guid Auto -Version Latest 36 | New-ConfigurationModule -Type RequiredModule -Name 'DesktopManager' -Guid Auto -Version '2.0.1' 37 | New-ConfigurationModule -Type RequiredModule -Name 'ImagePlayground' -Guid Auto -Version '0.0.8' 38 | New-ConfigurationModule -Type ApprovedModule -Name 'PSSharedGoods', 'PSWriteColor', 'Connectimo', 'PSUnifi', 'PSWebToolbox', 'PSMyPassword', 'PSPublishModule' 39 | New-ConfigurationModuleSkip -IgnoreModuleName @('NetTCPIP', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management', 'CimCmdlets') 40 | 41 | $ConfigurationFormat = [ordered] @{ 42 | RemoveComments = $false 43 | 44 | PlaceOpenBraceEnable = $true 45 | PlaceOpenBraceOnSameLine = $true 46 | PlaceOpenBraceNewLineAfter = $true 47 | PlaceOpenBraceIgnoreOneLineBlock = $true 48 | 49 | PlaceCloseBraceEnable = $true 50 | PlaceCloseBraceNewLineAfter = $false 51 | PlaceCloseBraceIgnoreOneLineBlock = $true 52 | PlaceCloseBraceNoEmptyLineBefore = $false 53 | 54 | UseConsistentIndentationEnable = $true 55 | UseConsistentIndentationKind = 'space' 56 | UseConsistentIndentationPipelineIndentation = 'IncreaseIndentationAfterEveryPipeline' 57 | UseConsistentIndentationIndentationSize = 4 58 | 59 | UseConsistentWhitespaceEnable = $true 60 | UseConsistentWhitespaceCheckInnerBrace = $true 61 | UseConsistentWhitespaceCheckOpenBrace = $true 62 | UseConsistentWhitespaceCheckOpenParen = $true 63 | UseConsistentWhitespaceCheckOperator = $true 64 | UseConsistentWhitespaceCheckPipe = $true 65 | UseConsistentWhitespaceCheckSeparator = $true 66 | 67 | AlignAssignmentStatementEnable = $true 68 | AlignAssignmentStatementCheckHashtable = $true 69 | 70 | UseCorrectCasingEnable = $true 71 | } 72 | # format PSD1 and PSM1 files when merging into a single file 73 | # enable formatting is not required as Configuration is provided 74 | New-ConfigurationFormat -ApplyTo 'OnMergePSM1', 'OnMergePSD1' -Sort None @ConfigurationFormat 75 | # format PSD1 and PSM1 files within the module 76 | # enable formatting is required to make sure that formatting is applied (with default settings) 77 | New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'DefaultPSM1' -EnableFormatting -Sort None 78 | # when creating PSD1 use special style without comments and with only required parameters 79 | New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'OnMergePSD1' -PSD1Style 'Minimal' 80 | # configuration for documentation, at the same time it enables documentation processing 81 | New-ConfigurationDocumentation -Enable:$false -StartClean -UpdateWhenNew -PathReadme 'Docs\Readme.md' -Path 'Docs' 82 | 83 | #New-ConfigurationImportModule -ImportSelf 84 | 85 | New-ConfigurationBuild -Enable:$true -SignModule -MergeModuleOnBuild -MergeFunctionsFromApprovedModules -CertificateThumbprint '483292C9E317AA13B07BB7A96AE9D1A5ED9E7703' 86 | 87 | New-ConfigurationArtefact -Type Unpacked -Enable -Path "$PSScriptRoot\..\Artefacts\Unpacked" -ModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -RequiredModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -AddRequiredModules 88 | New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed" -ArtefactName '.v.zip' 89 | 90 | # options for publishing to github/psgallery 91 | #New-ConfigurationPublish -Type PowerShellGallery -FilePath 'C:\Support\Important\PowerShellGalleryAPI.txt' -Enabled 92 | #New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled 93 | } -------------------------------------------------------------------------------- /CHANGELOG.MD: -------------------------------------------------------------------------------- 1 | ### 0.0.5 - 2024.11.19 2 | #### What's new 3 | - Fixes PowerShell 5.1 support 4 | 5 | **Full Changelog**: https://github.com/EvotecIT/PowerBGInfo/compare/v0.0.4...v0.0.5 6 | 7 | ### 0.0.4 - 2024.11.14 8 | #### What's Changed 9 | * Avoid overwrite of original image and add new BuiltInValues by @dejil06 in https://github.com/EvotecIT/PowerBGInfo/pull/12 10 | 11 | #### New Contributors 12 | * @dejil06 made their first contribution in https://github.com/EvotecIT/PowerBGInfo/pull/12 13 | 14 | **Full Changelog**: https://github.com/EvotecIT/PowerBGInfo/compare/v0.0.3...v0.0.4 15 | 16 | ### 0.0.3 - 2022.12.31 17 | - Added more built-in values: 18 | - 'BiosVersion', 'BiosManufacturer', 'BiosReleaseDate' 19 | - 'OSName', 'OSVersion', 'OSArchitecture', 'OSBuild', 'OSInstallDate', 'OSLastBootUpTime' 20 | - Added ability to rename Label when using BuiltinValues 21 | 22 | ### 0.0.2 - 2022.12.31 23 | - Fixes an issue with background not changing when given different file 24 | 25 | ### 0.0.1 26 | - First release -------------------------------------------------------------------------------- /Docs/New-BGInfo.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PowerBGInfo-help.xml 3 | Module Name: PowerBGInfo 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-BGInfo 9 | 10 | ## SYNOPSIS 11 | Provides a simple way to create PowerBGInfo configuration. 12 | 13 | ## SYNTAX 14 | 15 | ``` 16 | New-BGInfo [-BGInfoContent] [[-FilePath] ] [-ConfigurationDirectory] 17 | [[-FontFamilyName] ] [[-Color] ] [[-FontSize] ] [[-ValueColor] ] 18 | [[-ValueFontSize] ] [[-ValueFontFamilyName] ] [[-SpaceBetweenLines] ] 19 | [[-SpaceBetweenColumns] ] [[-PositionX] ] [[-PositionY] ] [[-MonitorIndex] ] 20 | [[-WallpaperFit] ] [] 21 | ``` 22 | 23 | ## DESCRIPTION 24 | Provides a simple way to create PowerBGInfo configuration. 25 | It allows writting useful information on your desktop background. 26 | Every time the script is run, it will update existing image with new information. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | ``` 32 | New-BGInfo -MonitorIndex 0 { 33 | 34 | 35 | # Lets add computer name, but lets use builtin values for that 36 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 37 | New-BGInfoValue -BuiltinValue FullUserName 38 | New-BGInfoValue -BuiltinValue CpuName 39 | New-BGInfoValue -BuiltinValue CpuLogicalCores 40 | New-BGInfoValue -BuiltinValue RAMSize 41 | New-BGInfoValue -BuiltinValue RAMSpeed 42 | 43 | # Lets add Label, but without any values, kinf of like section starting 44 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 45 | 46 | # Lets get all drives and their labels 47 | foreach ($Disk in (Get-Disk)) { 48 | $Volumes = $Disk | Get-Partition | Get-Volume 49 | foreach ($V in $Volumes) { 50 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 51 | } 52 | } 53 | } -FilePath $PSScriptRoot\Samples\PrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRoot\Output -PositionX 100 -PositionY 100 -WallpaperFit Center 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -BGInfoContent 59 | Special parameter that works as a scriptblock. 60 | It takes input and converts it into configuration. 61 | By using New-BGInfoLabel and New-BGInfoValue along with other supported PowerShell commands you can create your own configuration. 62 | 63 | ```yaml 64 | Type: ScriptBlock 65 | Parameter Sets: (All) 66 | Aliases: 67 | 68 | Required: True 69 | Position: 1 70 | Default value: None 71 | Accept pipeline input: False 72 | Accept wildcard characters: False 73 | ``` 74 | 75 | ### -FilePath 76 | Path to the image that will be used as a background. 77 | If not provided current Desktop Background will be used. 78 | 79 | ```yaml 80 | Type: String 81 | Parameter Sets: (All) 82 | Aliases: 83 | 84 | Required: False 85 | Position: 2 86 | Default value: None 87 | Accept pipeline input: False 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### -ConfigurationDirectory 92 | Path to the directory where configuration will be stored, and where image for desktop background will be placed. 93 | If not provided, it will be stored in C:\TEMP 94 | 95 | ```yaml 96 | Type: String 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: True 101 | Position: 3 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### -FontFamilyName 108 | Font family name that will be used to display information for Label. 109 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 110 | If ValueFontFamilyName is not provided it will be used as a default value for that property as well 111 | 112 | ```yaml 113 | Type: String 114 | Parameter Sets: (All) 115 | Aliases: 116 | 117 | Required: False 118 | Position: 4 119 | Default value: Calibri 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ### -Color 125 | Color that will be used to display information for Label. 126 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 127 | If ValueColor is not provided it will be used as a default value for that property as well 128 | 129 | ```yaml 130 | Type: Color 131 | Parameter Sets: (All) 132 | Aliases: 133 | 134 | Required: False 135 | Position: 5 136 | Default value: [SixLabors.ImageSharp.Color]::Black 137 | Accept pipeline input: False 138 | Accept wildcard characters: False 139 | ``` 140 | 141 | ### -FontSize 142 | Font size that will be used to display information for Label. 143 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 144 | If ValueFontSize is not provided it will be used as a default value for that property as well 145 | 146 | ```yaml 147 | Type: Int32 148 | Parameter Sets: (All) 149 | Aliases: 150 | 151 | Required: False 152 | Position: 6 153 | Default value: 16 154 | Accept pipeline input: False 155 | Accept wildcard characters: False 156 | ``` 157 | 158 | ### -ValueColor 159 | Color that will be used to display information for Value. 160 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 161 | If not provided it will be taken from Color property. 162 | 163 | ```yaml 164 | Type: Color 165 | Parameter Sets: (All) 166 | Aliases: 167 | 168 | Required: False 169 | Position: 7 170 | Default value: [SixLabors.ImageSharp.Color]::Black 171 | Accept pipeline input: False 172 | Accept wildcard characters: False 173 | ``` 174 | 175 | ### -ValueFontSize 176 | Font size that will be used to display information for Value. 177 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 178 | If not provided it will be taken from FontSize property. 179 | 180 | ```yaml 181 | Type: Single 182 | Parameter Sets: (All) 183 | Aliases: 184 | 185 | Required: False 186 | Position: 8 187 | Default value: 16 188 | Accept pipeline input: False 189 | Accept wildcard characters: False 190 | ``` 191 | 192 | ### -ValueFontFamilyName 193 | Font family name that will be used to display information for Value. 194 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 195 | If not provided it will be taken from FontFamilyName property. 196 | 197 | ```yaml 198 | Type: String 199 | Parameter Sets: (All) 200 | Aliases: 201 | 202 | Required: False 203 | Position: 9 204 | Default value: Calibri 205 | Accept pipeline input: False 206 | Accept wildcard characters: False 207 | ``` 208 | 209 | ### -SpaceBetweenLines 210 | Length of the space between lines 211 | 212 | ```yaml 213 | Type: Int32 214 | Parameter Sets: (All) 215 | Aliases: 216 | 217 | Required: False 218 | Position: 10 219 | Default value: 10 220 | Accept pipeline input: False 221 | Accept wildcard characters: False 222 | ``` 223 | 224 | ### -SpaceBetweenColumns 225 | Length of the space between columns (Label and Value) 226 | 227 | ```yaml 228 | Type: Int32 229 | Parameter Sets: (All) 230 | Aliases: 231 | 232 | Required: False 233 | Position: 11 234 | Default value: 30 235 | Accept pipeline input: False 236 | Accept wildcard characters: False 237 | ``` 238 | 239 | ### -PositionX 240 | Position of the first column on the X axis. 241 | 242 | ```yaml 243 | Type: Int32 244 | Parameter Sets: (All) 245 | Aliases: 246 | 247 | Required: False 248 | Position: 12 249 | Default value: 10 250 | Accept pipeline input: False 251 | Accept wildcard characters: False 252 | ``` 253 | 254 | ### -PositionY 255 | Position of the first column on the Y axis. 256 | 257 | ```yaml 258 | Type: Int32 259 | Parameter Sets: (All) 260 | Aliases: 261 | 262 | Required: False 263 | Position: 13 264 | Default value: 10 265 | Accept pipeline input: False 266 | Accept wildcard characters: False 267 | ``` 268 | 269 | ### -MonitorIndex 270 | Index of the monitor that will be used to display the background image. 271 | By default it will be 0 (first monitor) 272 | 273 | ```yaml 274 | Type: Int32 275 | Parameter Sets: (All) 276 | Aliases: 277 | 278 | Required: False 279 | Position: 14 280 | Default value: 0 281 | Accept pipeline input: False 282 | Accept wildcard characters: False 283 | ``` 284 | 285 | ### -WallpaperFit 286 | WHat to do with the image if it is not the same size as the monitor resolution. 287 | It can be one of the following: 'Center', 'Fit', 'Stretch', 'Tile', 'Span', 'Fill' 288 | 289 | ```yaml 290 | Type: String 291 | Parameter Sets: (All) 292 | Aliases: 293 | 294 | Required: False 295 | Position: 15 296 | Default value: None 297 | Accept pipeline input: False 298 | Accept wildcard characters: False 299 | ``` 300 | 301 | ### CommonParameters 302 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 303 | 304 | ## INPUTS 305 | 306 | ## OUTPUTS 307 | 308 | ## NOTES 309 | General notes 310 | 311 | ## RELATED LINKS 312 | -------------------------------------------------------------------------------- /Docs/New-BGInfoLabel.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PowerBGInfo-help.xml 3 | Module Name: PowerBGInfo 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-BGInfoLabel 9 | 10 | ## SYNOPSIS 11 | Provides ability to set label without value. 12 | It can be used to separate different sections of information. 13 | 14 | ## SYNTAX 15 | 16 | ``` 17 | New-BGInfoLabel [[-Name] ] [[-Color] ] [[-FontSize] ] [[-FontFamilyName] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | Provides ability to set label without value. 23 | It can be used to separate different sections of information. 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | ``` 29 | # Lets add Label, but without any values, kinf of like section starting 30 | 31 | 32 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 33 | ``` 34 | 35 | ## PARAMETERS 36 | 37 | ### -Name 38 | Name of the label/section 39 | 40 | ```yaml 41 | Type: String 42 | Parameter Sets: (All) 43 | Aliases: 44 | 45 | Required: False 46 | Position: 1 47 | Default value: None 48 | Accept pipeline input: False 49 | Accept wildcard characters: False 50 | ``` 51 | 52 | ### -Color 53 | Color for the label. 54 | If not provided it will be taken from the parent New-BGInfo command. 55 | 56 | ```yaml 57 | Type: Color 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: False 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -FontSize 69 | Font size for the label. 70 | If not provided it will be taken from the parent New-BGInfo command. 71 | 72 | ```yaml 73 | Type: Single 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 3 79 | Default value: 0 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -FontFamilyName 85 | Font family name for the label. 86 | If not provided it will be taken from the parent New-BGInfo command. 87 | 88 | ```yaml 89 | Type: String 90 | Parameter Sets: (All) 91 | Aliases: 92 | 93 | Required: False 94 | Position: 4 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### CommonParameters 101 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 102 | 103 | ## INPUTS 104 | 105 | ## OUTPUTS 106 | 107 | ## NOTES 108 | General notes 109 | 110 | ## RELATED LINKS 111 | -------------------------------------------------------------------------------- /Docs/New-BGInfoValue.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: PowerBGInfo-help.xml 3 | Module Name: PowerBGInfo 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # New-BGInfoValue 9 | 10 | ## SYNOPSIS 11 | Special function that provides a way to create a value that will be displayed on the background image. 12 | 13 | ## SYNTAX 14 | 15 | ### Values (Default) 16 | ``` 17 | New-BGInfoValue -Name -Value [-Color ] [-FontSize ] [-FontFamilyName ] 18 | [-ValueColor ] [-ValueFontSize ] [-ValueFontFamilyName ] [] 19 | ``` 20 | 21 | ### Builtin 22 | ``` 23 | New-BGInfoValue [-Name ] -BuiltinValue [-Color ] [-FontSize ] 24 | [-FontFamilyName ] [-ValueColor ] [-ValueFontSize ] [-ValueFontFamilyName ] 25 | [] 26 | ``` 27 | 28 | ## DESCRIPTION 29 | Special function that provides a way to create a value that will be displayed on the background image. 30 | It allows using builtin values, or custom values depending on user needs. 31 | 32 | ## EXAMPLES 33 | 34 | ### EXAMPLE 1 35 | ``` 36 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 37 | 38 | 39 | New-BGInfoValue -BuiltinValue FullUserName 40 | New-BGInfoValue -BuiltinValue CpuName 41 | ``` 42 | 43 | ### EXAMPLE 2 44 | ``` 45 | # Lets get all drives and their labels 46 | 47 | 48 | foreach ($Disk in (Get-Disk)) { 49 | $Volumes = $Disk | Get-Partition | Get-Volume 50 | foreach ($V in $Volumes) { 51 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 52 | } 53 | } 54 | ``` 55 | 56 | ## PARAMETERS 57 | 58 | ### -Name 59 | Label that will be used on the left side of the value. 60 | 61 | ```yaml 62 | Type: String 63 | Parameter Sets: Values 64 | Aliases: 65 | 66 | Required: True 67 | Position: Named 68 | Default value: None 69 | Accept pipeline input: False 70 | Accept wildcard characters: False 71 | ``` 72 | 73 | ```yaml 74 | Type: String 75 | Parameter Sets: Builtin 76 | Aliases: 77 | 78 | Required: False 79 | Position: Named 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -Value 86 | Cystom Value that will be displayed on the right side of the label. 87 | 88 | ```yaml 89 | Type: String 90 | Parameter Sets: Values 91 | Aliases: 92 | 93 | Required: True 94 | Position: Named 95 | Default value: None 96 | Accept pipeline input: False 97 | Accept wildcard characters: False 98 | ``` 99 | 100 | ### -BuiltinValue 101 | Builtin value that will be displayed on the right side of the label. 102 | It can be one of the following: 103 | - UserName - Current user name 104 | - HostName - Current host name 105 | - FullUserName - Current user name with domain 106 | - CpuName - CPU name 107 | - CpuMaxClockSpeed - CPU max clock speed 108 | - CpuCores - CPU cores 109 | - CpuLogicalCores - CPU logical cores 110 | - RAMSize - RAM size 111 | - RAMSpeed - RAM speed 112 | - RAMPartNumber - RAM part number 113 | - BiosVersion - BIOS version 114 | - BiosManufacturer - BIOS manufacturer 115 | - BiosReleaseDate - BIOS release date 116 | - OSName - OS name 117 | - OSVersion - OS version 118 | - OSArchitecture - OS architecture 119 | - OSBuild - OS build 120 | - OSInstallDate - OS install date 121 | - OSLastBootUpTime - OS last boot up time 122 | - UserDNSDomain - User DNS domain 123 | - FQDN - Fully qualified domain name 124 | - IPv4Address - IPv4 address 125 | - IPv6Address - IPv6 address 126 | 127 | ```yaml 128 | Type: String 129 | Parameter Sets: Builtin 130 | Aliases: 131 | 132 | Required: True 133 | Position: Named 134 | Default value: None 135 | Accept pipeline input: False 136 | Accept wildcard characters: False 137 | ``` 138 | 139 | ### -Color 140 | Color for the label. 141 | If not provided it will be taken from the parent New-BGInfo command. 142 | 143 | ```yaml 144 | Type: Color 145 | Parameter Sets: (All) 146 | Aliases: 147 | 148 | Required: False 149 | Position: Named 150 | Default value: None 151 | Accept pipeline input: False 152 | Accept wildcard characters: False 153 | ``` 154 | 155 | ### -FontSize 156 | Font size for the label. 157 | If not provided it will be taken from the parent New-BGInfo command. 158 | 159 | ```yaml 160 | Type: Single 161 | Parameter Sets: (All) 162 | Aliases: 163 | 164 | Required: False 165 | Position: Named 166 | Default value: 0 167 | Accept pipeline input: False 168 | Accept wildcard characters: False 169 | ``` 170 | 171 | ### -FontFamilyName 172 | Font family name for the label. 173 | If not provided it will be taken from the parent New-BGInfo command. 174 | 175 | ```yaml 176 | Type: String 177 | Parameter Sets: (All) 178 | Aliases: 179 | 180 | Required: False 181 | Position: Named 182 | Default value: None 183 | Accept pipeline input: False 184 | Accept wildcard characters: False 185 | ``` 186 | 187 | ### -ValueColor 188 | Color for the value. 189 | If not provided it will be taken first from Color of the label and if that is not provided from the parent New-BGInfo command. 190 | 191 | ```yaml 192 | Type: Color 193 | Parameter Sets: (All) 194 | Aliases: 195 | 196 | Required: False 197 | Position: Named 198 | Default value: None 199 | Accept pipeline input: False 200 | Accept wildcard characters: False 201 | ``` 202 | 203 | ### -ValueFontSize 204 | Font size for the value. 205 | If not provided it will be taken first from FontSize of the label and if that is not provided from the parent New-BGInfo command. 206 | 207 | ```yaml 208 | Type: Single 209 | Parameter Sets: (All) 210 | Aliases: 211 | 212 | Required: False 213 | Position: Named 214 | Default value: 0 215 | Accept pipeline input: False 216 | Accept wildcard characters: False 217 | ``` 218 | 219 | ### -ValueFontFamilyName 220 | Font family name for the value. 221 | If not provided it will be taken first from FontFamilyName of the label and if that is not provided from the parent New-BGInfo command. 222 | 223 | ```yaml 224 | Type: String 225 | Parameter Sets: (All) 226 | Aliases: 227 | 228 | Required: False 229 | Position: Named 230 | Default value: None 231 | Accept pipeline input: False 232 | Accept wildcard characters: False 233 | ``` 234 | 235 | ### CommonParameters 236 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 237 | 238 | ## INPUTS 239 | 240 | ## OUTPUTS 241 | 242 | ## NOTES 243 | General notes 244 | 245 | ## RELATED LINKS 246 | -------------------------------------------------------------------------------- /Docs/Readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | Module Name: PowerBGInfo 3 | Module Guid: 91b9c52d-6a39-4a65-a276-409b9390ee04 4 | Download Help Link: {{ Update Download Link }} 5 | Help Version: {{ Please enter version of help manually (X.X.X.X) format }} 6 | Locale: en-US 7 | --- 8 | 9 | # PowerBGInfo Module 10 | ## Description 11 | {{ Fill in the Description }} 12 | 13 | ## PowerBGInfo Cmdlets 14 | ### [New-BGInfo](New-BGInfo.md) 15 | Provides a simple way to create PowerBGInfo configuration. 16 | 17 | ### [New-BGInfoLabel](New-BGInfoLabel.md) 18 | Provides ability to set label without value. 19 | It can be used to separate different sections of information. 20 | 21 | ### [New-BGInfoValue](New-BGInfoValue.md) 22 | Special function that provides a way to create a value that will be displayed on the background image. 23 | 24 | -------------------------------------------------------------------------------- /Examples/Output/PrzemyslawKlysAndKulkozaurr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Output/PrzemyslawKlysAndKulkozaurr.jpg -------------------------------------------------------------------------------- /Examples/Output/TapN-Evotec-1600x900.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Output/TapN-Evotec-1600x900.jpg -------------------------------------------------------------------------------- /Examples/Run.BGInfo1.ps1: -------------------------------------------------------------------------------- 1 | Clear-Host 2 | 3 | Import-Module .\PowerBGInfo.psd1 -Force 4 | 5 | New-BGInfo -MonitorIndex 0 { 6 | # Lets add computer name, but lets use builtin values for that 7 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 8 | # Lets add user name, but lets use builtin values for that 9 | New-BGInfoValue -BuiltinValue FullUserName -Name "User Name X" -Color White 10 | New-BGInfoValue -BuiltinValue CpuName 11 | New-BGInfoValue -BuiltinValue CpuLogicalCores 12 | New-BGInfoValue -BuiltinValue RAMSize 13 | New-BGInfoValue -BuiltinValue RAMSpeed 14 | 15 | # Lets add Label, but without any values, kind of like section starting 16 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 17 | 18 | # Lets get all drives and their labels 19 | foreach ($Disk in (Get-Disk)) { 20 | $Volumes = $Disk | Get-Partition | Get-Volume 21 | foreach ($V in $Volumes) { 22 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 23 | } 24 | } 25 | } -FilePath $PSScriptRoot\Samples\PrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRoot\Output -WallpaperFit Stretch -TextPosition TopRight -SpaceBetweenColumns 50 -UseScreenCoordinates -------------------------------------------------------------------------------- /Examples/Run.BGInfo2.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\PowerBGInfo.psd1 -Force 2 | 3 | New-BGInfo -MonitorIndex 0 { 4 | # Lets add computer name, but lets use builtin values for that 5 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 6 | New-BGInfoValue -BuiltinValue FullUserName -Color White 7 | New-BGInfoValue -BuiltinValue CpuName -Color White 8 | New-BGInfoValue -BuiltinValue CpuLogicalCores -Color White -ValueColor Red 9 | New-BGInfoValue -BuiltinValue RAMSize -Color White 10 | New-BGInfoValue -BuiltinValue RAMSpeed -Color White -ValueColor ([SixLabors.ImageSharp.Color]::Aquamarine) 11 | New-BGInfoValue -BuiltinValue RAMPartNumber -Color White 12 | New-BGInfoValue -BuiltinValue BiosVersion -Color White 13 | New-BGInfoValue -BuiltinValue BiosManufacturer -Color White 14 | New-BGInfoValue -BuiltinValue BiosReleaseDate -Color White 15 | New-BGInfoValue -BuiltinValue OSName -Color White -Name "Operating System" 16 | New-BGInfoValue -BuiltinValue OSVersion -Color White 17 | New-BGInfoValue -BuiltinValue OSArchitecture -Color White 18 | New-BGInfoValue -BuiltinValue OSBuild -Color White 19 | New-BGInfoValue -BuiltinValue OSInstallDate -Color White 20 | New-BGInfoValue -BuiltinValue OSLastBootUpTime -Color White 21 | 22 | } -FilePath "C:\Support\GitHub\PowerBGInfo\Examples\Samples\TapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRoot\Output -PositionX 75 -PositionY 75 -WallpaperFit Fit -------------------------------------------------------------------------------- /Examples/Run.BGInfo3.ps1: -------------------------------------------------------------------------------- 1 | Import-Module .\PowerBGInfo.psd1 -Force 2 | 3 | New-BGInfo -MonitorIndex 0 { 4 | # Lets add computer name, but lets use builtin values for that 5 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 6 | New-BGInfoValue -BuiltinValue FullUserName -Color White 7 | New-BGInfoValue -BuiltinValue CpuName -Color White 8 | New-BGInfoValue -BuiltinValue CpuLogicalCores -Color White -ValueColor Red 9 | New-BGInfoValue -BuiltinValue RAMSize -Color White 10 | New-BGInfoValue -BuiltinValue RAMSpeed -Color White -ValueColor ([SixLabors.ImageSharp.Color]::Aquamarine) 11 | New-BGInfoValue -BuiltinValue RAMPartNumber -Color White 12 | New-BGInfoValue -BuiltinValue BiosVersion -Color White 13 | New-BGInfoValue -BuiltinValue BiosManufacturer -Color White 14 | New-BGInfoValue -BuiltinValue BiosReleaseDate -Color White 15 | New-BGInfoValue -BuiltinValue OSName -Color White -Name "Operating System" 16 | New-BGInfoValue -BuiltinValue OSVersion -Color White 17 | New-BGInfoValue -BuiltinValue OSArchitecture -Color White 18 | New-BGInfoValue -BuiltinValue OSBuild -Color White 19 | New-BGInfoValue -BuiltinValue OSInstallDate -Color White 20 | } -FilePath "C:\Support\GitHub\PowerBGInfo\Examples\Samples\TapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRoot\Output -PositionX 75 -PositionY 75 -WallpaperFit Fit -------------------------------------------------------------------------------- /Examples/Samples/LogoEvotec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Samples/LogoEvotec.png -------------------------------------------------------------------------------- /Examples/Samples/PrzemyslawKlysAndKulkozaurr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Samples/PrzemyslawKlysAndKulkozaurr.jpg -------------------------------------------------------------------------------- /Examples/Samples/TapC-Evotec-2560x1080.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Samples/TapC-Evotec-2560x1080.jpg -------------------------------------------------------------------------------- /Examples/Samples/TapN-Evotec-1600x900.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Samples/TapN-Evotec-1600x900.jpg -------------------------------------------------------------------------------- /Examples/Samples/TapN-Evotec-2048x1536.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/37c65d3c3ba31ef33f5983c9f92ef78134329436/Examples/Samples/TapN-Evotec-2048x1536.jpg -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Evotec 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PowerBGInfo.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | AliasesToExport = @() 3 | Author = 'Przemyslaw Klys' 4 | CmdletsToExport = @() 5 | CompanyName = 'Evotec' 6 | CompatiblePSEditions = @('Desktop', 'Core') 7 | Copyright = '(c) 2011 - 2025 Przemyslaw Klys @ Evotec. All rights reserved.' 8 | Description = 'PowerBGInfo is a module that allows you to create background images with information about your environment.' 9 | DotNetFrameworkVersion = '4.7.2' 10 | FunctionsToExport = @('New-BGInfo', 'New-BGInfoLabel', 'New-BGInfoValue') 11 | GUID = '91b9c52d-6a39-4a65-a276-409b9390ee04' 12 | ModuleVersion = '1.0.0' 13 | PowerShellVersion = '5.1' 14 | PrivateData = @{ 15 | PSData = @{ 16 | IconUri = 'https://evotec.xyz/wp-content/uploads/2022/12/PowerBGInfo.png' 17 | LicenseUri = 'https://github.com/EvotecIT/PowerBGInfo/blob/master/License' 18 | ProjectUri = 'https://github.com/EvotecIT/PowerBGInfo' 19 | Tags = @('windows', 'image', 'monitor', 'bginfo') 20 | } 21 | } 22 | RequiredModules = @(@{ 23 | Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe' 24 | ModuleName = 'PSSharedGoods' 25 | ModuleVersion = '0.0.303' 26 | }, @{ 27 | Guid = '56f85fa6-c622-4204-8e97-3d99e3e06e75' 28 | ModuleName = 'DesktopManager' 29 | ModuleVersion = '2.0.1' 30 | }, @{ 31 | Guid = 'ff5469f2-c542-4318-909e-fd054d16821f' 32 | ModuleName = 'ImagePlayground' 33 | ModuleVersion = '0.0.8' 34 | }) 35 | RootModule = 'PowerBGInfo.psm1' 36 | } -------------------------------------------------------------------------------- /PowerBGInfo.psm1: -------------------------------------------------------------------------------- 1 | #Get public and private function definition files. 2 | $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 3 | $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 4 | $Classes = @( Get-ChildItem -Path $PSScriptRoot\Classes\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 5 | $Enums = @( Get-ChildItem -Path $PSScriptRoot\Enums\*.ps1 -ErrorAction SilentlyContinue -Recurse ) 6 | 7 | $AssemblyFolders = Get-ChildItem -Path $PSScriptRoot\Lib -Directory -ErrorAction SilentlyContinue 8 | $Assembly = @( 9 | if ($AssemblyFolders.BaseName -contains 'Standard') { 10 | @( Get-ChildItem -Path $PSScriptRoot\Lib\Standard\*.dll -ErrorAction SilentlyContinue -Recurse) 11 | } 12 | if ($PSEdition -eq 'Core') { 13 | @( Get-ChildItem -Path $PSScriptRoot\Lib\Core\*.dll -ErrorAction SilentlyContinue -Recurse ) 14 | } else { 15 | @( Get-ChildItem -Path $PSScriptRoot\Lib\Default\*.dll -ErrorAction SilentlyContinue -Recurse ) 16 | } 17 | ) 18 | $FoundErrors = @( 19 | Foreach ($Import in @($Assembly)) { 20 | try { 21 | Write-Verbose -Message $Import.FullName 22 | Add-Type -Path $Import.Fullname -ErrorAction Stop 23 | # } 24 | } catch [System.Reflection.ReflectionTypeLoadException] { 25 | Write-Warning "Processing $($Import.Name) Exception: $($_.Exception.Message)" 26 | $LoaderExceptions = $($_.Exception.LoaderExceptions) | Sort-Object -Unique 27 | foreach ($E in $LoaderExceptions) { 28 | Write-Warning "Processing $($Import.Name) LoaderExceptions: $($E.Message)" 29 | } 30 | $true 31 | #Write-Error -Message "StackTrace: $($_.Exception.StackTrace)" 32 | } catch { 33 | Write-Warning "Processing $($Import.Name) Exception: $($_.Exception.Message)" 34 | $LoaderExceptions = $($_.Exception.LoaderExceptions) | Sort-Object -Unique 35 | foreach ($E in $LoaderExceptions) { 36 | Write-Warning "Processing $($Import.Name) LoaderExceptions: $($E.Message)" 37 | } 38 | $true 39 | #Write-Error -Message "StackTrace: $($_.Exception.StackTrace)" 40 | } 41 | } 42 | #Dot source the files 43 | Foreach ($Import in @($Private + $Public + $Classes + $Enums)) { 44 | Try { 45 | . $Import.Fullname 46 | } Catch { 47 | Write-Error -Message "Failed to import functions from $($import.Fullname): $_" 48 | $true 49 | } 50 | } 51 | ) 52 | 53 | if ($FoundErrors.Count -gt 0) { 54 | $ModuleName = (Get-ChildItem $PSScriptRoot\*.psd1).BaseName 55 | Write-Warning "Importing module $ModuleName failed. Fix errors before continuing." 56 | break 57 | } 58 | 59 | Export-ModuleMember -Function '*' -Alias '*' -------------------------------------------------------------------------------- /Public/New-BGInfo.ps1: -------------------------------------------------------------------------------- 1 | function New-BGInfo { 2 | <# 3 | .SYNOPSIS 4 | Provides a simple way to create PowerBGInfo configuration. 5 | 6 | .DESCRIPTION 7 | Provides a simple way to create PowerBGInfo configuration. 8 | It allows writting useful information on your desktop background. 9 | Every time the script is run, it will update existing image with new information. 10 | 11 | .PARAMETER BGInfoContent 12 | Special parameter that works as a scriptblock. It takes input and converts it into configuration. 13 | By using New-BGInfoLabel and New-BGInfoValue along with other supported PowerShell commands you can create your own configuration. 14 | 15 | .PARAMETER FilePath 16 | Path to the image that will be used as a background. If not provided current Desktop Background will be used. 17 | 18 | .PARAMETER ConfigurationDirectory 19 | Path to the directory where configuration will be stored, and where image for desktop background will be placed. If not provided, it will be stored in C:\TEMP 20 | 21 | .PARAMETER FontFamilyName 22 | Font family name that will be used to display information for Label. 23 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 24 | If ValueFontFamilyName is not provided it will be used as a default value for that property as well 25 | 26 | .PARAMETER Color 27 | Color that will be used to display information for Label. 28 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 29 | If ValueColor is not provided it will be used as a default value for that property as well 30 | 31 | .PARAMETER FontSize 32 | Font size that will be used to display information for Label. 33 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 34 | If ValueFontSize is not provided it will be used as a default value for that property as well 35 | 36 | .PARAMETER ValueColor 37 | Color that will be used to display information for Value. 38 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 39 | If not provided it will be taken from Color property. 40 | 41 | .PARAMETER ValueFontSize 42 | Font size that will be used to display information for Value. 43 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 44 | If not provided it will be taken from FontSize property. 45 | 46 | .PARAMETER ValueFontFamilyName 47 | Font family name that will be used to display information for Value. 48 | It's only used if New-BGInfoLabel or New-BGIInfoValue doesn't provide it's own value. 49 | If not provided it will be taken from FontFamilyName property. 50 | 51 | .PARAMETER SpaceBetweenLines 52 | Length of the space between lines 53 | 54 | .PARAMETER SpaceBetweenColumns 55 | Length of the space between columns (Label and Value) 56 | 57 | .PARAMETER PositionX 58 | Position of the first column on the X axis. 59 | 60 | .PARAMETER PositionY 61 | Position of the first column on the Y axis. 62 | 63 | .PARAMETER MonitorIndex 64 | Index of the monitor that will be used to display the background image. By default it will be 0 (first monitor) 65 | 66 | .PARAMETER WallpaperFit 67 | WHat to do with the image if it is not the same size as the monitor resolution. It can be one of the following: 'Center', 'Fit', 'Stretch', 'Tile', 'Span', 'Fill' 68 | 69 | .PARAMETER TextPosition 70 | Where to place the text. It can be one of the following: 'TopLeft', 'TopCenter', 'TopRight', 'MiddleLeft', 'MiddleCenter', 'MiddleRight', 'BottomLeft', 'BottomCenter', 'BottomRight' 71 | 72 | .PARAMETER SpaceX 73 | Space on the X axis from the edge of the screen 74 | 75 | .PARAMETER SpaceY 76 | Space on the Y axis from the edge of the screen 77 | 78 | .PARAMETER UseScreenCoordinates 79 | If set, the script will use screen coordinates instead of image coordinates. This is useful when you have multiple monitors with different resolutions. 80 | 81 | .EXAMPLE 82 | New-BGInfo -MonitorIndex 0 { 83 | # Lets add computer name, but lets use builtin values for that 84 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 85 | New-BGInfoValue -BuiltinValue FullUserName 86 | New-BGInfoValue -BuiltinValue CpuName 87 | New-BGInfoValue -BuiltinValue CpuLogicalCores 88 | New-BGInfoValue -BuiltinValue RAMSize 89 | New-BGInfoValue -BuiltinValue RAMSpeed 90 | 91 | # Lets add Label, but without any values, kinf of like section starting 92 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 93 | 94 | # Lets get all drives and their labels 95 | foreach ($Disk in (Get-Disk)) { 96 | $Volumes = $Disk | Get-Partition | Get-Volume 97 | foreach ($V in $Volumes) { 98 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 99 | } 100 | } 101 | } -FilePath $PSScriptRoot\Samples\PrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRoot\Output -PositionX 100 -PositionY 100 -WallpaperFit Center 102 | 103 | .NOTES 104 | General notes 105 | #> 106 | [CmdletBinding()] 107 | param( 108 | [parameter(Mandatory)][scriptblock] $BGInfoContent, 109 | [string] $FilePath, 110 | [parameter(Mandatory)][string] $ConfigurationDirectory, 111 | [string] $FontFamilyName = 'Calibri', 112 | [SixLabors.ImageSharp.Color] $Color = [SixLabors.ImageSharp.Color]::Black, 113 | [int] $FontSize = 16, 114 | [SixLabors.ImageSharp.Color] $ValueColor = [SixLabors.ImageSharp.Color]::Black, 115 | [float] $ValueFontSize = 16, 116 | [string] $ValueFontFamilyName = 'Calibri', 117 | [int] $SpaceBetweenLines = 10, 118 | [int] $SpaceBetweenColumns = 30, 119 | [int] $PositionX = 10, 120 | [int] $PositionY = 10, 121 | [int] $MonitorIndex = 0, 122 | [int] $SpaceX = 10, 123 | [int] $SpaceY = 10, 124 | [ValidateSet('Center', 'Fit', 'Stretch', 'Tile', 'Span', 'Fill')][string] $WallpaperFit, 125 | [ValidateSet('TopLeft', 'TopCenter', 'TopRight', 'MiddleLeft', 'MiddleCenter', 'MiddleRight', 'BottomLeft', 'BottomCenter', 'BottomRight')][string] $TextPosition = 'TopLeft', 126 | [switch] $UseScreenCoordinates 127 | ) 128 | 129 | $ConfigurationPath = [io.path]::Combine($ConfigurationDirectory, "PowerBGInfoConfiguration.xml") 130 | if (Test-Path -LiteralPath $ConfigurationPath) { 131 | $Configuration = Import-Clixml -LiteralPath $ConfigurationPath 132 | } else { 133 | $Configuration = [ordered] @{ 134 | OriginalImage = '' 135 | } 136 | } 137 | 138 | if ($FilePath -eq "") { 139 | $WallpaperPath = Get-DesktopWallpaper -Index $MonitorIndex 140 | } else { 141 | $WallpaperPath = $FilePath 142 | } 143 | if ($WallpaperPath -eq "" -or (Test-Path -LiteralPath $WallpaperPath) -eq $false) { 144 | Write-Warning -Message "New-BGInfo - Wallpaper ($WallpaperPath) not found. Provide new wallpaper, or make sure one is already set." 145 | return 146 | } 147 | 148 | $Configuration['OriginalImage'] = $WallpaperPath 149 | 150 | # Copy wallpaper to use as a base 151 | $FileName = [io.path]::GetFileName($Configuration['OriginalImage']) 152 | $FileNameWithoutExtension = [io.path]::GetFileNameWithoutExtension(($Configuration['OriginalImage'])) 153 | $FileNameExtension = [io.path]::GetExtension($FileName) 154 | $NewFileName = "$($FileNameWithoutExtension)_PowerBgInfo" + $FileNameExtension 155 | $FilePathOutput = [io.path]::Combine($ConfigurationDirectory, $NewFileName) 156 | 157 | # Wallpaper and output are the same file, if so, we already applied BGInfo at least once 158 | if ($FilePathOutput -ne $Configuration['OriginalImage'] ) { 159 | Copy-Item -Path $Configuration['OriginalImage'] -Destination $FilePathOutput -Force 160 | } 161 | # We need to check if file exists, because Copy-Item may not do what it's supposed to do 162 | if ($FilePathOutput -eq "" -or (Test-Path -LiteralPath $FilePathOutput) -eq $false) { 163 | Write-Warning -Message "New-BGInfo - Wallpaper ($FilePathOutput) not found. Copying failed?" 164 | return 165 | } 166 | # Load the file and get monitor info 167 | $Image = Get-Image -FilePath $FilePathOutput 168 | if ($UseScreenCoordinates) { 169 | $Monitor = Get-DesktopMonitor -Index $MonitorIndex 170 | $ScreenWidth = $Monitor.PositionRight - $Monitor.PositionLeft 171 | $ScreenHeight = $Monitor.PositionBottom - $Monitor.PositionTop 172 | 173 | # Handle image scaling based on WallpaperFit 174 | if ($WallpaperFit -in 'Fill', 'Stretch') { 175 | $Image.Resize($ScreenWidth, $ScreenHeight) 176 | $ScaleX = 1 177 | $ScaleY = 1 178 | } else { 179 | # Calculate scaling factors 180 | $ScaleX = $ScreenWidth / $Image.Width 181 | $ScaleY = $ScreenHeight / $Image.Height 182 | } 183 | } else { 184 | $ScaleX = 1 185 | $ScaleY = 1 186 | } 187 | 188 | $BGContent = & $BGInfoContent 189 | 190 | # Do assessment of the longest text so we can make sure columns are not overlapping 191 | $HighestWidth = 0 192 | $HighestHeight = 0 193 | $HighestValueWidth = 0 194 | foreach ($Info in $BGContent) { 195 | 196 | if (-not $Info.Color) { 197 | $Info.Color = $Color 198 | } 199 | if (-not $Info.FontSize) { 200 | $Info.FontSize = $FontSize 201 | } 202 | if (-not $Info.FontFamilyName) { 203 | $Info.FontFamilyName = $FontFamilyName 204 | } 205 | if ($Info.Type -ne 'Label') { 206 | if (-not $Info.ValueColor) { 207 | if ($Info.Color) { 208 | $Info.ValueColor = $Info.Color 209 | } else { 210 | $Info.ValueColor = $ValueColor 211 | } 212 | } 213 | if (-not $Info.ValueFontSize) { 214 | if ($Info.FontSize) { 215 | $Info.ValueFontSize = $Info.FontSize 216 | } else { 217 | $Info.ValueFontSize = $ValueFontSize 218 | } 219 | } 220 | if (-not $Info.ValueFontFamilyName) { 221 | if ($Info.FontFamilyName) { 222 | $Info.ValueFontFamilyName = $Info.FontFamilyName 223 | } else { 224 | $Info.ValueFontFamilyName = $ValueFontFamilyName 225 | } 226 | } 227 | } 228 | $SizeOfText = $Image.GetTextSize($Info.Name, $Info.FontSize, $Info.FontFamilyName) 229 | if ($SizeOfText.Width -gt $HighestWidth) { 230 | $HighestWidth = $SizeOfText.Width 231 | } 232 | if ($SizeOfText.Height -gt $HighestHeight) { 233 | $HighestHeight = $SizeOfText.Height 234 | } 235 | # Calculate the width of value column 236 | if ($Info.Type -ne 'Label') { 237 | $ValueSize = $Image.GetTextSize($Info.Value, $Info.ValueFontSize, $Info.ValueFontFamilyName) 238 | if ($ValueSize.Width -gt $HighestValueWidth) { 239 | $HighestValueWidth = $ValueSize.Width 240 | } 241 | } 242 | } 243 | 244 | # Calculate total width needed for both columns 245 | $TotalWidth = $HighestWidth + $SpaceBetweenColumns + $HighestValueWidth 246 | 247 | # Calculate positions with scaling if using screen coordinates 248 | if ($UseScreenCoordinates) { 249 | if ($TextPosition -eq 'TopLeft') { 250 | $StartX = $SpaceX / $ScaleX 251 | $PositionY = $SpaceY / $ScaleY 252 | } elseif ($TextPosition -eq 'TopCenter') { 253 | $StartX = ($ScreenWidth / 2 - $TotalWidth * $ScaleX / 2) / $ScaleX 254 | $PositionY = $SpaceY / $ScaleY 255 | } elseif ($TextPosition -eq 'TopRight') { 256 | $StartX = ($ScreenWidth - $TotalWidth * $ScaleX - $SpaceX) / $ScaleX 257 | $PositionY = $SpaceY / $ScaleY 258 | } elseif ($TextPosition -eq 'MiddleLeft') { 259 | $StartX = $SpaceX / $ScaleX 260 | $PositionY = ($ScreenHeight / 2 - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY / 2) / $ScaleY 261 | } elseif ($TextPosition -eq 'MiddleCenter') { 262 | $StartX = ($ScreenWidth / 2 - $TotalWidth * $ScaleX / 2) / $ScaleX 263 | $PositionY = ($ScreenHeight / 2 - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY / 2) / $ScaleY 264 | } elseif ($TextPosition -eq 'MiddleRight') { 265 | $StartX = ($ScreenWidth - $TotalWidth * $ScaleX - $SpaceX) / $ScaleX 266 | $PositionY = ($ScreenHeight / 2 - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY / 2) / $ScaleY 267 | } elseif ($TextPosition -eq 'BottomLeft') { 268 | $StartX = $SpaceX / $ScaleX 269 | $PositionY = ($ScreenHeight - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY - $SpaceY) / $ScaleY 270 | } elseif ($TextPosition -eq 'BottomCenter') { 271 | $StartX = ($ScreenWidth / 2 - $TotalWidth * $ScaleX / 2) / $ScaleX 272 | $PositionY = ($ScreenHeight - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY - $SpaceY) / $ScaleY 273 | } elseif ($TextPosition -eq 'BottomRight') { 274 | $StartX = ($ScreenWidth - $TotalWidth * $ScaleX - $SpaceX) / $ScaleX 275 | $PositionY = ($ScreenHeight - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) * $ScaleY - $SpaceY) / $ScaleY 276 | } 277 | } else { 278 | # Use existing image-based positioning code 279 | if ($TextPosition -eq 'TopLeft') { 280 | $StartX = $SpaceX 281 | $PositionY = $SpaceY 282 | } elseif ($TextPosition -eq 'TopCenter') { 283 | $StartX = ($Image.Width / 2) - ($TotalWidth / 2) 284 | $PositionY = $SpaceY 285 | } elseif ($TextPosition -eq 'TopRight') { 286 | $StartX = $Image.Width - $TotalWidth - $SpaceX 287 | $PositionY = $SpaceY 288 | } elseif ($TextPosition -eq 'MiddleLeft') { 289 | $StartX = $SpaceX 290 | $PositionY = ($Image.Height / 2) - (($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) / 2) 291 | } elseif ($TextPosition -eq 'MiddleCenter') { 292 | $StartX = ($Image.Width / 2) - ($TotalWidth / 2) 293 | $PositionY = ($Image.Height / 2) - (($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) / 2) 294 | } elseif ($TextPosition -eq 'MiddleRight') { 295 | $StartX = $Image.Width - $TotalWidth - $SpaceX 296 | $PositionY = ($Image.Height / 2) - (($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) / 2) 297 | } elseif ($TextPosition -eq 'BottomLeft') { 298 | $StartX = $SpaceX 299 | $PositionY = $Image.Height - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) - $SpaceY 300 | } elseif ($TextPosition -eq 'BottomCenter') { 301 | $StartX = ($Image.Width / 2) - ($TotalWidth / 2) 302 | $PositionY = $Image.Height - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) - $SpaceY 303 | } elseif ($TextPosition -eq 'BottomRight') { 304 | $StartX = $Image.Width - $TotalWidth - $SpaceX 305 | $PositionY = $Image.Height - ($BGContent.Count * ($HighestHeight + $SpaceBetweenLines)) - $SpaceY 306 | } 307 | } 308 | 309 | $PositionX = $StartX 310 | 311 | # Add text 312 | foreach ($Info in $BGContent) { 313 | if ($Info.Type -eq 'Label') { 314 | $Image.AddText($PositionX, $PositionY, $Info.Name, $Info.Color, $Info.FontSize, $Info.FontFamilyName) 315 | } else { 316 | $Image.AddText($PositionX, $PositionY, $Info.Name, $Info.Color, $Info.FontSize, $Info.FontFamilyName) 317 | $Image.AddText($PositionX + $HighestWidth + $SpaceBetweenColumns, $PositionY, $Info.Value, $Info.ValueColor, $Info.ValueFontSize, $Info.ValueFontFamilyName) 318 | } 319 | $PositionY += $HighestHeight + $SpaceBetweenLines 320 | } 321 | # lets now save image after modifications 322 | Save-Image -Image $Image -FilePath $FilePathOutput 323 | 324 | # finally lets set the image as wallpapeer 325 | if ($WallpaperFit) { 326 | Set-DesktopWallpaper -Index $MonitorIndex -FilePath $FilePathOutput -Position $WallpaperFit 327 | } else { 328 | Set-DesktopWallpaper -Index $MonitorIndex -FilePath $FilePathOutput 329 | } 330 | 331 | # lets export configuration, so we know what was done 332 | $Configuration | Export-Clixml -LiteralPath $ConfigurationPath -Force 333 | } -------------------------------------------------------------------------------- /Public/New-BGInfoLabel.ps1: -------------------------------------------------------------------------------- 1 | function New-BGInfoLabel { 2 | <# 3 | .SYNOPSIS 4 | Provides ability to set label without value. It can be used to separate different sections of information. 5 | 6 | .DESCRIPTION 7 | Provides ability to set label without value. It can be used to separate different sections of information. 8 | 9 | .PARAMETER Name 10 | Name of the label/section 11 | 12 | .PARAMETER Color 13 | Color for the label. If not provided it will be taken from the parent New-BGInfo command. 14 | 15 | .PARAMETER FontSize 16 | Font size for the label. If not provided it will be taken from the parent New-BGInfo command. 17 | 18 | .PARAMETER FontFamilyName 19 | Font family name for the label. If not provided it will be taken from the parent New-BGInfo command. 20 | 21 | .EXAMPLE 22 | # Lets add Label, but without any values, kinf of like section starting 23 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 24 | 25 | .NOTES 26 | General notes 27 | #> 28 | [CmdletBinding()] 29 | param( 30 | [string] $Name, 31 | [SixLabors.ImageSharp.Color] $Color, 32 | [float] $FontSize, 33 | [string] $FontFamilyName 34 | ) 35 | [PSCustomObject] @{ 36 | Type = 'Label' 37 | Name = $Name 38 | Color = $Color 39 | FontSize = $FontSize 40 | FontFamilyName = $FontFamilyName 41 | } 42 | } -------------------------------------------------------------------------------- /Public/New-BGInfoValue.ps1: -------------------------------------------------------------------------------- 1 | function New-BGInfoValue { 2 | <# 3 | .SYNOPSIS 4 | Special function that provides a way to create a value that will be displayed on the background image. 5 | 6 | .DESCRIPTION 7 | Special function that provides a way to create a value that will be displayed on the background image. 8 | It allows using builtin values, or custom values depending on user needs. 9 | 10 | .PARAMETER Name 11 | Label that will be used on the left side of the value. 12 | 13 | .PARAMETER Value 14 | Cystom Value that will be displayed on the right side of the label. 15 | 16 | .PARAMETER BuiltinValue 17 | Builtin value that will be displayed on the right side of the label. It can be one of the following: 18 | - UserName - Current user name 19 | - HostName - Current host name 20 | - FullUserName - Current user name with domain 21 | - CpuName - CPU name 22 | - CpuMaxClockSpeed - CPU max clock speed 23 | - CpuCores - CPU cores 24 | - CpuLogicalCores - CPU logical cores 25 | - RAMSize - RAM size 26 | - RAMSpeed - RAM speed 27 | - RAMPartNumber - RAM part number 28 | - BiosVersion - BIOS version 29 | - BiosManufacturer - BIOS manufacturer 30 | - BiosReleaseDate - BIOS release date 31 | - OSName - OS name 32 | - OSVersion - OS version 33 | - OSArchitecture - OS architecture 34 | - OSBuild - OS build 35 | - OSInstallDate - OS install date 36 | - OSLastBootUpTime - OS last boot up time 37 | - UserDNSDomain - User DNS domain 38 | - FQDN - Fully qualified domain name 39 | - IPv4Address - IPv4 address 40 | - IPv6Address - IPv6 address 41 | 42 | .PARAMETER Color 43 | Color for the label. If not provided it will be taken from the parent New-BGInfo command. 44 | 45 | .PARAMETER FontSize 46 | Font size for the label. If not provided it will be taken from the parent New-BGInfo command. 47 | 48 | .PARAMETER FontFamilyName 49 | Font family name for the label. If not provided it will be taken from the parent New-BGInfo command. 50 | 51 | .PARAMETER ValueColor 52 | Color for the value. If not provided it will be taken first from Color of the label and if that is not provided from the parent New-BGInfo command. 53 | 54 | .PARAMETER ValueFontSize 55 | Font size for the value. If not provided it will be taken first from FontSize of the label and if that is not provided from the parent New-BGInfo command. 56 | 57 | .PARAMETER ValueFontFamilyName 58 | Font family name for the value. If not provided it will be taken first from FontFamilyName of the label and if that is not provided from the parent New-BGInfo command. 59 | 60 | .EXAMPLE 61 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 62 | New-BGInfoValue -BuiltinValue FullUserName 63 | New-BGInfoValue -BuiltinValue CpuName 64 | 65 | .EXAMPLE 66 | # Lets get all drives and their labels 67 | foreach ($Disk in (Get-Disk)) { 68 | $Volumes = $Disk | Get-Partition | Get-Volume 69 | foreach ($V in $Volumes) { 70 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 71 | } 72 | } 73 | 74 | .NOTES 75 | General notes 76 | #> 77 | [CmdletBinding(DefaultParameterSetName = 'Values')] 78 | param( 79 | [parameter(ParameterSetName = 'Builtin')] 80 | [parameter(ParameterSetName = 'Values', Mandatory)] 81 | [string] $Name, 82 | [parameter(ParameterSetName = 'Values', Mandatory)] 83 | [string] $Value, 84 | [parameter(ParameterSetName = 'Builtin', Mandatory)] 85 | [ValidateSet( 86 | 'UserName', 'HostName', 'FullUserName', 87 | 'CpuName', 'CpuMaxClockSpeed', 'CpuCores', 'CpuLogicalCores', 88 | 'RAMSize', 'RAMSpeed', 'RAMPartNumber', 89 | 'BiosVersion', 'BiosManufacturer', 'BiosReleaseDate', 90 | 'OSName', 'OSVersion', 'OSArchitecture', 'OSBuild', 'OSInstallDate', 'OSLastBootUpTime', 91 | 'UserDNSDomain', 'FQDN', 92 | 'IPv4Address', 'IPv6Address' 93 | )][string] $BuiltinValue, 94 | [parameter(ParameterSetName = 'Values')] 95 | [parameter(ParameterSetName = 'Builtin')] 96 | [SixLabors.ImageSharp.Color] $Color, 97 | [parameter(ParameterSetName = 'Values')] 98 | [parameter(ParameterSetName = 'Builtin')] 99 | [float] $FontSize, 100 | [parameter(ParameterSetName = 'Values')] 101 | [parameter(ParameterSetName = 'Builtin')] 102 | [string] $FontFamilyName, 103 | [parameter(ParameterSetName = 'Values')] 104 | [parameter(ParameterSetName = 'Builtin')] 105 | [SixLabors.ImageSharp.Color] $ValueColor, 106 | [parameter(ParameterSetName = 'Values')] 107 | [parameter(ParameterSetName = 'Builtin')] 108 | [float] $ValueFontSize, 109 | [parameter(ParameterSetName = 'Values')] 110 | [parameter(ParameterSetName = 'Builtin')] 111 | [string] $ValueFontFamilyName 112 | ) 113 | 114 | if ($BuiltinValue) { 115 | if ($BuiltinValue -in 'CPUName', 'CpuMaxClockSpeed', 'CpuCores', 'CpuLogicalCores') { 116 | $ComputerCPU = Get-ComputerCPU 117 | } elseif ($BuiltinValue -in 'RAMSize', 'RAMSpeed', 'RAMPartNumber') { 118 | $ComputerRAM = Get-ComputerRAM 119 | } elseif ($BuiltinValue -in 'BiosVersion', 'BiosManufacturer', 'BiosReleaseDate') { 120 | $ComputerBios = Get-ComputerBios 121 | } elseif ($BuiltinValue -in 'OSName', 'OSVersion', 'OSArchitecture', 'OSBuild', 'OSInstallDate', 'OSLastBootUpTime') { 122 | $ComputerOS = Get-ComputerOperatingSystem 123 | } 124 | if ($BuiltinValue -eq 'UserName') { 125 | $SetValue = $env:USERNAME 126 | } elseif ($BuiltinValue -eq 'HostName') { 127 | $SetValue = $env:COMPUTERNAME 128 | } elseif ($BuiltinValue -eq 'FullUserName') { 129 | $SetValue = $env:USERDOMAIN + '\' + $env:USERNAME 130 | } elseif ($BuiltinValue -eq 'CPUName') { 131 | $SetValue = $ComputerCPU.Name 132 | } elseif ($BuiltinValue -eq 'CpuMaxClockSpeed') { 133 | $SetValue = $ComputerCPU.MaxClockSpeed 134 | } elseif ($BuiltinValue -eq 'CpuCores') { 135 | $SetValue = $ComputerCPU.NumberOfEnabledCore 136 | } elseif ($BuiltinValue -eq 'CpuLogicalCores') { 137 | $SetValue = $ComputerCPU.NumberOfLogicalProcessors 138 | } elseif ($BuiltinValue -eq 'RAMSize') { 139 | $SetValue = ($ComputerRAM.Size | ForEach-Object { $_.ToString('N0') + 'GB' }) -join " / " 140 | } elseif ($BuiltinValue -eq 'RAMSpeed') { 141 | $SetValue = ($ComputerRAM.Speed | ForEach-Object { $_.ToString('N0') + 'MHz' }) -join " / " 142 | } elseif ($BuiltinValue -eq 'RAMPartNumber') { 143 | $SetValue = $ComputerRAM.PartNumber.Trim() -join ", " 144 | } elseif ($BuiltinValue -eq 'BiosVersion') { 145 | $SetValue = $ComputerBios.Version 146 | } elseif ($BuiltinValue -eq 'BiosManufacturer') { 147 | $SetValue = $ComputerBios.Manufacturer 148 | } elseif ($BuiltinValue -eq 'BiosReleaseDate') { 149 | $SetValue = $ComputerBios.ReleaseDate 150 | } elseif ($BuiltinValue -eq 'OSName') { 151 | $SetValue = $ComputerOS.OperatingSystem 152 | } elseif ($BuiltinValue -eq 'OSVersion') { 153 | $SetValue = $ComputerOS.OperatingSystemVersion 154 | } elseif ($BuiltinValue -eq 'OSArchitecture') { 155 | $SetValue = $ComputerOS.OSArchitecture 156 | } elseif ($BuiltinValue -eq 'OSBuild') { 157 | $SetValue = $ComputerOS.OperatingSystemBuild 158 | } elseif ($BuiltinValue -eq 'OSInstallDate') { 159 | $SetValue = $ComputerOS.InstallDate 160 | } elseif ($BuiltinValue -eq 'OSLastBootUpTime') { 161 | $SetValue = $ComputerOS.LastBootUpTime 162 | } elseif ($BuiltinValue -eq 'UserDNSDomain') { 163 | $SetValue = $env:USERDNSDOMAIN 164 | } elseif ($BuiltinValue -eq 'FQDN') { 165 | $SetValue = ((Get-CimInstance win32_computersystem).name + '.' + (Get-CimInstance win32_computersystem).domain).ToLower() 166 | } elseif ($BuiltinValue -eq 'IPv4Address') { 167 | $SetValue = (Get-NetIPConfiguration | Where-Object { $null -ne $_.IPv4DefaultGateway -and $_.NetAdapter.Status -ne "Disconnected" }).IPv4Address.IPAddress 168 | } elseif ($BuiltinValue -eq 'IPv6Address') { 169 | $SetValue = (Get-NetIPConfiguration | Where-Object { $null -ne $_.IPv4DefaultGateway -and $_.NetAdapter.Status -ne "Disconnected" }).IPv6Address.IPAddress 170 | } 171 | if ($Name) { 172 | $SetName = $Name 173 | } else { 174 | $SetName = $BuiltinValue 175 | } 176 | } else { 177 | $SetValue = $Value 178 | $SetName = $Name 179 | } 180 | 181 | [PSCustomObject] @{ 182 | Type = 'Values' 183 | Name = $SetName 184 | Value = $SetValue 185 | Color = $Color 186 | FontSize = $FontSize 187 | FontFamilyName = $FontFamilyName 188 | ValueColor = $ValueColor 189 | ValueFontSize = $ValueFontSize 190 | ValueFontFamilyName = $ValueFontFamilyName 191 | } 192 | } -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | 

2 | 3 | 4 | 5 | 6 |

7 | 8 |

9 | 10 | 11 | 12 | 13 |

14 | 15 |

16 | 17 | 18 | 19 |

20 | 21 | **PowerBGInfo** is a PowerShell module that is used to generate background information for Windows machines. 22 | It's a replacement for [BGInfo](https://technet.microsoft.com/en-us/sysinternals/bginfo.aspx) that doesn't require installation and is much more flexible. 23 | 24 | You can read about this project on this [blog post](https://evotec.xyz/powerbginfo-powershell-alternative-to-sysinternals-bginfo/) that tells a little backstory and shows few things. 25 | 26 | ## Installation 27 | 28 | Install from [PowerShell Gallery](https://www.powershellgallery.com/packages/PowerBGInfo) is as easy as: 29 | 30 | ```powershell 31 | Install-Module PowerBGInfo -Force -Verbose 32 | ``` 33 | 34 | When there's an update you can update it using same command which will install new module version. 35 | 36 | ## Known Issues 37 | 38 | This module will work fine for PowerShell 5.1 and PowerShell 7+. 39 | **Currently the module has a problem when running in VSCode PowerShell extension when on PowerShell 5.1 (other versions work fine!)** 40 | It works fine when running in PowerShell 5.1 console, or ISE (shrug!). 41 | 42 | ## Usage 43 | 44 | Here's a small taste of the code: 45 | 46 | ```powershell 47 | New-BGInfo -MonitorIndex 0 { 48 | # Lets add computer name, but lets use builtin values for that 49 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 50 | # Lets add user name, but lets use builtin values for that 51 | New-BGInfoValue -BuiltinValue FullUserName -Name "FullUserName" -Color White 52 | New-BGInfoValue -BuiltinValue CpuName 53 | New-BGInfoValue -BuiltinValue CpuLogicalCores 54 | New-BGInfoValue -BuiltinValue RAMSize 55 | New-BGInfoValue -BuiltinValue RAMSpeed 56 | 57 | # Lets add Label, but without any values, kind of like section starting 58 | New-BGInfoLabel -Name "Drives" -Color LemonChiffon -FontSize 16 -FontFamilyName 'Calibri' 59 | 60 | # Lets get all drives and their labels 61 | foreach ($Disk in (Get-Disk)) { 62 | $Volumes = $Disk | Get-Partition | Get-Volume 63 | foreach ($V in $Volumes) { 64 | New-BGInfoValue -Name "Drive $($V.DriveLetter)" -Value $V.SizeRemaining 65 | } 66 | } 67 | } -FilePath $PSScriptRoot\Samples\PrzemyslawKlysAndKulkozaurr.jpg -ConfigurationDirectory $PSScriptRoot\Output -PositionX 100 -PositionY 100 -WallpaperFit Center 68 | ``` 69 | 70 | Here's how the wallpaper will look like: 71 | 72 | ![PowerBGInfo](https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/master/Examples/Output/PrzemyslawKlysAndKulkozaurr.jpg) 73 | 74 | You can also use only builtin values 75 | 76 | ```powershell 77 | New-BGInfo -MonitorIndex 0 { 78 | # Lets add computer name, but lets use builtin values for that 79 | New-BGInfoValue -BuiltinValue HostName -Color Red -FontSize 20 -FontFamilyName 'Calibri' 80 | New-BGInfoValue -BuiltinValue FullUserName -Color White 81 | New-BGInfoValue -BuiltinValue CpuName -Color White 82 | New-BGInfoValue -BuiltinValue CpuLogicalCores -Color White -ValueColor Red 83 | New-BGInfoValue -BuiltinValue RAMSize -Color White 84 | New-BGInfoValue -BuiltinValue RAMSpeed -Color White -ValueColor ([SixLabors.ImageSharp.Color]::Aquamarine) 85 | New-BGInfoValue -BuiltinValue RAMPartNumber -Color White 86 | New-BGInfoValue -BuiltinValue BiosVersion -Color White 87 | New-BGInfoValue -BuiltinValue BiosManufacturer -Color White 88 | New-BGInfoValue -BuiltinValue BiosReleaseDate -Color White 89 | New-BGInfoValue -BuiltinValue OSName -Color White -Name "Operating System" 90 | New-BGInfoValue -BuiltinValue OSVersion -Color White 91 | New-BGInfoValue -BuiltinValue OSArchitecture -Color White 92 | New-BGInfoValue -BuiltinValue OSBuild -Color White 93 | New-BGInfoValue -BuiltinValue OSInstallDate -Color White 94 | New-BGInfoValue -BuiltinValue OSLastBootUpTime -Color White 95 | 96 | } -FilePath "C:\Support\GitHub\PowerBGInfo\Examples\Samples\TapN-Evotec-1600x900.jpg" -ConfigurationDirectory $PSScriptRoot\Output -PositionX 75 -PositionY 75 -WallpaperFit Fit 97 | ``` 98 | 99 | Here's the output from command above 100 | 101 | ![PowerBGInfo](https://raw.githubusercontent.com/EvotecIT/PowerBGInfo/master/Examples/Output/TapN-Evotec-1600x900.jpg) --------------------------------------------------------------------------------