davehull / Kansa

A Powershell incident response framework
Apache License 2.0
1.56k stars 266 forks source link

Get-Modules function fails when a specified module path contains a space #213

Closed MurrayR0123 closed 2 years ago

MurrayR0123 commented 2 years ago

Hi Folks,

Line 498 has a split operation to account for when a user passes a full path to a specific module with an argument, however what might be an unintended consequence of this operation leads to the function crashing out with the error below if the directory path to the modules contains a space character.

"Exception calling "Add" with "2" argument(s): "Key cannot be null. Parameter name: key

Cannot find path 'c:\path\that contains\a\space' "