TrimarcJake / BlueTuxedo

A tiny tool to find and fix common misconfigurations in Active Directory-integrated DNS
Other
99 stars 7 forks source link

🪲 Show-BTLogo fails in PowerShell ISE #33

Open SamErde opened 1 month ago

SamErde commented 1 month ago

When running BlueTuxedo straight from the PowerShell ISE, the Show-Logo function returns an error whenever it tries to reset the background color.

PS C:\Tools> .\Invoke-BlueTuxedov2024.10-4dev.ps1
Write-Host : Cannot process the color because -1 is not a valid color.
Parameter name: value
Actual value was -1.
At C:\Tools\Invoke-BlueTuxedov2024.10-4dev.ps1:1461 char:5
+     Write-Host ' ' -BackgroundColor $BGColor
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Write-Host], ArgumentOutOfRangeException
    + FullyQualifiedErrorId : SetInvalidBackgroundColor,Microsoft.PowerShell.Commands.WriteHostCommand

        :::::::::  :::       :::    ::: :::::::::: ::::::::::: :::    ::: :::    ::: :::::::::: :::::::::   ::::::::

Apparently, the ISE returns nothing for $host.UI.RawUI.BackgroundColor. Will need to either find a different method to check the ISE background color or just assume the default blue background for now.

TrimarcJake commented 1 month ago

Oh dang. I just figured out how to do this the other day but thought "why would I ever need this?"