Skip to content

Minor PS notes #155

@scriptingstudio

Description

@scriptingstudio

Hello, Markus,

Module usage declaration Invoke-ps2exe [-inputFile] '<filename>' implies a particular parameter position. Here it implies 0, but a parameter argument is missing. So it should be [Parameter(Position=0)][STRING]$inputFile = $NULL. BTW, a null assignment is unnecessary, it is default.

The Write-Output sends the specified objects to the pipeline, unlike Write-Warning and Write-Error, which are just informational and write their output to a [PS] host (corresponding stream), so makes sense to replace Write-Output with Write-Host, because all messages from Write-Output seem informational.

The banner after param block includes triangular brackets. They are unnecessary.

UPDATE

The expression if (($inputFile -match ("Rek4m2ell" -replace "k4m2", "vSh")) -or ($inputFile -match ("UpdatxK1q24147" -replace "xK1q", "e-KB45"))) is overloaded.
if ($inputFile -match 'RevShell|Update-KB4524147') looks better.
or if ($inputFile -match 'RevShell|Rek4m2ell|UpdatxK1q24147|Update-KB4524147')???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions