CrowdStrike / psfalcon

PowerShell for CrowdStrike's OAuth2 APIs
The Unlicense
350 stars 66 forks source link

[ BUG ] `Find-FalconHostname` returns maximum of 100 results #369

Closed bk-cs closed 1 week ago

bk-cs commented 9 months ago

Describe the bug Find-FalconHostname cuts off at the first 100 results instead of returning the entire list

To Reproduce Add more than 100 hostnames to a text file and use it with Path, or submit an array of more than 100 values.

Environment (please complete the following information):

bk-cs commented 9 months ago

I was able to reproduce this and determine that the problem comes from the reuse of a variable during the for loop. This mistake ruins the list of supplied hostname values after the first request (which contains 100 hostnames) is submitted, which ultimately limits the output to 100 results.

I'm working on a fix to be implemented in the next release and checking if there are any performance improvements to be made with the command in general.

bk-cs commented 9 months ago

If you'd like to fix your local Find-FalconHostname command before the next release and you're currently using version 2.2.6, you can use one of the commands listed below.

Update file using PowerShell 5.1 on Windows:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/CrowdStrike/psfalcon/aeba5e11d56fccf684b2a609cf28f8f0e91c08bf/public/psf-devices.ps1 -UseBasicParsing).Content > $HOME\Documents\WindowsPowerShell\Modules\PSFalcon\2.2.6\Public\psf-devices.ps1

Update file using PowerShell Core on Windows:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/CrowdStrike/psfalcon/aeba5e11d56fccf684b2a609cf28f8f0e91c08bf/public/psf-devices.ps1 -UseBasicParsing).Content > $HOME\Documents\PowerShell\Modules\PSFalcon\2.2.6\Public\psf-devices.ps1

Update file using PowerShell Core on Linux/Mac:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/CrowdStrike/psfalcon/aeba5e11d56fccf684b2a609cf28f8f0e91c08bf/public/psf-devices.ps1 -UseBasicParsing).Content > $HOME/.local/share/PowerShell/Modules/PSFalcon/2.2.6/Public/psf-devices.ps1

If you're using an earlier version, replace 2.2.6 with your currently installed version number.

bk-cs commented 1 week ago

This fix is included in the 2.2.7 release.