Skip to content

Find-FalconDuplicate is giving a 0 KB file #267

Answered by bk-cs
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Find-FalconDuplicate returns a warning message instead of standard output if no duplicates are found. Is that what you see if you try the command outside of your script? If you're only receiving the warning message, I would expect a blank CSV.

Adding an if statement will solve the script issue:

Import-Module -Name PSFalcon
Request-FalconToken -Cloud us-2 -ClientId ... -ClientSecret ...
$Duplicate = Find-FalconDuplicate
if ($Duplicate) {
    $Timestamp = Get-Date -Format FileDate
    $Duplicate | Export-Csv "$(Join-Path $env:SystemDrive ('duplicates',$Timestamp -join '_')).csv" -NoTypeInformation -Append
    Invoke-FalconHostAction -Name hide_host -Id $Duplicate.device_id
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant