Import-LMLogicModuleFromFile
Syntax
Section titled “Syntax”FilePath
Section titled “FilePath”Import-LMLogicModuleFromFile -FilePath <string> [-Type <string>] [-Format <string>] [-FieldsToPreserve <string>] [-HandleConflict <string>] [<CommonParameters>]Import-LMLogicModuleFromFile -File <Object> [-Type <string>] [-Format <string>] [-FieldsToPreserve <string>] [-HandleConflict <string>] [<CommonParameters>]Description
Section titled “Description”The Import-LMLogicModuleFromFile function imports a LogicModule from a file path or file data using the new XML and JSON import endpoints. Supports various module types including datasources, configsources, eventsources, batchjobs, logsources, oids, topologysources, functions, and diagnosticsources.
Examples
Section titled “Examples”EXAMPLE 1
Section titled “EXAMPLE 1”#Import a datasource module from XMLImport-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.xml" -Type "datasources" -Format "xml"EXAMPLE 2
Section titled “EXAMPLE 2”#Import a logsource module from JSON with conflict handlingImport-LMLogicModuleFromFile -FilePath "C:\LogicModules\logsource.json" -Type "logsources" -Format "json" -HandleConflict "FORCE_OVERWRITE"EXAMPLE 3
Section titled “EXAMPLE 3”#Import an eventsource from file data (read file content first with -Raw parameter)$fileData = Get-Content -Path "C:\LogicModules\eventsource.xml" -RawImport-LMLogicModuleFromFile -File $fileData -Type "eventsources" -Format "xml"EXAMPLE 4
Section titled “EXAMPLE 4”#Import with fields to preserveImport-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.json" -Type "datasources" -Format "json" -FieldsToPreserve "description,appliesTo"Parameters
Section titled “Parameters”-FieldsToPreserve
Section titled “-FieldsToPreserve”Optional. Comma-separated list of fields to preserve during import. Only applies to JSON imports. Defaults to preserving none of the fields. Valid values are “NAME”, “APPLIES_TO_SCRIPT”, “COLLECTION_INTERVAL”, “ACTIVE_DISCOVERY_INTERVAL”, “ACTIVE_DISCOVERY_FILTERS”, “MODULE_GROUP”, “DISPLAY_NAME”, “USE_WILD_VALUE_AS_UUID”, “DATAPOINT_ALERT_THRESHOLDS”, “TAGS”. “NAME” will preserve the name of the LogicModule. “APPLIES_TO_SCRIPT” will preserve the appliesToScript of the LogicModule. “COLLECTION_INTERVAL” will preserve the collectionInterval of the LogicModule. “ACTIVE_DISCOVERY_INTERVAL” will preserve the activeDiscoveryInterval of the LogicModule. “ACTIVE_DISCOVERY_FILTERS” will preserve the activeDiscoveryFilters of the LogicModule. “MODULE_GROUP” will preserve the moduleGroup of the LogicModule. “DISPLAY_NAME” will preserve the displayName of the LogicModule. “USE_WILD_VALUE_AS_UUID” will preserve the useWildValueAsUuid of the LogicModule. “DATAPOINT_ALERT_THRESHOLDS” will preserve the datapointAlertThresholds of the LogicModule. “TAGS” will preserve the tags of the LogicModule.
Type: System.StringDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''The raw file content of the LogicModule to import as a string. Use Get-Content with -Raw parameter to read file content properly (e.g., Get-Content ‘file.json’ -Raw).
Type: System.ObjectDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: File Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-FilePath
Section titled “-FilePath”The path to the file containing the LogicModule to import. The function will read the file content automatically.
Type: System.StringDefaultValue: ''SupportsWildcards: falseAliases: []ParameterSets:- Name: FilePath Position: Named IsRequired: true ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-Format
Section titled “-Format”The format of the LogicModule file. Valid values are “xml” or “json”. Defaults to “json”.
Type: System.StringDefaultValue: jsonSupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''-HandleConflict
Section titled “-HandleConflict”Optional. Specifies how to handle conflicts during import. Only applies to JSON imports. Defaults to “FORCE_OVERWRITE”. Valid values are “FORCE_OVERWRITE” or “ERROR”. “FORCE_OVERWRITE” will overwrite the existing LogicModule with the same name. “ERROR” will throw an error if a conflict is found.
Type: System.StringDefaultValue: FORCE_OVERWRITESupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''The type of LogicModule. Valid values are “datasources”, “configsources”, “eventsources”, “batchjobs”, “logsources”, “oids”, “topologysources”, “functions”, “diagnosticsources”. Defaults to “datasources”.
Type: System.StringDefaultValue: datasourcesSupportsWildcards: falseAliases: []ParameterSets:- Name: (All) Position: Named IsRequired: false ValueFromPipeline: false ValueFromPipelineByPropertyName: false ValueFromRemainingArguments: falseDontShow: falseAcceptedValues: []HelpMessage: ''CommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.