Closed David-M-Berry closed 5 months ago
Added the Hostname param.
The script still runs normally, but if you add the -Hostname "SPECIFICHOSTNAME" you can just get the output for a single host.
This allows the script to accept a hostname as an optional parameter.
Param ( [string]$Hostname )
This filters the retrieved host information to include only the specified hostname if provided.
# Retrieve all host information and filter to selected fields $HostInfo = if ($Hostname) { Get-FalconHost -Filter "hostname:'$Hostname'" -Detailed | Select-Object $Field } else { Get-FalconHost -Detailed -All | Select-Object $Field }
To run the script without filtering by hostname:
.\output-selected-host-info-and-replace-ids-with-names.ps1
To run the script and filter by a specific hostname:
.\output-selected-host-info-and-replace-ids-with-names.ps1 -Hostname "SpecificHostname"
This update ensures that the script can be used to retrieve information for all hosts or for a specific host, based on user input.
Thank you for the optimization suggestion @bk-cs !
Added the Hostname param.
The script still runs normally, but if you add the -Hostname "SPECIFICHOSTNAME" you can just get the output for a single host.
Update output-selected-host-info-and-replace-ids-with-names.ps1 to allow specific hostnames
Added features and functionality
Explanation of Changes
This allows the script to accept a hostname as an optional parameter.
This filters the retrieved host information to include only the specified hostname if provided.
Usage
To run the script without filtering by hostname:
To run the script and filter by a specific hostname:
This update ensures that the script can be used to retrieve information for all hosts or for a specific host, based on user input.