mattifestation/CimSweep

Get-CSService: -IncludeFileInfo can potentially not normalize file paths correctly

mattifestation opened this issue · 0 comments

Get-CSService uses the following regex to extract normalized service path binaries: (?<ServicePath>[a-z]:\\.+(\.exe|\.dll)). This will fail to pull out the correct service path given the following example: "C:\Windows\System32\foo.exe" /arg bar.exe.

The regex should match on the fewest number of characters versus the most. A better regex would be the following: (?<ServicePath>[a-z]:\\.+?(\.exe|\.dll))