Export-SqlVulnerabilityAssessmentBaselineSet

Exports a Vulnerability Assessment baseline set to a file.

语法

Default (默认值)

Export-SqlVulnerabilityAssessmentBaselineSet
    -BaselineSet <SecurityCheckBaselineSet>
    -FolderPath <String>
    [-Force]
    [<CommonParameters>]

说明

The Export-SqlVulnerabilityAssessmentBaselineSet cmdlet exports a Vulnerability Assessment baseline set to a file. The output file can be used in SQL Server Management Studio (SSMS).

Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.

This cmdlet was removed in v22.3+ of the module.

示例

Example 1: Export a Vulnerability Assessment baseline set to a file

PS C:\> $scanResult = Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database some_database
PS C:\> $failedResults = @{}
PS C:\> $scanResult.Results.GetEnumerator() | Where {$_.Value.Status -eq "Failed"} | foreach {$failedResults[$_.Key] = $_.Value }
PS C:\> $failedCheckResults = $failedScanResult["VA2109"].QueryResults
PS C:\> $baseline = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId "VA2109" -ExpectedResult $failedCheckResults
PS C:\> $baselineSet = New-SqlVulnerabilityAssessmentBaselineSet -Baselines $baseline
PS C:\> $baselineSet | Export-SqlVulnerabilityAssessmentBaselineSet -FolderPath ".\baseline.json"

In this example we create a new baseline set with one baseline for security check 'VA2109' and then export it to a file named 'baseline.json'

参数

-BaselineSet

The baseline set to export

参数属性

类型:SecurityCheckBaselineSet
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-FolderPath

Where the exported file will be saved

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Force

Whether to force overwrite of the file if it already exists. If this parameter is not present, you will be prompted before the operation continues.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

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.

输入

Microsoft.SqlServer.VulnerabilityAssessment.SecurityCheckBaselineSet