Get-ZimmermanTools icon indicating copy to clipboard operation
Get-ZimmermanTools copied to clipboard

Script crash when terminal does not support color

Open FormindAPE opened this issue 1 year ago • 2 comments

When using the script to install all tools using ansible(winrm), the script crash without dowloading. the exeption is cause because $defaultColor is $null

Cannot convert null to type "System.ConsoleColor" due to enumeration values that are not valid. Specify one of the following enumeration values and try again. The possible enumeration values are "Black;DarkBlue;DarkGreen;DarkCyan;DarkRed;DarkMagenta;DarkYellow;Gray;DarkGray;Blue;Green;Cyan;Red;Magenta;Yellow;White".

this si caused by following line (line 232) that could set TestColor to $null https://github.com/EricZimmerman/Get-ZimmermanTools/blob/c40e8ddc8df5a210c5d9155194e602a81532f23d/Get-ZimmermanTools.ps1#L232-L240 to fix the issue, the condition (line 233) must be change by:

if ($TestColor -eq -1 -or $null -eq $TestColor ) 

FormindAPE avatar Apr 19 '24 09:04 FormindAPE

@FormindAPE have you tested this?

FYI, I made a PR with this change so please advise when you can - https://github.com/EricZimmerman/Get-ZimmermanTools/pull/6

AndrewRathbun avatar Apr 22 '24 01:04 AndrewRathbun

please let us know and if its working i can get it signed and deployed.

thanks

EricZimmerman avatar Apr 22 '24 15:04 EricZimmerman

This works like a charm !!

FormindAPE avatar Aug 19 '24 07:08 FormindAPE