< Back

Start-ePoQuery

Sat Jan 18, 2020 7:49 pm

NAME Start-ePoQuery



SYNOPSIS

Runs a query using the ePo API.





SYNTAX

Start-ePoQuery -QueryId <Object> [-WhatIf] [-Confirm] [<CommonParameters>]



Start-ePoQuery -QueryName <Object> [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Sends the command specified to the McAfee EPO server. Connect-ePoServer has to be run first,

as this function uses the epoServer global variable created by that functions connection to the server. Uses the

Invoke-ePoCommand function.





PARAMETERS

-QueryId <Object>

The ID number of the query to be run.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-QueryName <Object>



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Added support for Whatif

Added logic that gets all queries so a QueryName parameter can be used instead of only the QueryId parameter.

TODO: Determine if I should change the name of this function and incorporate Get-ePoQuery into it as a

parameter.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Start-ePoQuery -QueryName "Duplicate Systems Names" -Verbose



Returns the output of the query named Duplicate Systems Name









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$ePoQueries = Get-ePoQuery



$QueryResults = $ePoQueries | Where {$_.Description -like "*unmanaged*"} | Start-ePoQuery

$QueryResults



Returns the output of the core.listQueries API command and stores the PowerShell custom object in a variable

$ePoQueries.

This is then piped to where-object to find queries with a description with unmanged in it.

This in then piped in turn to the Start-ePoQuery and the results are stored in a variable.











RELATED LINKS