< Back

Export-OMSSavedSearch

Sat Jan 18, 2020 5:49 pm

NAME Export-OMSSavedSearch



SYNOPSIS

Exports saved searches from OMS workspace to

file in json format.





SYNTAX

Export-OMSSavedSearch [-Token] <String> [-SubscriptionID] <String> [-ResourceGroupName] <String>

[-OMSWorkspaceName] <String> [-FileName] <String> [-OutputPath] <String> [[-QueryName] <String[]>] [[-APIVersion]

<String>] [<CommonParameters>]



Export-OMSSavedSearch [-Token] <String> [-OMSConnection] <Object> [-FileName] <String> [-OutputPath] <String>

[[-QueryName] <String[]>] [[-APIVersion] <String>] [<CommonParameters>]





DESCRIPTION

Exports saved searches from OMS workspace to

file in json format.





PARAMETERS

-Token <String>

Token aquired from Get-AADToken cmdlet.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OMSConnection <Object>

Object that contains all needed parameters for working

with OMSSearch Module. You can create such object in

OMS Automation as connection asset.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SubscriptionID <String>

Azure Subscription ID where the OMS workspace

is located.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ResourceGroupName <String>

Azure Resource Group Name where the OMS

workspace is located.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OMSWorkspaceName <String>

Name of the OMS workspace.



Required? true

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-FileName <String>

The name of the file to which the saved

searches will be exported.



Required? true

Position? 5

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OutputPath <String>

The location to the folder where the

exported saved search will saved.



Required? true

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-QueryName <String[]>

Query name/names of the saved searches

to be exported.



Required? false

Position? 7

Default value

Accept pipeline input? false

Accept wildcard characters? false



-APIVersion <String>

Api version for microsoft.operationalinsights

Azure Resource provider.



Required? false

Position? 8

Default value 2015-03-20

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

System.Object. Returns object with the location

of the file where the exported saved searches are

saved.





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



PS C:\\>Export-OMSSavedSearch -SubscriptionID $subscriptionId -ResourceGroupName $ResourceGroupName

-OMSWorkspaceName $OMSWorkspace -QueryName 'Restarted Servers','All_alerts' -FileName MySavedSearches -OutputPath

'D:\\OMS\\' -Token $Token -APIVersion '2015-03-20'



Description

-----------

Exports two saved searches into file MySavedSearches.json located in D:\\OMS\\

Uses specific version of Operational Insights API



Example Variables

-----------------

$Token = Get-AADToken -Credential (Get-Credential) -TenantID 'eeb91fce-4be2-4a30-aad8-39e05fefde0'

$subscriptionId = "3c1d68a5-4064-4522-94e4-e0378165555e"

$ResourceGroupName = "oi-default-east-us"

$OMSWorkspace = "Test"









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



PS C:\\>Export-OMSSavedSearch -SubscriptionID $subscriptionId -ResourceGroupName $ResourceGroupName

-OMSWorkspaceName $OMSWorkspace -FileName MySavedSearches -OutputPath 'D:\\OMS\\' -Token $Token



Description

-----------

Exports all saved searches from OMS workspace

Saved searches are exported to file MySavedSearches.json in folder D:\\OMS\\



Example Variables

-----------------

$subscriptionId = "3c1d68a5-4064-4522-94e4-e0378165555e"

$ResourceGroupName = "oi-default-east-us"

$OMSWorkspace = "Test"

$Token = Get-AADToken -Credential (Get-Credential) -TenantID 'eeb91fce-4be2-4a30-aad8-39e05fefde0'











RELATED LINKS