From 5b07970d641953cdb26266eb39a3a497ed64eec8 Mon Sep 17 00:00:00 2001 From: Pawel L <90756777+pzlgajowy@users.noreply.github.com> Date: Tue, 20 Sep 2022 11:19:06 +0200 Subject: [PATCH] Update get-VTFileReport.ps1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hello while runing script, I received error: "Write-Host : Cannot process the color because -1 is not a valid color. Nazwa parametru: value Rzeczywista wartość to -1. At C:\Users\%UserName%\Documents\Windows PowerShell\VirusTotal\get-VTFileReport.ps1:53 char:65 + ... "Positives : " -NoNewline; Write-Host $VTresult.positives -f $fore + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Write-Host], ArgumentOutOfRangeException + FullyQualifiedErrorId : SetInvalidForegroundColor,Microsoft.PowerShell.Commands.WriteHostCommand " I suggest solusion from stackOverflow community (https://stackoverflow.com/questions/26582880/powershell-get-default-foreground-color-for-write-host) Thank you for your usefull tool Best regards -- Pawel --- script/get-VTFileReport.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/get-VTFileReport.ps1 b/script/get-VTFileReport.ps1 index 6259471..4d1e506 100644 --- a/script/get-VTFileReport.ps1 +++ b/script/get-VTFileReport.ps1 @@ -42,7 +42,9 @@ Function submit-VTHash($VThash) $VTpct = [math]::Round($VTpct,2) } else { - $fore = (get-host).ui.rawui.ForegroundColor + # $fore = (get-host).ui.rawui.ForegroundColor + # regarding to https://stackoverflow.com/questions/26582880/powershell-get-default-foreground-color-for-write-host + $fore = [System.Console]::ForegroundColor $VTpct = 0 }