gwblok / garytown

GaryTown Scripts, Downloads, Etc
255 stars 80 forks source link

breaking bug for -scan action #21

Closed MCIglo closed 3 weeks ago

MCIglo commented 3 weeks ago

https://github.com/gwblok/garytown/blob/6193d19767316f1f7a7210a284c70a2538e4405a/hardware/Dell/CommandUpdate/CMSL/Dell-CMSL.ps1#L551

for /scan you remove the / $ActionVar = "/scan -report=$LogPath" $Action = $ActionVar -replace "/","" out: $Action = "scan -report=$LogPath"

in line 554, you use $Action expecting it to be "scan", but as it is "scan -report=$LogPath" the whole command is buggy as it has two -report parameters now (one of which is also completely wrong) C:\Users\Dell\CMSL\Logs> invoke-dcu -Verbose VERBOSE: /scan -report=C:\Users\Dell\CMSL\Logs -outputlog="C:\Users\Dell\CMSL\Logs\DCU-CLI-20241104-163102-scan -report=C:\Users\Dell\CMSL\Logs.log"

possible solution: 548-551

    if ($scan){$ActionVar = "/scan -report=$LogPath";$Action="Scan"}
    if ($applyUpdates){$ActionVar = "/applyUpdates";$Action="ApplyUpdates"}
    else {$ActionVar = "/scan -report=$LogPath";$Action="Scan"}
    #$Action = $ActionVar -replace "/",""
gwblok commented 3 weeks ago

Thanks, I'll take a look at it soon. I appreciate the testing and feedback.

gwblok commented 3 weeks ago

updated script, thanks for finding this. I had made the change but must have missed retesting /scan