en/Microsoft.SqlServer.Management.PSSnapins.dll-Help.xml
<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml" xmlns="http://msh"> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlAvailabilityDatabase</command:name> <command:verb>Add</command:verb> <command:noun>SqlAvailabilityDatabase</command:noun> <maml:description> <maml:para>Adds primary databases to an availability group or joins secondary databases to an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlAvailabilityDatabase cmdlet adds primary databases to an availability group or joins secondary databases to an availability group. The InputObject or Path parameter specifies the availability group. A database can belong to only one availability group.</maml:para> <maml:para>To add databases to an availability group, run this cmdlet on the server instance that hosts the primary replica. Specify one or more local user databases.</maml:para> <maml:para>To join a secondary database to the availability group, manually prepare the secondary database on the server instance that hosts the secondary replica. Then run this cmdlet on the server instance that hosts the secondary replica.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlAvailabilityDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group, as an AvailabilityGroup object, to which this cmdlet adds or joins databases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of user databases. This cmdlet adds or joins the databases that this parameter specifies to the availability group. The databases that you specify must reside on the local instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAvailabilityDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability group to which this cmdlet adds or joins databases. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of user databases. This cmdlet adds or joins the databases that this parameter specifies to the availability group. The databases that you specify must reside on the local instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of user databases. This cmdlet adds or joins the databases that this parameter specifies to the availability group. The databases that you specify must reside on the local instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group, as an AvailabilityGroup object, to which this cmdlet adds or joins databases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability group to which this cmdlet adds or joins databases. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[], Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Add a database to an availability group ------</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -Database "Database16"</dev:code> <dev:remarks> <maml:para>This command adds the database 'Database16' to the availability group 'MainAG'. Run this command on the primary server instance of the availability group. This command does not prepare secondary databases for data synchronization.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 2: Join a database to an availability group -----</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\SecondaryServer\InstanceName\AvailabilityGroups\MainAG" -Database "Database16"</dev:code> <dev:remarks> <maml:para>This command joins a secondary database named 'Database16' to the availability group 'MainAG' on one of the server instances that hosts a secondary replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Add a database and join a secondary database to an availability group</maml:title> <dev:code>PS C:\> $DatabaseBackupFile = "\\share\backups\Database16.bak" PS C:\> $LogBackupFile = "\\share\backups\Database16.trn" PS C:\> $AGPrimaryPath = "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" PS C:\> $MyAGSecondaryPath = "SQLSERVER:\SQL\SecondaryServer\InstanceName\AvailabilityGroups\MainAG" PS C:\> Backup-SqlDatabase -Database "Database16" -BackupFile $DatabaseBackupFile -ServerInstance "PrimaryServer\InstanceName" PS C:\> Backup-SqlDatabase -Database "Database16" -BackupFile $LogBackupFile -ServerInstance "PrimaryServer\InstanceName" -BackupAction Log PS C:\> Restore-SqlDatabase -Database "Database16" -BackupFile $DatabaseBackupFile -ServerInstance "SecondaryServer\InstanceName" -NoRecovery PS C:\> Restore-SqlDatabase -Database "Database16" -BackupFile $LogBackupFile -ServerInstance "SecondaryServer\InstanceName" -RestoreAction Log -NoRecovery PS C:\> Add-SqlAvailabilityDatabase -Path $AGPrimaryPath -Database 'Database16' PS C:\> Add-SqlAvailabilityDatabase -Path $AGSecondaryPath -Database "Database16"</dev:code> <dev:remarks> <maml:para>This example prepares a secondary database from a database on the server instance that hosts the primary replica of an availability group. It adds the database to an availability group as a primary database.Finally, it joins the secondary database to the availability group.</maml:para> <maml:para>The sixth command backs up the log file for 'Database16' on the primary server to the location in $LogBackupFile.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Create a script to add a database to an availability group</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -Database "Database16" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that adds the database 'Database16' to the availability group 'MainAG'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqlavailabilitydatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Backup-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Restore-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Resume-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Suspend-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlAvailabilityGroupListenerStaticIp</command:name> <command:verb>Add</command:verb> <command:noun>SqlAvailabilityGroupListenerStaticIp</command:noun> <maml:description> <maml:para>Adds a static IP address to an availability group listener.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlAvailabilityGroupListenerStaticIp cmdlet adds a static IP address to an existing availability group listener configuration. You can specify either an IPv4 address and subnet mask or an IPv6 address. Run this cmdlet on the server instance that hosts the primary replica.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlAvailabilityGroupListenerStaticIp</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupListener[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupListener[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAvailabilityGroupListenerStaticIp</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group listener that this cmdlet modifies. If you do not specify this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupListener[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupListener[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group listener that this cmdlet modifies. If you do not specify this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroupListener[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---------------- Example 1: Add an IPv4 address ----------------</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityGroupListenerStaticIp -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener" -StaticIp "192.169.0.1/255.255.252.0"</dev:code> <dev:remarks> <maml:para>This command adds a static IPv4 address to the availability group listener 'MainListener' on the availability group 'MainAG'. This IPv4 address serves as the virtual IP address of the listener on the subnet 255.255.252.0. If the availability group spans multiple subnets, add a static IP address for each subnet to the listener.</maml:para> <maml:para>Run this cmdlet on the server instance that hosts the primary replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---------------- Example 2: Add an IPv6 address ----------------</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityGroupListenerStaticIp -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener" -StaticIp "2001:0db8:85a3:0000:0000:8a2e:0370:7334"</dev:code> <dev:remarks> <maml:para>This command adds a static IPv6 address to the listener 'MainListener' on the availability group 'MainAG'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 3: Create a script that adds an IPv4 address -----</maml:title> <dev:code>PS C:\> Add-SqlAvailabilityGroupListenerStaticIp -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAg\AvailabilityGroupListeners\MainListener" -StaticIp "192.168.0.1/255.255.255.0" -Script</dev:code> <dev:remarks> <maml:para>This creates a Transact-SQL script that adds a static IPv4 address to the availability group listener 'MainListener' on the availability group 'MainAG'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqlavailabilitygrouplistenerstaticip</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroupListener</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroupListener</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlAzureAuthenticationContext</command:name> <command:verb>Add</command:verb> <command:noun>SqlAzureAuthenticationContext</command:noun> <maml:description> <maml:para>Performs authentication to Azure and acquires an authentication token.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlAzureAuthenticationContext cmdlet authenticates the specified principal account to Azure Resource Manager. Use this cmdlet with other cmdlets that interact with Azure resources, such as Azure Key Vault. </maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>DefaultAzureCredential</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses DefaultAzureCredential for acquiring token. The following credential types, if enabled, will be tried, in order:</maml:para> <maml:para>- EnvironmentCredential</maml:para> <maml:para>- WorkloadIdentityCredential</maml:para> <maml:para>- ManagedIdentityCredential</maml:para> <maml:para>- SharedTokenCacheCredential</maml:para> <maml:para>- VisualStudioCredential</maml:para> <maml:para>- VisualStudioCodeCredential</maml:para> <maml:para>- AzureCliCredential</maml:para> <maml:para>- AzurePowerShellCredential</maml:para> <maml:para>- AzureDeveloperCliCredential</maml:para> <maml:para>- InteractiveBrowserCredential</maml:para> <maml:para></maml:para> <maml:para>Refer to DefaultAzureCredential Class (/dotnet/api/azure.identity.defaultazurecredential)for more information on each credential type.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ActiveDirectoryAuthority</maml:name> <maml:description> <maml:para>Specifies the base authority for Azure Active Directory authentication. Same value as the ActiveDirectoryAuthority property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ExcludeCredential</maml:name> <maml:description> <maml:para>Indicates that DefaultAzureCredential should exclude the list of credential types specified while acquiring a token.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">EnvironmentCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WorkloadIdentityCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ManagedIdentityCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SharedTokenCacheCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">VisualStudioCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">VisualStudioCodeCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzureCliCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzurePowerShellCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzureDeveloperCliCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">InteractiveBrowserCredential</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CredentialType[]</command:parameterValue> <dev:type> <maml:name>CredentialType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureKeyVaultResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for Azure Key Vault services. Same value as the AzureKeyVaultServiceEndpointResourceId property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureManagedHsmResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for the Azure Managed HSM service. Use this parameter to override the default value `https://managedhsm.azure.net` when your managed HSM resource is in an Azure instance other than the Azure public cloud.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Interactive</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prompts the user for credentials.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ActiveDirectoryAuthority</maml:name> <maml:description> <maml:para>Specifies the base authority for Azure Active Directory authentication. Same value as the ActiveDirectoryAuthority property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureKeyVaultResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for Azure Key Vault services. Same value as the AzureKeyVaultServiceEndpointResourceId property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureManagedHsmResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for the Azure Managed HSM service. Use this parameter to override the default value `https://managedhsm.azure.net` when your managed HSM resource is in an Azure instance other than the Azure public cloud.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ClientID</maml:name> <maml:description> <maml:para>Specifies the application client ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ActiveDirectoryAuthority</maml:name> <maml:description> <maml:para>Specifies the base authority for Azure Active Directory authentication. Same value as the ActiveDirectoryAuthority property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the application secret.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureKeyVaultResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for Azure Key Vault services. Same value as the AzureKeyVaultServiceEndpointResourceId property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureManagedHsmResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for the Azure Managed HSM service. Use this parameter to override the default value `https://managedhsm.azure.net` when your managed HSM resource is in an Azure instance other than the Azure public cloud.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Specifies a tenant in Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ClientID</maml:name> <maml:description> <maml:para>Specifies the application client ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ActiveDirectoryAuthority</maml:name> <maml:description> <maml:para>Specifies the base authority for Azure Active Directory authentication. Same value as the ActiveDirectoryAuthority property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies thumbprint to be used to identify the certificate to use. The cmdlet will search both `CurrentUser` and `LocalMachine` certificate stores.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureKeyVaultResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for Azure Key Vault services. Same value as the AzureKeyVaultServiceEndpointResourceId property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureManagedHsmResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for the Azure Managed HSM service. Use this parameter to override the default value `https://managedhsm.azure.net` when your managed HSM resource is in an Azure instance other than the Azure public cloud.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Specifies a tenant in Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ClientID</maml:name> <maml:description> <maml:para>Specifies the application client ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies thumbprint to be used to identify the certificate to use. The cmdlet will search both `CurrentUser` and `LocalMachine` certificate stores.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Specifies a tenant in Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ClientID</maml:name> <maml:description> <maml:para>Specifies the application client ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the application secret.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Specifies a tenant in Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>DefaultAzureCredential</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses DefaultAzureCredential for acquiring token. The following credential types, if enabled, will be tried, in order:</maml:para> <maml:para>- EnvironmentCredential</maml:para> <maml:para>- WorkloadIdentityCredential</maml:para> <maml:para>- ManagedIdentityCredential</maml:para> <maml:para>- SharedTokenCacheCredential</maml:para> <maml:para>- VisualStudioCredential</maml:para> <maml:para>- VisualStudioCodeCredential</maml:para> <maml:para>- AzureCliCredential</maml:para> <maml:para>- AzurePowerShellCredential</maml:para> <maml:para>- AzureDeveloperCliCredential</maml:para> <maml:para>- InteractiveBrowserCredential</maml:para> <maml:para></maml:para> <maml:para>Refer to DefaultAzureCredential Class (/dotnet/api/azure.identity.defaultazurecredential)for more information on each credential type.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ExcludeCredential</maml:name> <maml:description> <maml:para>Indicates that DefaultAzureCredential should exclude the list of credential types specified while acquiring a token.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">EnvironmentCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WorkloadIdentityCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ManagedIdentityCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SharedTokenCacheCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">VisualStudioCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">VisualStudioCodeCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzureCliCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzurePowerShellCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AzureDeveloperCliCredential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">InteractiveBrowserCredential</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CredentialType[]</command:parameterValue> <dev:type> <maml:name>CredentialType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlAzureAuthenticationContext</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Interactive</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prompts the user for credentials.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ActiveDirectoryAuthority</maml:name> <maml:description> <maml:para>Specifies the base authority for Azure Active Directory authentication. Same value as the ActiveDirectoryAuthority property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureKeyVaultResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for Azure Key Vault services. Same value as the AzureKeyVaultServiceEndpointResourceId property from the Azure PowerShell Environment object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AzureManagedHsmResourceId</maml:name> <maml:description> <maml:para>Specifies the resource ID for the Azure Managed HSM service. Use this parameter to override the default value `https://managedhsm.azure.net` when your managed HSM resource is in an Azure instance other than the Azure public cloud.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>CertificateThumbprint</maml:name> <maml:description> <maml:para>Specifies thumbprint to be used to identify the certificate to use. The cmdlet will search both `CurrentUser` and `LocalMachine` certificate stores.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ClientID</maml:name> <maml:description> <maml:para>Specifies the application client ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>DefaultAzureCredential</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses DefaultAzureCredential for acquiring token. The following credential types, if enabled, will be tried, in order:</maml:para> <maml:para>- EnvironmentCredential</maml:para> <maml:para>- WorkloadIdentityCredential</maml:para> <maml:para>- ManagedIdentityCredential</maml:para> <maml:para>- SharedTokenCacheCredential</maml:para> <maml:para>- VisualStudioCredential</maml:para> <maml:para>- VisualStudioCodeCredential</maml:para> <maml:para>- AzureCliCredential</maml:para> <maml:para>- AzurePowerShellCredential</maml:para> <maml:para>- AzureDeveloperCliCredential</maml:para> <maml:para>- InteractiveBrowserCredential</maml:para> <maml:para></maml:para> <maml:para>Refer to DefaultAzureCredential Class (/dotnet/api/azure.identity.defaultazurecredential)for more information on each credential type.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ExcludeCredential</maml:name> <maml:description> <maml:para>Indicates that DefaultAzureCredential should exclude the list of credential types specified while acquiring a token.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CredentialType[]</command:parameterValue> <dev:type> <maml:name>CredentialType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Interactive</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prompts the user for credentials.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the application secret.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Tenant</maml:name> <maml:description> <maml:para>Specifies a tenant in Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Prompt a user for credentials to authenticate a user to Azure Resource Manager</maml:title> <dev:code>Add-SqlAzureAuthenticationContext -Interactive</dev:code> <dev:remarks> <maml:para>This command prompts a user for a username and a password and then authenticates the user to Azure Resource Manager.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Authenticate a user to Azure Resource Manager ---</maml:title> <dev:code>Add-SqlAzureAuthenticationContext -ClientID 'ad34ca5a-a479-4cf4-b166-a2177b32d33e' -Secret '[Placeholder]' -Tenant '41fb6cc6-96f4-479d-bafd-a2e4810eb100'</dev:code> <dev:remarks> <maml:para>This command performs authentication of the application principal with the specified client ID, which has been defined in the specified tenant, to Azure Resource Manager.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Use DefaultAzureCredential to authenticate a user to Azure Resource Manager</maml:title> <dev:code>Add-SqlAzureAuthenticationContext -DefaultAzureCredential</dev:code> <dev:remarks> <maml:para>This command acquires token using the following credential types, if enabled, will be tried, in order: EnvironmentCredential, WorkloadIdentityCredential, ManagedIdentityCredential, SharedTokenCacheCredential, VisualStudioCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential, AzureDeveloperCliCredential, InteractiveBrowserCredential.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Use DefaultAzureCredential but exclude few credential types to authenticate a user to Azure Resource Manager</maml:title> <dev:code>Add-SqlAzureAuthenticationContext -DefaultAzureCredential ` -ExcludeCredentials EnvironmentCredential, AzureDeveloperCliCredential</dev:code> <dev:remarks> <maml:para>This command acquires token using the following credential types, if enabled, will be tried, in order: WorkloadIdentityCredential, ManagedIdentityCredential, SharedTokenCacheCredential, VisualStudioCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential, InteractiveBrowserCredential. NOTE that EnvironmentCredential, AzureDeveloperCliCredential are excluded from the above types.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqlazureauthenticationcontext</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlColumnEncryptionKeyValue</command:name> <command:verb>Add</command:verb> <command:noun>SqlColumnEncryptionKeyValue</command:noun> <maml:description> <maml:para>Adds an encrypted value for an existing column encryption key object in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlColumnEncryptionKeyValue cmdlet adds a column encryption key object in the database, by adding an entry for a new encrypted value. Initially, a column encryption key object contains one entry containing an encrypted value of a column encryption key for Always Encrypted. This cmdlet adds the second encrypted value entry, in order to support a rotating column master key. Both the new and the initial encrypted value should represent the same plaintext key, but they should be produced using different column master keys.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlColumnEncryptionKeyValue</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that is used to produce the encrypted value that this cmdlet adds to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies the encrypted value that this cmdlet adds to the database. You are responsible that the encrypted value, if specified, has been generated using the specified column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to add the SQL column encryption key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlColumnEncryptionKeyValue</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify the value of this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that is used to produce the encrypted value that this cmdlet adds to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies the encrypted value that this cmdlet adds to the database. You are responsible that the encrypted value, if specified, has been generated using the specified column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to add the SQL column encryption key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that is used to produce the encrypted value that this cmdlet adds to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies the encrypted value that this cmdlet adds to the database. You are responsible that the encrypted value, if specified, has been generated using the specified column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify the value of this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to add the SQL column encryption key value.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Add an encrypted value for an existing column encryption key</maml:title> <dev:code>PS C:\> Add-SqlColumnEncryptionKeyValue -Name "CEK1" -InputObject $Database -ColumnMasterKeyName "CMK2" -ColumnEncryptionKeyCiphertext "0x016E000001630075007200720065006E00740075007300650072002F006D0079002F006200330039003900340035006200370031003100330037003700350032006400380061003100310033003900660035006200640036006400380066003700330038006600320033006200360032003000307925663D2C3E275DD272E15E606927DA4326F5735C2C8E84F91B9EFE44F503ED01C130984E83AF4513F8A4A8D0878D42364E958291AE25111A868D25B69FC5143EEC04131DA27D05F3442CB665ACB4BB3F6A7A9F07DBD5D212A772414A2CCA03BEBEB7BF0E22C644C715D739B983872AFB2D390229A0B5311BCA07E3C1D857EE8982320BBBE9382C960B9674E3CC3D618AD623D6A362BEAEF68B1B1BB49660DD643A4375A9285CD9EAA5B13BFE2792DA92025351E7B6067BA07B6178D03041F40F00D84326627094C9D6944DD912497B080058A529D2DA11C8D609604449714420B4E44ECD1EB26DEE18BF712146A51DD99A02E3D4EE692A503CF02F874497010772DE743DDFB2A74801AC9A94C876D1F93554B70CE0ECC437E7FC28BC11A08222977CDA807E256ED536C41700C631878226E513AFE1199A1DB4732F975AA09A1E75B8A19802AE018871A7A0AD5B1E29B942F30490EDABD310A4170B991EBCFDA2AFE43285D5406476204B381D8A33EEB0B967073B4C0127B1C7F0281AB310EE4B9A3C2D3EAB44A1F5D15D4739FFAEF6110ED4808446F6A05DBF4121B2B33A0AF5A457CD38F895B8F7ABDF792E3ADBC3AF55B1442625F88F80127D08DE9E4AC1BB2AAA46843A477135053CEEFA4327D8C999C16D8B49C225F34AD7588A5F9E93FB5532B1F1DC5AFB3CE23DDC8DC12327DD6B5985104D14F4A1BC0F61F0AACD"</dev:code> <dev:remarks> <maml:para>This command adds a new encrypted value for the column encryption key database object named CEK1. The new value is encrypted with the column master key, named CMK2.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqlcolumnencryptionkeyvalue</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlColumnEncryptionKeyEncryptedValue</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnEncryptionKeyValue</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlFirewallRule</command:name> <command:verb>Add</command:verb> <command:noun>SqlFirewallRule</command:noun> <maml:description> <maml:para>Adds a Windows Firewall rule to allow connections to a specific instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlFirewallRule cmdlet adds a Windows Firewall rule to allow connections for the specified instance of SQL Server. The SQL Server Cloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation:</maml:para> <maml:para>- Specify the instance Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the server instance of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target machine. This parameter is used when the ports of the target machine are not directly accessible but are exposed through endpoints, which means that they need to be connected to a different port.</maml:para> <maml:para>The SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry is attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target machine. This parameter is used when the ports of the target machine are not directly accessible but are exposed through endpoints, which means that they need to be connected to a different port.</maml:para> <maml:para>The SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If this parameter is not specified, the value of this parameter defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry is attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target machine. This parameter is used when the ports of the target machine are not directly accessible but are exposed through endpoints, which means that they need to be connected to a different port.</maml:para> <maml:para>The SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry is attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target machine. This parameter is used when the ports of the target machine are not directly accessible but are exposed through endpoints, which means that they need to be connected to a different port.</maml:para> <maml:para>The SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If this parameter is not specified, the value of this parameter defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry is attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para>System.String[]</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>- Example 1: Add a Windows Firewall rule on the local computer -</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Add-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>The first command changes directory to the SQL Server computer instance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Add a Windows Firewall rule on the local computer through a pipe</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer001" | Add-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command gets the SQL Server instance based on the credentials stored in the variable named $Credentials. The command then pipes the SQL Server instances of SQL Server on the computer named 'Computer001'. The command then adds Windows Firewall rules to allow connections for each one of the instances. The self-signed certificate of the target machine is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqlfirewallrule</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlFirewallRule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Add-SqlLogin</command:name> <command:verb>Add</command:verb> <command:noun>SqlLogin</command:noun> <maml:description> <maml:para>Creates a Login object in an instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Add-SqlLogin cmdlet creates a Login object in an instance of SQL Server.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Add-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsymmetricKey</maml:name> <maml:description> <maml:para>Specify the name of the asymmetric key for the Login object. If the LoginType parameter has the value AsymmetricKey, specify an asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specify the name of the certificate for the Login object. If LoginType has the value Certificate, specify a certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CredentialName</maml:name> <maml:description> <maml:para>Specify the name of the credential for the Login object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DefaultDatabase</maml:name> <maml:description> <maml:para>Specify the default database for the Login object. The default value is master.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Enable</maml:name> <maml:description> <maml:para>Indicates that the Login object is enabled. By default, Login objects are disabled.</maml:para> <maml:para>WindowsGroup type objects are always enabled. This parameter does not affect them.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordExpiration</maml:name> <maml:description> <maml:para>Indicates that the password expiration policy is enforced for the Login object. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordPolicy parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordPolicy</maml:name> <maml:description> <maml:para>Indicates that the password policy is enforced for the Login object. This parameter applies only SqlLogin type objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>GrantConnectSql</maml:name> <maml:description> <maml:para>Indicates that the Login object is not denied permissions to connect to the database engine. By default, Login objects are denied permissions to connect to the database engine, unless the target server is SQL Azure.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies a name for the Login object. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginPSCredential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that allows the Login object to provide name and password without a prompt.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login object as a Microsoft.SqlServer.Management.Smo.LoginType value. The acceptable values for this parameter are: - AsymmetricKey</maml:para> <maml:para>- Certificate</maml:para> <maml:para>- SqlLogin</maml:para> <maml:para>- WindowsGroup</maml:para> <maml:para>- WindowsUser</maml:para> <maml:para></maml:para> <maml:para>At this time, the cmdlet does not support ExternalUser or ExternalGroup.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MustChangePasswordAtNextLogin</maml:name> <maml:description> <maml:para>Indicates that the user must change the password at the next login. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordExpiration parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an SQL Server Management Objects (SMO) object the SQL Server on which this cmdlet operates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsymmetricKey</maml:name> <maml:description> <maml:para>Specify the name of the asymmetric key for the Login object. If the LoginType parameter has the value AsymmetricKey, specify an asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specify the name of the certificate for the Login object. If LoginType has the value Certificate, specify a certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CredentialName</maml:name> <maml:description> <maml:para>Specify the name of the credential for the Login object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DefaultDatabase</maml:name> <maml:description> <maml:para>Specify the default database for the Login object. The default value is master.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Enable</maml:name> <maml:description> <maml:para>Indicates that the Login object is enabled. By default, Login objects are disabled.</maml:para> <maml:para>WindowsGroup type objects are always enabled. This parameter does not affect them.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordExpiration</maml:name> <maml:description> <maml:para>Indicates that the password expiration policy is enforced for the Login object. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordPolicy parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordPolicy</maml:name> <maml:description> <maml:para>Indicates that the password policy is enforced for the Login object. This parameter applies only SqlLogin type objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>GrantConnectSql</maml:name> <maml:description> <maml:para>Indicates that the Login object is not denied permissions to connect to the database engine. By default, Login objects are denied permissions to connect to the database engine, unless the target server is SQL Azure.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies a name for the Login object. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginPSCredential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that allows the Login object to provide name and password without a prompt.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login object as a Microsoft.SqlServer.Management.Smo.LoginType value. The acceptable values for this parameter are: - AsymmetricKey</maml:para> <maml:para>- Certificate</maml:para> <maml:para>- SqlLogin</maml:para> <maml:para>- WindowsGroup</maml:para> <maml:para>- WindowsUser</maml:para> <maml:para></maml:para> <maml:para>At this time, the cmdlet does not support ExternalUser or ExternalGroup.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MustChangePasswordAtNextLogin</maml:name> <maml:description> <maml:para>Indicates that the user must change the password at the next login. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordExpiration parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Add-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsymmetricKey</maml:name> <maml:description> <maml:para>Specify the name of the asymmetric key for the Login object. If the LoginType parameter has the value AsymmetricKey, specify an asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specify the name of the certificate for the Login object. If LoginType has the value Certificate, specify a certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CredentialName</maml:name> <maml:description> <maml:para>Specify the name of the credential for the Login object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DefaultDatabase</maml:name> <maml:description> <maml:para>Specify the default database for the Login object. The default value is master.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Enable</maml:name> <maml:description> <maml:para>Indicates that the Login object is enabled. By default, Login objects are disabled.</maml:para> <maml:para>WindowsGroup type objects are always enabled. This parameter does not affect them.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordExpiration</maml:name> <maml:description> <maml:para>Indicates that the password expiration policy is enforced for the Login object. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordPolicy parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordPolicy</maml:name> <maml:description> <maml:para>Indicates that the password policy is enforced for the Login object. This parameter applies only SqlLogin type objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>GrantConnectSql</maml:name> <maml:description> <maml:para>Indicates that the Login object is not denied permissions to connect to the database engine. By default, Login objects are denied permissions to connect to the database engine, unless the target server is SQL Azure.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies a name for the Login object. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginPSCredential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that allows the Login object to provide name and password without a prompt.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login object as a Microsoft.SqlServer.Management.Smo.LoginType value. The acceptable values for this parameter are: - AsymmetricKey</maml:para> <maml:para>- Certificate</maml:para> <maml:para>- SqlLogin</maml:para> <maml:para>- WindowsGroup</maml:para> <maml:para>- WindowsUser</maml:para> <maml:para></maml:para> <maml:para>At this time, the cmdlet does not support ExternalUser or ExternalGroup.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MustChangePasswordAtNextLogin</maml:name> <maml:description> <maml:para>Indicates that the user must change the password at the next login. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordExpiration parameter. You do not have to specify both.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsymmetricKey</maml:name> <maml:description> <maml:para>Specify the name of the asymmetric key for the Login object. If the LoginType parameter has the value AsymmetricKey, specify an asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specify the name of the certificate for the Login object. If LoginType has the value Certificate, specify a certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CredentialName</maml:name> <maml:description> <maml:para>Specify the name of the credential for the Login object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DefaultDatabase</maml:name> <maml:description> <maml:para>Specify the default database for the Login object. The default value is master.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Enable</maml:name> <maml:description> <maml:para>Indicates that the Login object is enabled. By default, Login objects are disabled.</maml:para> <maml:para>WindowsGroup type objects are always enabled. This parameter does not affect them.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordExpiration</maml:name> <maml:description> <maml:para>Indicates that the password expiration policy is enforced for the Login object. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordPolicy parameter. You do not have to specify both.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnforcePasswordPolicy</maml:name> <maml:description> <maml:para>Indicates that the password policy is enforced for the Login object. This parameter applies only SqlLogin type objects.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>GrantConnectSql</maml:name> <maml:description> <maml:para>Indicates that the Login object is not denied permissions to connect to the database engine. By default, Login objects are denied permissions to connect to the database engine, unless the target server is SQL Azure.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an SQL Server Management Objects (SMO) object the SQL Server on which this cmdlet operates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies a name for the Login object. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginPSCredential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that allows the Login object to provide name and password without a prompt.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login object as a Microsoft.SqlServer.Management.Smo.LoginType value. The acceptable values for this parameter are: - AsymmetricKey</maml:para> <maml:para>- Certificate</maml:para> <maml:para>- SqlLogin</maml:para> <maml:para>- WindowsGroup</maml:para> <maml:para>- WindowsUser</maml:para> <maml:para></maml:para> <maml:para>At this time, the cmdlet does not support ExternalUser or ExternalGroup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MustChangePasswordAtNextLogin</maml:name> <maml:description> <maml:para>Indicates that the user must change the password at the next login. This parameter applies only SqlLogin type objects. This parameter implies the EnforcePasswordExpiration parameter. You do not have to specify both.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para>System.String[]</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- Example 1: Create an SqlLogin type --------------</maml:title> <dev:code>PS C:\> Add-SqlLogin -ServerInstance "MyServerInstance" -LoginName "MyLogin" -LoginType "SqlLogin" -DefaultDatabase "OtherDatabase" Name Login Type Created ---- ---------- ------- MyLogin SqlLogin 8/11/2016 3:19 PM</dev:code> <dev:remarks> <maml:para>This command creates a Login object that is named 'MyLogin' of the type SqlLogin. The command specifies its default database as 'OtherDatabase' in the server instance named 'MyServerInstance'. This command prompts you for a password for the Login.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 2: Create an asymmetric key type -----------</maml:title> <dev:code>PS C:\> Add-SqlLogin -ServerInstance "MyServerInstance" -LoginName "MyLogin" -LoginType "AsymmetricKey" -AsymmetricKey "MyKey" -CredentialName "MyCredential" Name Login Type Created ---- ---------- ------- MyLogin AsymmetricKey 8/11/2016 4:08 PM</dev:code> <dev:remarks> <maml:para>This command creates a Login object that is named MyLogin of the type AsymmetricKey. It specifies an asymmetric key that is named MyKey. Also it maps the credential called MyCredential to the new Login object. The command operates in the server instance named MyServerInstance.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/add-sqllogin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Backup-SqlDatabase</command:name> <command:verb>Backup</command:verb> <command:noun>SqlDatabase</command:noun> <maml:description> <maml:para>Backs up SQL Server database objects.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Backup-SqlDatabase cmdlet performs backup operations on a SQL Server database.</maml:para> <maml:para>This includes full database backups, transaction log backups, and database file backups.</maml:para> <maml:para>This cmdlet is modeled after the Microsoft.SqlServer.Management.Smo.Backup class.</maml:para> <maml:para>The parameters on this class generally correspond to properties on that Smo object.</maml:para> <maml:para>To back up a database by server instance path and database name, specify the server instance path in the Path parameter and the database name in the Database parameter.</maml:para> <maml:para>To back up a database using an Smo.Server object and database name, specify the Smo.Server object in the InputObject parameter, either directly or by using the pipeline operator, and the database name in the Database parameter.</maml:para> <maml:para>To back up a database by server instance and database name, specify the server instance in the ServerInstance parameter and the database name in the Database parameter.</maml:para> <maml:para>To back up a database using an Smo.Database object, specify the Smo.Database object in the DatabaseObject parameter, either directly or by using the pipeline operator.</maml:para> <maml:para>By default this cmdlet performs a full database backup.</maml:para> <maml:para>Set the type of the backup by using the BackupAction parameter.</maml:para> <maml:para>By default the backup file is stored in the default server backup location under the name databasename.bak for full and/or file backups and under the name databasename.trn for log backups. To specify a different file name, use the BackupFile parameter.</maml:para> <maml:para>To specify a backup file location and use an auto-generated file name, specify the location by using the BackupContainer parameter.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Backup-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to back up. This parameter cannot be used with the DatabaseObject parameter. When this parameter is specified, the Path, InputObject, or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location and filename(s) for the backup.</maml:para> <maml:para>This is an optional parameter.</maml:para> <maml:para>If not specified, the backups are stored in the default backup location of the server under the name databasename.bak for full and file backups, or databasename.trn for log backups.</maml:para> <maml:para>When backing up to multiple files, separate the filenames with commas, for example: `-BackupFile C:\Backups\databasename2.bak,C:\Backups\databasename2.bak`</maml:para> <maml:para>This parameter cannot be used with the `-BackupDevice` or `-BackupContainer` parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupAction</maml:name> <maml:description> <maml:para>Specifies the type of backup operation to perform. Valid values are:</maml:para> <maml:para>- Database. Backs up all the data files in the database.</maml:para> <maml:para>- Files. Backs up data files specified in the DatabaseFile or DatabaseFileGroup parameters.</maml:para> <maml:para>- Log. Backs up the transaction log.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupActionType</command:parameterValue> <dev:type> <maml:name>BackupActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupContainer</maml:name> <maml:description> <maml:para>Specifies the folder or location where the cmdlet stores backups. This can be a folder on a disk or URL for an Azure Blob container. This parameter can be useful when backing up multiple databases in a given instance. This parameter cannot be used with a BackupDevice parameter. The BackupContainer parameter cannot be used with the BackupFile parameter.</maml:para> <maml:para>The path used to specify the location should end with a forward slash (/).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetDescription</maml:name> <maml:description> <maml:para>Specifies the description of the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetName</maml:name> <maml:description> <maml:para>Specifies the name of the backup set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size for the backup, in bytes. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the number of I/O buffers to use for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionOption</maml:name> <maml:description> <maml:para>Specifies the compression options for the backup operation.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Default</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">On</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Off</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupCompressionOptions</command:parameterValue> <dev:type> <maml:name>BackupCompressionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a timeout failure. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CopyOnly</maml:name> <maml:description> <maml:para>Indicates that the backup is a copy-only backup. A copy-only backup does not affect the normal sequence of your regularly scheduled conventional backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that contains the credentials for a SQL Server login that has permission to perform this operation. This is not the SQL credential object that is used to store authentication information internally by SQL Server when accessing resources outside SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies one or more database files to back up. This parameter is only used when BackupAction is set to Files. When BackupAction is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the backup operation. This parameter is only used when BackupAction property is set to Files. When BackupAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpirationDate</maml:name> <maml:description> <maml:para>Specifies the date and time when the backup set expires and the backup data is no longer considered valid. This can only be used for backup data stored on disk or tape devices. Backup sets older than the expiration date are available to be overwritten by a later backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FormatMedia</maml:name> <maml:description> <maml:para>Indicates that the tape is formatted as the first step of the backup operation. This doesnot apply to a disk backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Incremental</maml:name> <maml:description> <maml:para>Indicates that a differential backup is performed.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Initialize</maml:name> <maml:description> <maml:para>Indicates that devices associated with the backup operation are initialized. This overwrites any existing backup sets on the media and makes this backup the first backup set on the media.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogTruncationType</maml:name> <maml:description> <maml:para>Specifies the truncation behavior for log backups. Valid values are:</maml:para> <maml:para>-- TruncateOnly</maml:para> <maml:para>-- NoTruncate</maml:para> <maml:para>-- Truncate</maml:para> <maml:para></maml:para> <maml:para>The default value is Truncate.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TruncateOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoTruncate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Truncate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupTruncateLogType</command:parameterValue> <dev:type> <maml:name>BackupTruncateLogType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the instance of SQL Server. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaDescription</maml:name> <maml:description> <maml:para>Specifies the description for the medium that contains the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name used to identify the media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MirrorDevices</maml:name> <maml:description> <maml:para>Specifies an array of BackupDeviceList objects used by the mirrored backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceList[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceList[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the tail end of the log is not backed up. When restored, the database is in the restoring state. When not set, the tail end of the log is backed up. This only applies when the BackupAction parameter is set to Log.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the backup completes. When not set, the tape is rewound after the operation completes. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that the cmdlet outputs the Smo.Backup object that performed the backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that the cmdlet continues processing a partially completed backup operation. If not set, the cmdlet restarts an interrupted backup operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetainDays</maml:name> <maml:description> <maml:para>Specifies the number of days that must elapse before a backup set can be overwritten. This can only be used for backup data stored on disk or tape devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of a SQL Server instance. This server instance becomes the target of the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipTapeHeader</maml:name> <maml:description> <maml:para>Indicates that the tape header is not read.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatementTimeout</maml:name> <maml:description> <maml:para>Set the timeout (in seconds) for the back-up operation.</maml:para> <maml:para>If the value is 0 or the StatementTimeout parameter is not specified, the restore operation is not going to timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UndoFileName</maml:name> <maml:description> <maml:para>Specifies the name of the undo file used to store uncommitted transactions that are rolled back during recovery.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation finishes. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Backup-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to back up. This parameter cannot be used with the DatabaseObject parameter. When this parameter is specified, the Path, InputObject, or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location and filename(s) for the backup.</maml:para> <maml:para>This is an optional parameter.</maml:para> <maml:para>If not specified, the backups are stored in the default backup location of the server under the name databasename.bak for full and file backups, or databasename.trn for log backups.</maml:para> <maml:para>When backing up to multiple files, separate the filenames with commas, for example: `-BackupFile C:\Backups\databasename2.bak,C:\Backups\databasename2.bak`</maml:para> <maml:para>This parameter cannot be used with the `-BackupDevice` or `-BackupContainer` parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupAction</maml:name> <maml:description> <maml:para>Specifies the type of backup operation to perform. Valid values are:</maml:para> <maml:para>- Database. Backs up all the data files in the database.</maml:para> <maml:para>- Files. Backs up data files specified in the DatabaseFile or DatabaseFileGroup parameters.</maml:para> <maml:para>- Log. Backs up the transaction log.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupActionType</command:parameterValue> <dev:type> <maml:name>BackupActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupContainer</maml:name> <maml:description> <maml:para>Specifies the folder or location where the cmdlet stores backups. This can be a folder on a disk or URL for an Azure Blob container. This parameter can be useful when backing up multiple databases in a given instance. This parameter cannot be used with a BackupDevice parameter. The BackupContainer parameter cannot be used with the BackupFile parameter.</maml:para> <maml:para>The path used to specify the location should end with a forward slash (/).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetDescription</maml:name> <maml:description> <maml:para>Specifies the description of the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetName</maml:name> <maml:description> <maml:para>Specifies the name of the backup set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size for the backup, in bytes. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the number of I/O buffers to use for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionOption</maml:name> <maml:description> <maml:para>Specifies the compression options for the backup operation.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Default</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">On</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Off</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupCompressionOptions</command:parameterValue> <dev:type> <maml:name>BackupCompressionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CopyOnly</maml:name> <maml:description> <maml:para>Indicates that the backup is a copy-only backup. A copy-only backup does not affect the normal sequence of your regularly scheduled conventional backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies one or more database files to back up. This parameter is only used when BackupAction is set to Files. When BackupAction is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the backup operation. This parameter is only used when BackupAction property is set to Files. When BackupAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpirationDate</maml:name> <maml:description> <maml:para>Specifies the date and time when the backup set expires and the backup data is no longer considered valid. This can only be used for backup data stored on disk or tape devices. Backup sets older than the expiration date are available to be overwritten by a later backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FormatMedia</maml:name> <maml:description> <maml:para>Indicates that the tape is formatted as the first step of the backup operation. This doesnot apply to a disk backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Incremental</maml:name> <maml:description> <maml:para>Indicates that a differential backup is performed.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Initialize</maml:name> <maml:description> <maml:para>Indicates that devices associated with the backup operation are initialized. This overwrites any existing backup sets on the media and makes this backup the first backup set on the media.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogTruncationType</maml:name> <maml:description> <maml:para>Specifies the truncation behavior for log backups. Valid values are:</maml:para> <maml:para>-- TruncateOnly</maml:para> <maml:para>-- NoTruncate</maml:para> <maml:para>-- Truncate</maml:para> <maml:para></maml:para> <maml:para>The default value is Truncate.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TruncateOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoTruncate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Truncate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupTruncateLogType</command:parameterValue> <dev:type> <maml:name>BackupTruncateLogType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the instance of SQL Server. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaDescription</maml:name> <maml:description> <maml:para>Specifies the description for the medium that contains the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name used to identify the media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MirrorDevices</maml:name> <maml:description> <maml:para>Specifies an array of BackupDeviceList objects used by the mirrored backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceList[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceList[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the tail end of the log is not backed up. When restored, the database is in the restoring state. When not set, the tail end of the log is backed up. This only applies when the BackupAction parameter is set to Log.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the backup completes. When not set, the tape is rewound after the operation completes. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that the cmdlet outputs the Smo.Backup object that performed the backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server to execute the backup operation. This is an optional parameter. If not specified, the value of this parameter defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that the cmdlet continues processing a partially completed backup operation. If not set, the cmdlet restarts an interrupted backup operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetainDays</maml:name> <maml:description> <maml:para>Specifies the number of days that must elapse before a backup set can be overwritten. This can only be used for backup data stored on disk or tape devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipTapeHeader</maml:name> <maml:description> <maml:para>Indicates that the tape header is not read.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatementTimeout</maml:name> <maml:description> <maml:para>Set the timeout (in seconds) for the back-up operation.</maml:para> <maml:para>If the value is 0 or the StatementTimeout parameter is not specified, the restore operation is not going to timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UndoFileName</maml:name> <maml:description> <maml:para>Specifies the name of the undo file used to store uncommitted transactions that are rolled back during recovery.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation finishes. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Backup-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to back up. This parameter cannot be used with the DatabaseObject parameter. When this parameter is specified, the Path, InputObject, or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location and filename(s) for the backup.</maml:para> <maml:para>This is an optional parameter.</maml:para> <maml:para>If not specified, the backups are stored in the default backup location of the server under the name databasename.bak for full and file backups, or databasename.trn for log backups.</maml:para> <maml:para>When backing up to multiple files, separate the filenames with commas, for example: `-BackupFile C:\Backups\databasename2.bak,C:\Backups\databasename2.bak`</maml:para> <maml:para>This parameter cannot be used with the `-BackupDevice` or `-BackupContainer` parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupAction</maml:name> <maml:description> <maml:para>Specifies the type of backup operation to perform. Valid values are:</maml:para> <maml:para>- Database. Backs up all the data files in the database.</maml:para> <maml:para>- Files. Backs up data files specified in the DatabaseFile or DatabaseFileGroup parameters.</maml:para> <maml:para>- Log. Backs up the transaction log.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupActionType</command:parameterValue> <dev:type> <maml:name>BackupActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupContainer</maml:name> <maml:description> <maml:para>Specifies the folder or location where the cmdlet stores backups. This can be a folder on a disk or URL for an Azure Blob container. This parameter can be useful when backing up multiple databases in a given instance. This parameter cannot be used with a BackupDevice parameter. The BackupContainer parameter cannot be used with the BackupFile parameter.</maml:para> <maml:para>The path used to specify the location should end with a forward slash (/).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetDescription</maml:name> <maml:description> <maml:para>Specifies the description of the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetName</maml:name> <maml:description> <maml:para>Specifies the name of the backup set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size for the backup, in bytes. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the number of I/O buffers to use for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionOption</maml:name> <maml:description> <maml:para>Specifies the compression options for the backup operation.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Default</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">On</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Off</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupCompressionOptions</command:parameterValue> <dev:type> <maml:name>BackupCompressionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CopyOnly</maml:name> <maml:description> <maml:para>Indicates that the backup is a copy-only backup. A copy-only backup does not affect the normal sequence of your regularly scheduled conventional backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies one or more database files to back up. This parameter is only used when BackupAction is set to Files. When BackupAction is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the backup operation. This parameter is only used when BackupAction property is set to Files. When BackupAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpirationDate</maml:name> <maml:description> <maml:para>Specifies the date and time when the backup set expires and the backup data is no longer considered valid. This can only be used for backup data stored on disk or tape devices. Backup sets older than the expiration date are available to be overwritten by a later backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FormatMedia</maml:name> <maml:description> <maml:para>Indicates that the tape is formatted as the first step of the backup operation. This doesnot apply to a disk backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Incremental</maml:name> <maml:description> <maml:para>Indicates that a differential backup is performed.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Initialize</maml:name> <maml:description> <maml:para>Indicates that devices associated with the backup operation are initialized. This overwrites any existing backup sets on the media and makes this backup the first backup set on the media.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object for the backup location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogTruncationType</maml:name> <maml:description> <maml:para>Specifies the truncation behavior for log backups. Valid values are:</maml:para> <maml:para>-- TruncateOnly</maml:para> <maml:para>-- NoTruncate</maml:para> <maml:para>-- Truncate</maml:para> <maml:para></maml:para> <maml:para>The default value is Truncate.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TruncateOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoTruncate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Truncate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupTruncateLogType</command:parameterValue> <dev:type> <maml:name>BackupTruncateLogType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the instance of SQL Server. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaDescription</maml:name> <maml:description> <maml:para>Specifies the description for the medium that contains the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name used to identify the media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MirrorDevices</maml:name> <maml:description> <maml:para>Specifies an array of BackupDeviceList objects used by the mirrored backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceList[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceList[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the tail end of the log is not backed up. When restored, the database is in the restoring state. When not set, the tail end of the log is backed up. This only applies when the BackupAction parameter is set to Log.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the backup completes. When not set, the tape is rewound after the operation completes. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that the cmdlet outputs the Smo.Backup object that performed the backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that the cmdlet continues processing a partially completed backup operation. If not set, the cmdlet restarts an interrupted backup operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetainDays</maml:name> <maml:description> <maml:para>Specifies the number of days that must elapse before a backup set can be overwritten. This can only be used for backup data stored on disk or tape devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipTapeHeader</maml:name> <maml:description> <maml:para>Indicates that the tape header is not read.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatementTimeout</maml:name> <maml:description> <maml:para>Set the timeout (in seconds) for the back-up operation.</maml:para> <maml:para>If the value is 0 or the StatementTimeout parameter is not specified, the restore operation is not going to timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UndoFileName</maml:name> <maml:description> <maml:para>Specifies the name of the undo file used to store uncommitted transactions that are rolled back during recovery.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation finishes. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Backup-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>DatabaseObject</maml:name> <maml:description> <maml:para>Specifies the database object for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location and filename(s) for the backup.</maml:para> <maml:para>This is an optional parameter.</maml:para> <maml:para>If not specified, the backups are stored in the default backup location of the server under the name databasename.bak for full and file backups, or databasename.trn for log backups.</maml:para> <maml:para>When backing up to multiple files, separate the filenames with commas, for example: `-BackupFile C:\Backups\databasename2.bak,C:\Backups\databasename2.bak`</maml:para> <maml:para>This parameter cannot be used with the `-BackupDevice` or `-BackupContainer` parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupAction</maml:name> <maml:description> <maml:para>Specifies the type of backup operation to perform. Valid values are:</maml:para> <maml:para>- Database. Backs up all the data files in the database.</maml:para> <maml:para>- Files. Backs up data files specified in the DatabaseFile or DatabaseFileGroup parameters.</maml:para> <maml:para>- Log. Backs up the transaction log.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupActionType</command:parameterValue> <dev:type> <maml:name>BackupActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupContainer</maml:name> <maml:description> <maml:para>Specifies the folder or location where the cmdlet stores backups. This can be a folder on a disk or URL for an Azure Blob container. This parameter can be useful when backing up multiple databases in a given instance. This parameter cannot be used with a BackupDevice parameter. The BackupContainer parameter cannot be used with the BackupFile parameter.</maml:para> <maml:para>The path used to specify the location should end with a forward slash (/).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetDescription</maml:name> <maml:description> <maml:para>Specifies the description of the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetName</maml:name> <maml:description> <maml:para>Specifies the name of the backup set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size for the backup, in bytes. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the number of I/O buffers to use for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionOption</maml:name> <maml:description> <maml:para>Specifies the compression options for the backup operation.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Default</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">On</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Off</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupCompressionOptions</command:parameterValue> <dev:type> <maml:name>BackupCompressionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CopyOnly</maml:name> <maml:description> <maml:para>Indicates that the backup is a copy-only backup. A copy-only backup does not affect the normal sequence of your regularly scheduled conventional backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies one or more database files to back up. This parameter is only used when BackupAction is set to Files. When BackupAction is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the backup operation. This parameter is only used when BackupAction property is set to Files. When BackupAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpirationDate</maml:name> <maml:description> <maml:para>Specifies the date and time when the backup set expires and the backup data is no longer considered valid. This can only be used for backup data stored on disk or tape devices. Backup sets older than the expiration date are available to be overwritten by a later backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FormatMedia</maml:name> <maml:description> <maml:para>Indicates that the tape is formatted as the first step of the backup operation. This doesnot apply to a disk backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Incremental</maml:name> <maml:description> <maml:para>Indicates that a differential backup is performed.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Initialize</maml:name> <maml:description> <maml:para>Indicates that devices associated with the backup operation are initialized. This overwrites any existing backup sets on the media and makes this backup the first backup set on the media.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogTruncationType</maml:name> <maml:description> <maml:para>Specifies the truncation behavior for log backups. Valid values are:</maml:para> <maml:para>-- TruncateOnly</maml:para> <maml:para>-- NoTruncate</maml:para> <maml:para>-- Truncate</maml:para> <maml:para></maml:para> <maml:para>The default value is Truncate.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TruncateOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NoTruncate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Truncate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupTruncateLogType</command:parameterValue> <dev:type> <maml:name>BackupTruncateLogType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the instance of SQL Server. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaDescription</maml:name> <maml:description> <maml:para>Specifies the description for the medium that contains the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name used to identify the media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MirrorDevices</maml:name> <maml:description> <maml:para>Specifies an array of BackupDeviceList objects used by the mirrored backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceList[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceList[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the tail end of the log is not backed up. When restored, the database is in the restoring state. When not set, the tail end of the log is backed up. This only applies when the BackupAction parameter is set to Log.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the backup completes. When not set, the tape is rewound after the operation completes. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that the cmdlet outputs the Smo.Backup object that performed the backup.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that the cmdlet continues processing a partially completed backup operation. If not set, the cmdlet restarts an interrupted backup operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetainDays</maml:name> <maml:description> <maml:para>Specifies the number of days that must elapse before a backup set can be overwritten. This can only be used for backup data stored on disk or tape devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the backup operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipTapeHeader</maml:name> <maml:description> <maml:para>Indicates that the tape header is not read.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatementTimeout</maml:name> <maml:description> <maml:para>Set the timeout (in seconds) for the back-up operation.</maml:para> <maml:para>If the value is 0 or the StatementTimeout parameter is not specified, the restore operation is not going to timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UndoFileName</maml:name> <maml:description> <maml:para>Specifies the name of the undo file used to store uncommitted transactions that are rolled back during recovery.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation finishes. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk or URL backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupAction</maml:name> <maml:description> <maml:para>Specifies the type of backup operation to perform. Valid values are:</maml:para> <maml:para>- Database. Backs up all the data files in the database.</maml:para> <maml:para>- Files. Backs up data files specified in the DatabaseFile or DatabaseFileGroup parameters.</maml:para> <maml:para>- Log. Backs up the transaction log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupActionType</command:parameterValue> <dev:type> <maml:name>BackupActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupContainer</maml:name> <maml:description> <maml:para>Specifies the folder or location where the cmdlet stores backups. This can be a folder on a disk or URL for an Azure Blob container. This parameter can be useful when backing up multiple databases in a given instance. This parameter cannot be used with a BackupDevice parameter. The BackupContainer parameter cannot be used with the BackupFile parameter.</maml:para> <maml:para>The path used to specify the location should end with a forward slash (/).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location and filename(s) for the backup.</maml:para> <maml:para>This is an optional parameter.</maml:para> <maml:para>If not specified, the backups are stored in the default backup location of the server under the name databasename.bak for full and file backups, or databasename.trn for log backups.</maml:para> <maml:para>When backing up to multiple files, separate the filenames with commas, for example: `-BackupFile C:\Backups\databasename2.bak,C:\Backups\databasename2.bak`</maml:para> <maml:para>This parameter cannot be used with the `-BackupDevice` or `-BackupContainer` parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetDescription</maml:name> <maml:description> <maml:para>Specifies the description of the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupSetName</maml:name> <maml:description> <maml:para>Specifies the name of the backup set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size for the backup, in bytes. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the number of I/O buffers to use for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the backup operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CompressionOption</maml:name> <maml:description> <maml:para>Specifies the compression options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupCompressionOptions</command:parameterValue> <dev:type> <maml:name>BackupCompressionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a timeout failure. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>CopyOnly</maml:name> <maml:description> <maml:para>Indicates that the backup is a copy-only backup. A copy-only backup does not affect the normal sequence of your regularly scheduled conventional backups.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that contains the credentials for a SQL Server login that has permission to perform this operation. This is not the SQL credential object that is used to store authentication information internally by SQL Server when accessing resources outside SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to back up. This parameter cannot be used with the DatabaseObject parameter. When this parameter is specified, the Path, InputObject, or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies one or more database files to back up. This parameter is only used when BackupAction is set to Files. When BackupAction is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the backup operation. This parameter is only used when BackupAction property is set to Files. When BackupAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>DatabaseObject</maml:name> <maml:description> <maml:para>Specifies the database object for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options for the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpirationDate</maml:name> <maml:description> <maml:para>Specifies the date and time when the backup set expires and the backup data is no longer considered valid. This can only be used for backup data stored on disk or tape devices. Backup sets older than the expiration date are available to be overwritten by a later backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FormatMedia</maml:name> <maml:description> <maml:para>Indicates that the tape is formatted as the first step of the backup operation. This doesnot apply to a disk backup.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Incremental</maml:name> <maml:description> <maml:para>Indicates that a differential backup is performed.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Initialize</maml:name> <maml:description> <maml:para>Indicates that devices associated with the backup operation are initialized. This overwrites any existing backup sets on the media and makes this backup the first backup set on the media.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object for the backup location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogTruncationType</maml:name> <maml:description> <maml:para>Specifies the truncation behavior for log backups. Valid values are:</maml:para> <maml:para>-- TruncateOnly</maml:para> <maml:para>-- NoTruncate</maml:para> <maml:para>-- Truncate</maml:para> <maml:para></maml:para> <maml:para>The default value is Truncate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupTruncateLogType</command:parameterValue> <dev:type> <maml:name>BackupTruncateLogType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the instance of SQL Server. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaDescription</maml:name> <maml:description> <maml:para>Specifies the description for the medium that contains the backup set. This parameter is optional.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name used to identify the media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MirrorDevices</maml:name> <maml:description> <maml:para>Specifies an array of BackupDeviceList objects used by the mirrored backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceList[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceList[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the tail end of the log is not backed up. When restored, the database is in the restoring state. When not set, the tail end of the log is backed up. This only applies when the BackupAction parameter is set to Log.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the backup completes. When not set, the tape is rewound after the operation completes. This does not apply to disk or URL backups.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that the cmdlet outputs the Smo.Backup object that performed the backup.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server to execute the backup operation. This is an optional parameter. If not specified, the value of this parameter defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that the cmdlet continues processing a partially completed backup operation. If not set, the cmdlet restarts an interrupted backup operation at the beginning of the backup set.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetainDays</maml:name> <maml:description> <maml:para>Specifies the number of days that must elapse before a backup set can be overwritten. This can only be used for backup data stored on disk or tape devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the backup operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of a SQL Server instance. This server instance becomes the target of the backup operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SkipTapeHeader</maml:name> <maml:description> <maml:para>Indicates that the tape header is not read.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatementTimeout</maml:name> <maml:description> <maml:para>Set the timeout (in seconds) for the back-up operation.</maml:para> <maml:para>If the value is 0 or the StatementTimeout parameter is not specified, the restore operation is not going to timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UndoFileName</maml:name> <maml:description> <maml:para>Specifies the name of the undo file used to store uncommitted transactions that are rolled back during recovery.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation finishes. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk or URL backups.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>SMO.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para>Specifies an SMO.Server object referring to the instance of SQL Server on which the backup operation occurs.</maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: Backup a complete database ------------</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB"</dev:code> <dev:remarks> <maml:para>This command creates a complete database backup of the database named 'MainDB' to the default backup location of the server instance 'Computer\Instance'. The backup file is named 'MainDB.bak'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 2: Backup a database based on location --------</maml:title> <dev:code>PS C:\> Set-Location "SQLSERVER:\SQL\Computer\Instance" PS SQLSERVER:\SQL\Computer\Instance> Backup-SqlDatabase -Database "MainDB"</dev:code> <dev:remarks> <maml:para>This command creates a complete database backup of the database 'MainDB' to the default backup location of the server instance 'Computer\Instance'. The current working directory is used to determine the server instance where the backup occurs.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------ Example 3: Backup the transaction log ------------</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupAction Log</dev:code> <dev:remarks> <maml:para>This command creates a backup of the transaction log of the database 'MainDB' to the default backup location of the server instance 'Computer\Instance'. The backup file is named 'MainDB.trn'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 4: Backup a database and prompt for credentials ---</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -Credential (Get-Credential "sa")</dev:code> <dev:remarks> <maml:para>This command creates a complete database backup of the database 'MainDB' using the 'sa' SQL Server login. This command prompts for a password to complete the authentication.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 5: Backup a database to a network file share -----</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.bak"</dev:code> <dev:remarks> <maml:para>This command creates a complete database backup of the database 'MainDB' to the file "\\mainserver\databasebackup\MainDB.bak".</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 6: Backup all databases in a server instance -----</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\SQL\Computer\Instance\Databases" | Backup-SqlDatabase</dev:code> <dev:remarks> <maml:para>This command backs up all databases on the server instance 'Computer\Instance' to the default backup location. The backup files are named <database name>.bak.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 7: Backup all databases in a server instance to a network file share</maml:title> <dev:code>PS C:\> Set-Location "SQLSERVER:\SQL\Computer\Instance\Databases" PS SQLSERVER:\SQL\Computer\Instance\Databases> foreach ($database in (Get-ChildItem)) { $dbName = $database.Name Backup-SqlDatabase -Database $dbName -BackupFile "\\mainserver\databasebackup\$dbName.bak" }</dev:code> <dev:remarks> <maml:para>This command creates a full backup for each database on the server instance 'Computer\Instance' to the share "\\mainserver\databasebackup". The backup files are named <database name>.bak.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 8: Backup all files in secondary file groups -----</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupAction Files -DatabaseFileGroup "FileGroupJan","FileGroupFeb"</dev:code> <dev:remarks> <maml:para>This command creates a full file backup of every file in the secondary filegroups 'FileGroupJan' and 'FileGroupFeb'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 9: Create a differential backup -----------</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -Incremental</dev:code> <dev:remarks> <maml:para>This command creates a differential backup of the database 'MainDB' to the default backup location of the server instance 'Computer\Instance'. The backup file is named "MainDB.bak".</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------- Example 10: Create a backup to a tape drive ---------</maml:title> <dev:code>PS C:\> $TapeDevice = New-Object Microsoft.Sqlserver.Management.Smo.BackupDeviceItem("\\.\tape0", "Tape") PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupDevice $TapeDevice</dev:code> <dev:remarks> <maml:para>This command creates a full backup of the database MainDB to the tape device "\\.\tape0". To represent this device, the command constructs an instance of the Microsoft.Sqlserver.Management.Smo.BackupDeviceItem object. The constructor takes two arguments, the name of the backup device and the type of the backup device. This BackupDeviceItem object is passed to the BackupDevice parameter of the Backup-SqlDatabase cmdlet.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 11: Backup a database to the Azure Blob Storage service</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupContainer "https://storageaccountname.blob.core.windows.net/containername" -SqlCredential "SQLCredentialName"</dev:code> <dev:remarks> <maml:para>This command creates a full backup of the database 'MainDB' to the Windows Azure Blob Storage service. It uses BackupContainer to specify the location (URL) of the Windows Azure Blob container. The name of the backup file is auto-generated. The SqlCredential parameter is used to specify the name of the SQL Server credential that stores the authentication information.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 12: Backup a database to the Azure Blob Storage service and specify the file name</maml:title> <dev:code>PS C:\> Backup-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainyDB" -BackupFile "https://storageaccountname.blob.core.windows.net/containername/MainDB.bak" -SqlCredential "SQLCredentialName"</dev:code> <dev:remarks> <maml:para>This command creates a full backup of the database MainDB to the Windows Azure Blob Storage service. It uses the BackupFile parameter to specify the location (URL) and the backup file name. The SqlCredential parameter is used to specify the name of the SQL Server credential.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 13: Backup all databases to the Azure Blob Storage service</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\SQL\Computer\Instance\Databases" | Backup-SqlDatabase -BackupContainer "https://storageaccountname.blob.core.windows.net/containername" -SqlCredential "SQLCredentialName"</dev:code> <dev:remarks> <maml:para>This command backs up all databases on the server instance 'Computer\Instance' to the Windows Azure Blob Storage service location by using the BackupContainer parameter. The backup file names are auto generated.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------ Example 14: Create an encrypted backup ------------</maml:title> <dev:code>PS C:\> $EncryptionOption = New-SqlBackupEncryptionOption -Algorithm Aes256 -EncryptorType ServerCertificate -EncryptorName "BackupCert" PS C:\> Backup-SqlDatabase -ServerInstance "." -Database "MainDB" -BackupFile "MainDB.bak" -CompressionOption On -EncryptionOption $EncryptionOption</dev:code> <dev:remarks> <maml:para>This example creates the encryption options and uses it as a parameter value in Backup-SqlDatabase to create an encrypted backup.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/backup-sqldatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Restore-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Complete-SqlColumnMasterKeyRotation</command:name> <command:verb>Complete</command:verb> <command:noun>SqlColumnMasterKeyRotation</command:noun> <maml:description> <maml:para>Completes the rotation of a column master key.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Complete-SqlColumnMasterKeyRotation cmdlet completes the process of replacing an existing column master key with a new, target, column master key for the Always Encrypted feature.</maml:para> <maml:para>The cmdlet gets all column encryption key objects containing encrypted key values that are encrypted with the specified source column master key.</maml:para> <maml:para>The cmdlet then updates each column encryption key object to remove the entry for an encrypted value that was produced using the specified column master key.</maml:para> <maml:para>As a result, each impacted column encryption key object will have only one encrypted value entry, produced using the column master key that is the target of the rotation.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Complete-SqlColumnMasterKeyRotation</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to complete the rotation of a column master key.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Complete-SqlColumnMasterKeyRotation</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL database, for which this cmdlet runs the operation. If you do not specify a value for the parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to complete the rotation of a column master key.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL database, for which this cmdlet runs the operation. If you do not specify a value for the parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to complete the rotation of a column master key.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Complete the process of rotating the column master key</maml:title> <dev:code>PS C:\> Cleanup-SqlColumnMasterKey -SourceColumnMasterKeyName "CMK1"</dev:code> <dev:remarks> <maml:para>This command completes the process of rotating the column master key named CMK1.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/complete-sqlcolumnmasterkeyrotation</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Invoke-SqlColumnMasterKeyRotation</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Disable-SqlAlwaysOn</command:name> <command:verb>Disable</command:verb> <command:noun>SqlAlwaysOn</command:noun> <maml:description> <maml:para>Disables the Always On Availability Groups feature for a server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Disable-SqlAlwaysOn cmdlet disables the Always On vailability groups feature on a SQL Server instance.</maml:para> <maml:para>If the Always On Availability Groups feature is disabled while the SQL Server service is running, the database engine service must be restarted for the changes to complete.</maml:para> <maml:para>Unless you specify the Force parameter, the cmdlet prompts you to restart the service.</maml:para> <maml:para>If the Always On Availability Groups feature is already disabled, this cmdlet makes no changes.</maml:para> <maml:para>This cmdlet can run against a remote service.</maml:para> <maml:para>You must have Administrator permissions to execute this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Disable-SqlAlwaysOn</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the instance of SQL Server where the Always On Availability Groups setting is disabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a windows credential that has permission to alter the Always On setting on the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Disable-SqlAlwaysOn</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of the SQL Server. This is an optional parameter. If not specified, the value of the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a windows credential that has permission to alter the Always On setting on the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Disable-SqlAlwaysOn</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a windows credential that has permission to alter the Always On setting on the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server where Always On is disabled. The format should be MACHINENAME\INSTANCE. Use the Credential parameter to change the Always On setting on a remote server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a windows credential that has permission to alter the Always On setting on the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the instance of SQL Server where the Always On Availability Groups setting is disabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of the SQL Server. This is an optional parameter. If not specified, the value of the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server where Always On is disabled. The format should be MACHINENAME\INSTANCE. Use the Credential parameter to change the Always On setting on a remote server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Disable Always On Availability Groups at the specified path</maml:title> <dev:code>PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance"</dev:code> <dev:remarks> <maml:para>This command disables Always On Availability Groups on the instance of SQL Server located at the specified path. This command requires restarting the server instance, and you will be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Disable Always On Availability Groups at the specified path and restart the server without confirmation</maml:title> <dev:code>PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -Force</dev:code> <dev:remarks> <maml:para>This command disables Always On Availability Groups on the instance of SQL Server located at the specified path. The Force option causes the server instance to be restarted without prompting you for confirmation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Disable Always On Availability Groups for the specified server instance</maml:title> <dev:code>PS C:\> Disable-SqlAlwaysOn -ServerInstance "Computer\Instance"</dev:code> <dev:remarks> <maml:para>This command disables Always On Availability Groups on the instance of SQL Server named 'Computer\Instance'. This command requires restarting the instance and you will be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Disable Always On Availability Groups for the specified server instance using Windows authentication</maml:title> <dev:code>PS C:\> Disable-SqlAlwaysOn -ServerInstance "Computer\Instance" -Credential (Get-Credential "DOMAIN\Username")</dev:code> <dev:remarks> <maml:para>This command disables Always On Availability Groups on the instance of SQL Server named 'Computer\Instance' using Windows authentication. You will be prompted to enter the password for the specified account, 'DOMAIN\Username'. This change requires restarting the instance and you will also be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Disable Always On Availability Groups at the specified path without restarting the server</maml:title> <dev:code>PS C:\> Disable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -NoServiceRestart</dev:code> <dev:remarks> <maml:para>This command disables Always On Availability Groups on the instance of SQL Server located at the specified path, but the command does not restart the instance. The change will not take effect until you manually restart this server instance.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/disable-sqlalwayson</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Enable-SqlAlwaysOn</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Enable-SqlAlwaysOn</command:name> <command:verb>Enable</command:verb> <command:noun>SqlAlwaysOn</command:noun> <maml:description> <maml:para>Enables the Always On Availability Groups feature.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Enable-SqlAlwaysOn cmdlet enables Always On on an instance of SQL Server.</maml:para> <maml:para>If the Always On Availability Groups feature is enabled while the SQL Server service is running, the database engine service must be restarted for the changes to complete.</maml:para> <maml:para>Unless you specify the Force parameter, the cmdlet prompts you to restart the service.</maml:para> <maml:para>If the Always On Availability Groups feature is already enabled, no action is performed.</maml:para> <maml:para>This cmdlet can run against a remote service.</maml:para> <maml:para>You must have Administrator permissions to execute this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Enable-SqlAlwaysOn</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance on which to enable the Always On Availability Groups feature. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enable-SqlAlwaysOn</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL Server instance. This is an optional parameter. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance on which to enable the Always On Availability Groups feature. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Enable-SqlAlwaysOn</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance on which to enable the Always On Availability Groups feature. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance on which to enable the Always On Availability Groups feature. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This parameter is provided to permit the construction of scripts.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that the user is not prompted to restart the SQL Server service. You must manually restart the SQL Server service for changes to take effect. When this parameter is set, Force is ignored.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL Server instance. This is an optional parameter. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of the SQL Server instance. The format is MACHINENAME\INSTANCE. To enable this setting on a remote server, use this along with the Credential parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Enable Always On Availability Groups at the specified path</maml:title> <dev:code>PS C:\> Enable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance"</dev:code> <dev:remarks> <maml:para>This command enables Always On Availability Groups on the instance of SQL Server located at the specified path. This change requires restarting the instance, and you will be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Enable Always On Availability Groups at the specified path and restart the server without confirmation</maml:title> <dev:code>PS C:\> Enable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -Force</dev:code> <dev:remarks> <maml:para>This command enables Always On Availability Groups on the instance of SQL Server located at the specified path. The Force option causes the server instance to be restarted without prompting you for confirmation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Enable Always On Availability Groups for the specified server instance</maml:title> <dev:code>PS C:\> Enable-SqlAlwaysOn -ServerInstance "Computer\Instance"</dev:code> <dev:remarks> <maml:para>This command enables Always On Availability Groups on the instance of SQL Server named Computer\Instance. This change requires restarting the instance and you will be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Enable Always On Availability Groups for the specified server instance using Windows authentication</maml:title> <dev:code>PS C:\> Enable-SqlAlwaysOn -ServerInstance "Computer\Instance" -Credential (Get-Credential "DOMAIN\Username")</dev:code> <dev:remarks> <maml:para>This command enables Always On Availability Groups on the instance of SQL Server named 'Computer\Instance' using Windows authentication. You will be prompted to enter the password for the specified account. This change requires restarting the instance, and you will also be prompted to confirm this restart.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Enable Always On Availability Groups at the specified path without restarting the server</maml:title> <dev:code>PS C:\> Enable-SqlAlwaysOn -Path "SQLSERVER:\Sql\Computer\Instance" -NoServiceRestart</dev:code> <dev:remarks> <maml:para>This command enables Always On Availability Groups on the SQL Server instance located at the specified path, but the command does not restart the instance. The change will not take effect until you manually restart this server instance.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/enable-sqlalwayson</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Disable-SqlAlwaysOn</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-SqlVulnerabilityAssessmentBaselineSet</command:name> <command:verb>Export</command:verb> <command:noun>SqlVulnerabilityAssessmentBaselineSet</command:noun> <maml:description> <maml:para>Exports a Vulnerability Assessment baseline set to a file.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>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).</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-SqlVulnerabilityAssessmentBaselineSet</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>BaselineSet</maml:name> <maml:description> <maml:para>The baseline set to export</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>Where the exported file will be saved</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>BaselineSet</maml:name> <maml:description> <maml:para>The baseline set to export</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>Where the exported file will be saved</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.VulnerabilityAssessment.SecurityCheckBaselineSet</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Export a Vulnerability Assessment baseline set to a file</maml:title> <dev:code>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"</dev:code> <dev:remarks> <maml:para>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'</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/export-sqlvulnerabilityassessmentbaselineset</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Export-SqlVulnerabilityAssessmentScan</command:name> <command:verb>Export</command:verb> <command:noun>SqlVulnerabilityAssessmentScan</command:noun> <maml:description> <maml:para>Exports a Vulnerability Assessment scan to a file.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Export-SqlVulnerabilityAssessmentScan cmdlet exports a Vulnerability Assessment scan to a file. Currently the command supports exporting a scan to Excel (.xlsx) file format only.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Export-SqlVulnerabilityAssessmentScan</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>Where the exported file will be saved</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ScanResult</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan result to export. The scan result must contain the relevant security checks' metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScanResult</command:parameterValue> <dev:type> <maml:name>ScanResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>Where the exported file will be saved</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>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.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ScanResult</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan result to export. The scan result must contain the relevant security checks' metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScanResult</command:parameterValue> <dev:type> <maml:name>ScanResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.VulnerabilityAssessment.ScanResult</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Export a Vulnerability Assessment scan to Excel file</maml:title> <dev:code>PS C:\> $scanResult = Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database some_database PS C:\> $scanResult | Export-SqlVulnerabilityAssessmentScan -FolderPath "ScanResult.xlsx"</dev:code> <dev:remarks> <maml:para>In this example, we invoke a Vulnerability Assessment scan on a database then export it to an Excel file.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Iterate over databases on some servers and export VA scans to Excel files</maml:title> <dev:code>PS C:\> @('localhost\SQL2016', 'localhost\SQL2017') | Get-SqlDatabase | Where-Object { $_.Name -like 'keep_*' } | ForEach-Object { Invoke-SqlVulnerabilityAssessmentScan -ServerInstance $_.Parent -Database $_.Name | Export-SqlVulnerabilityAssessmentScan -FolderPath "$($env:TEMP)\$(($_.Parent).Name -replace '\\', '_' )_$($_.Name)_ScanResult.xlsx" } PS C:\> dir "$env:TEMP\*_ScanResult.xlsx" Directory: C:\Users\someuser\AppData\Local\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 10/6/2018 1:19 AM 80050 SQL2016_keep_MDW_ScanResult.xlsx -a---- 10/6/2018 1:19 AM 80355 SQL2017_keep_MyDB_ScanResult.xlsx -a---- 10/6/2018 1:19 AM 79416 SQL2017_Keep_WideWorldImporters_ScanResult.xlsx</dev:code> <dev:remarks> <maml:para>In this example, we show a simple way to quickly scan databases on a set of SQL Servers (in this case, 2 instances running on the local machine). The list of databases is filtered on the name, so only the ones whose names start with "keep_" are scanned). The results are stored under the TEMP folder in Excel files with a name that identifies the server and the databases the scan referred to.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/export-sqlvulnerabilityassessmentscan</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgent</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgent</command:noun> <maml:description> <maml:para>Gets a SQL Agent object that is present in the target instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgent cmdlet gets a SQL Agent object that is present in the target instance of the SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation: - Specify the ServerInstance object of the target instance of SQL Server. </maml:para> <maml:para>- Specify the Path parameter of an instance of SQL Server.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgent</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a SQL Server connection before a timeout failure. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgent</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgent</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a SQL Server connection before a timeout failure. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Get the SQL Agent of a server instance ------</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance "SERVERNAME\INSTANCENAME" AgentDomainGroup : NT SERVICE\SQLSERVERAGENT AgentLogLevel : Errors, Warnings AgentMailType : SqlAgentMail AgentShutdownWaitTime : 15 ...</dev:code> <dev:remarks> <maml:para>This command gets the SQL Agent of the server instance named 'INSTANCENAME' on server 'SERVERNAME'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagent</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJob</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobHistory</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobSchedule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobStep</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgentJob</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgentJob</command:noun> <maml:description> <maml:para>Gets a SQL Agent Job object for each job that is present in the target instance of SQL Agent.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgentJob cmdlet gets a SQL Agent Job object for each job that is present in the target instance of SQL Agent. If the name of the job is provided, the cmdlet gets only this specific job object.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get a collection of Job objects:</maml:para> <maml:para>- Specify the path of the SQL Agent instance. </maml:para> <maml:para>- Pass the instance of the SQL Agent in the input.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgentJob</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the Job object that this cmdlet gets. The name may or may not be case-sensitive, depending on the collation of the SQL Server where the SQL Agent is running.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Serverwhere the SQL Agent is running. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer Value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJob</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the Job object that this cmdlet gets. The name may or may not be case-sensitive, depending on the collation of the SQL Server where the SQL Agent is running.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Management Objects (SMO) object representing the SQL Server Agent being targeted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer</command:parameterValue> <dev:type> <maml:name>JobServer</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJob</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the Job object that this cmdlet gets. The name may or may not be case-sensitive, depending on the collation of the SQL Server where the SQL Agent is running.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer Value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Management Objects (SMO) object representing the SQL Server Agent being targeted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer</command:parameterValue> <dev:type> <maml:name>JobServer</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the Job object that this cmdlet gets. The name may or may not be case-sensitive, depending on the collation of the SQL Server where the SQL Agent is running.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Serverwhere the SQL Agent is running. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get all Job instances from the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance MyServerInstance | Get-SqlAgentJob Name Owner Category Enabled CurrentRunStatus DateCreated LastModified JobID ---- ----- -------- ------- ---------------- ----------- ------------ ----- MyJob1 Owner [Uncategorized (Local)] True Idle 6/2/2016 10:21:44 AM 6/2/2016 10:21:44 AM 841255df-06e8-43ef-b798-3... MyJob2 Owner [Uncategorized (Local)] True Idle 5/31/2016 2:40:58 PM 6/1/2016 5:09:40 PM 995b296a-cd35-4505-868a-3... MyJob3 Owner [Uncategorized (Local)] True Idle 5/25/2016 12:13:56 PM 5/25/2016 12:13:56 PM 01d2e61a-9a90-4f77-98f4-e...</dev:code> <dev:remarks> <maml:para>This command gets all Job instances in the server instance named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Get a job instance by name from the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance MyServerInstance | Get-SqlAgentJob -Name MyJob1 Name Owner Category Enabled CurrentRunStatus DateCreated LastModified JobID ---- ----- -------- ------- ---------------- ----------- ------------ ----- MyJob1 Owner [Uncategorized (Local)] True Idle 6/2/2016 10:21:44 AM 6/2/2016 10:21:44 AM 841255df-06e8-43ef-b798-3...</dev:code> <dev:remarks> <maml:para>This command gets the Job instance named 'MyJob1' in the Server Instance named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagentjob</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgent</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobHistory</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobSchedule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobStep</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgentJobHistory</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgentJobHistory</command:noun> <maml:description> <maml:para>Gets the job history present in the target instance of SQL Agent.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgentJobHistory cmdlet gets the JobHistory object present in the target instance of SQL Agent.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get the JobHistory object:</maml:para> <maml:para>- Specify the path of the SQL Agent instance. </maml:para> <maml:para>- Pass the instance of the SQL Agent in the input.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgentJobHistory</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, where the SQL Agent runs. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that is used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the job ID value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the name of the job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRetries</maml:name> <maml:description> <maml:para>Specifies the job filter constraint that restricts the values returned to jobs that have failed and been retried for minimum number of times.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRunDurationInSeconds</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have completed in the minimum length of time specified, in seconds.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OldestFirst</maml:name> <maml:description> <maml:para>Indicates that this cmdlet lists jobs in oldest-first order. If you do not specify this parameter, the cmdlet uses newest-first order.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutcomesType</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have the specified outcome at completion.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>-- Failed</maml:para> <maml:para>-- Succeeded</maml:para> <maml:para>-- Retry</maml:para> <maml:para>-- Cancelled</maml:para> <maml:para>-- InProgress</maml:para> <maml:para>-- Unknown</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Failed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Succeeded</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Retry</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Cancelled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">InProgress</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CompletionResult</command:parameterValue> <dev:type> <maml:name>CompletionResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartRunDate parameter.</maml:para> <maml:para>It can be specified with the EndRunDate parameter.</maml:para> <maml:para>You cannot use the StartRunDate parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlMessageID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated the specified message during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlSeverity</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated an error of the specified severity during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job started.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJobHistory</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Object (SMO) objects that represent the SQL Server Agent being targeted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer[]</command:parameterValue> <dev:type> <maml:name>JobServer[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the job ID value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the name of the job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRetries</maml:name> <maml:description> <maml:para>Specifies the job filter constraint that restricts the values returned to jobs that have failed and been retried for minimum number of times.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRunDurationInSeconds</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have completed in the minimum length of time specified, in seconds.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OldestFirst</maml:name> <maml:description> <maml:para>Indicates that this cmdlet lists jobs in oldest-first order. If you do not specify this parameter, the cmdlet uses newest-first order.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutcomesType</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have the specified outcome at completion.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>-- Failed</maml:para> <maml:para>-- Succeeded</maml:para> <maml:para>-- Retry</maml:para> <maml:para>-- Cancelled</maml:para> <maml:para>-- InProgress</maml:para> <maml:para>-- Unknown</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Failed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Succeeded</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Retry</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Cancelled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">InProgress</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CompletionResult</command:parameterValue> <dev:type> <maml:name>CompletionResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartRunDate parameter.</maml:para> <maml:para>It can be specified with the EndRunDate parameter.</maml:para> <maml:para>You cannot use the StartRunDate parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlMessageID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated the specified message during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlSeverity</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated an error of the specified severity during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job started.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJobHistory</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server, as an array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the job ID value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the name of the job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRetries</maml:name> <maml:description> <maml:para>Specifies the job filter constraint that restricts the values returned to jobs that have failed and been retried for minimum number of times.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRunDurationInSeconds</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have completed in the minimum length of time specified, in seconds.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OldestFirst</maml:name> <maml:description> <maml:para>Indicates that this cmdlet lists jobs in oldest-first order. If you do not specify this parameter, the cmdlet uses newest-first order.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutcomesType</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have the specified outcome at completion.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>-- Failed</maml:para> <maml:para>-- Succeeded</maml:para> <maml:para>-- Retry</maml:para> <maml:para>-- Cancelled</maml:para> <maml:para>-- InProgress</maml:para> <maml:para>-- Unknown</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Failed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Succeeded</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Retry</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Cancelled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">InProgress</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">CompletionResult</command:parameterValue> <dev:type> <maml:name>CompletionResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartRunDate parameter.</maml:para> <maml:para>It can be specified with the EndRunDate parameter.</maml:para> <maml:para>You cannot use the StartRunDate parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlMessageID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated the specified message during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlSeverity</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated an error of the specified severity during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job started.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that is used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Object (SMO) objects that represent the SQL Server Agent being targeted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer[]</command:parameterValue> <dev:type> <maml:name>JobServer[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the job ID value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Guid</command:parameterValue> <dev:type> <maml:name>Guid</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>JobName</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the job specified by the name of the job.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRetries</maml:name> <maml:description> <maml:para>Specifies the job filter constraint that restricts the values returned to jobs that have failed and been retried for minimum number of times.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MinimumRunDurationInSeconds</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have completed in the minimum length of time specified, in seconds.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OldestFirst</maml:name> <maml:description> <maml:para>Indicates that this cmdlet lists jobs in oldest-first order. If you do not specify this parameter, the cmdlet uses newest-first order.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutcomesType</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have the specified outcome at completion.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>-- Failed</maml:para> <maml:para>-- Succeeded</maml:para> <maml:para>-- Retry</maml:para> <maml:para>-- Cancelled</maml:para> <maml:para>-- InProgress</maml:para> <maml:para>-- Unknown</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">CompletionResult</command:parameterValue> <dev:type> <maml:name>CompletionResult</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server, as an array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, where the SQL Agent runs. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartRunDate parameter.</maml:para> <maml:para>It can be specified with the EndRunDate parameter.</maml:para> <maml:para>You cannot use the StartRunDate parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlMessageID</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated the specified message during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlSeverity</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to jobs that have generated an error of the specified severity during runtime.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartRunDate</maml:name> <maml:description> <maml:para>Specifies a job filter constraint that restricts the values returned to the date the job started.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Agent.JobServer[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get the entire job history from the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgentJobHistory -ServerInstance "MyServerInstance" | Format-Table InstanceID SqlMessageID Message ---------- ------------ ------- 34 0 The job succeeded. The Job was invoked by Schedule 8 (syspolicy_purge_history_schedule). T... 33 0 Executed as user: DOMAIN\Machine1$. The step did not generate any output. Process Exit</dev:code> <dev:remarks> <maml:para>This command gets the entire job history in the server instance named MyServerInstance and then formats the output.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Get the job history from the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgentJobHistory -ServerInstance "MyServerInstance" -JobID 187112d7-84e1-4b66-b093-e97201c441ed JobID : 187112d7-84e1-4b66-b093-e97201c441ed JobName : Job_73cc6990-6386-49f9-9826-96c318ad8afa RunStatus : 3</dev:code> <dev:remarks> <maml:para>This command gets the job history of the job object with ID '187112d7-84e1-4b66-b093-e97201c441ed' in the server instance named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Get the job history from a time duration from the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgentJobHistory -ServerInstance "MyServerInstance" -Since Yesterday InstanceID : 4 SqlMessageID : 0 Message : The job was stopped prior to completion by User admin. The Job was invoked by User admin. The last step to run was step 1 (JobStep_3e4cd4ba-3433-4311-a6a2-816884101504).</dev:code> <dev:remarks> <maml:para>This command returns the job history since the day before in the server instance named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagentjobhistory</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgent</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJob</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobSchedule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobStep</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgentJobSchedule</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgentJobSchedule</command:noun> <maml:description> <maml:para>Gets a job schedule object for each schedule that is present in the target instance of SQL Agent Job.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgentJobSchedule cmdlet gets a SQL JobStepSchedule object for each step that is present in the target instance of SQL Agent Job. If the name of the job schedule is provided, the cmdlet gets only this specific JobSchedule object.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get a collection of JobSchedule objects:</maml:para> <maml:para>- Pass the instance of the SQL Agent Job in the input. </maml:para> <maml:para>- Specify the Path parameter of the Job instance.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgentJobSchedule</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Job object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Job</command:parameterValue> <dev:type> <maml:name>Job</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJobSchedule</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Job object on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Job object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Job</command:parameterValue> <dev:type> <maml:name>Job</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Job object on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Agent.Job</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get all JobSchedule object instances in the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance "MyServerInstance" | Get-SqlAgentJob | Get-SqlAgentJobSchedule Name Jobs Enabled DateCreated ActiveStartDate ActiveEndDate ID ---- ---- ------- ----------- --------------- ------------- -- Schedule1 1 False 6/2/2016 10:21:44 AM 6/14/2016 12:00:00 AM 12/31/9999 12:00:00 AM 10 Schedule2 1 True 6/9/2016 4:35:25 PM 6/9/2016 12:00:00 AM 12/31/9999 12:00:00 AM 58 Schedule3 1 True 6/9/2016 4:35:25 PM 6/9/2016 12:00:00 AM 12/31/9999 12:00:00 AM 59</dev:code> <dev:remarks> <maml:para>This command gets all JobSchedule object instances in the Job Instances passed by pipeline.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Get a JobSchedule object instance in the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgentJob -ServerInstance "MyServer" | Get-SqlAgentJobSchedule -Name "Schedule1"</dev:code> <dev:remarks> <maml:para>This command gets the JobSchedule object instance named 'Schedule1' from the Job instances passed by pipeline.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagentjobschedule</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgent</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJob</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobHistory</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobStep</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgentJobStep</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgentJobStep</command:noun> <maml:description> <maml:para>Gets a SQL JobStep object for each step that is present in the target instance of SQL Agent Job.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgentJobStep cmdlet gets a SQL JobStep object for each step that is present in the target instance of SQL Agent Job. If you provide the name of the job step, the cmdlet gets only this specific JobStep object.</maml:para> <maml:para>This cmdlet supports the following modes of operation to return a collection of JobStep objects:</maml:para> <maml:para>- Pass the instance of the SQL Agent Job in the input. </maml:para> <maml:para>- Specify the Path parameter of the Job instance.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgentJobStep</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobStep object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the job object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Job</command:parameterValue> <dev:type> <maml:name>Job</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentJobStep</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobStep object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the job object on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the job object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Job</command:parameterValue> <dev:type> <maml:name>Job</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobStep object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the job object on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Agent.Job</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Get all JobStep instances in the job instances --</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance "MyServerInstance" | Get-SqlAgentJob | Get-SqlAgentJobStep Name ID OnSuccessAction OnFailAction LastRunDate LastRunDuration ---- -- --------------- ------------ ----------- --------------- step1 1 QuitWithSuccess QuitWithFailure 1/1/0001 12:00:00 AM 4.03:23:45 step2 2 QuitWithSuccess QuitWithFailure 1/1/0001 12:00:00 AM 00:33:59 step3 3 GoToNextStep QuitWithSuccess 1/1/0001 12:00:00 AM 00:00:11</dev:code> <dev:remarks> <maml:para>This command uses the Get-SqlAgent cmdlet to get the server instance named 'MyServerInstance' then passes the result using the pipeline to the Get-SqlAgentJob cmdlet. The command then passes the result using the pipeline to the Get-SqlAgentJobStep cmdlet to get all JobStep instances.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---------- Example 2: Get a JobStep instance by name ----------</maml:title> <dev:code>PS C:\> Get-SqlAgent -ServerInstance "MyServerInstance" | Get-SqlAgentJob | Get-SqlAgentJobStep -Name "Step1" Name ID OnSuccessAction OnFailAction LastRunDate LastRunDuration ---- -- --------------- ------------ ----------- --------------- step1 1 QuitWithSuccess QuitWithFailure 1/1/0001 12:00:00 AM 4.03:23:45</dev:code> <dev:remarks> <maml:para>This command uses the Get-SqlAgent cmdlet to get the server instance named 'MyServerInstance' then passes the result using the pipeline to the Get-SqlAgentJob cmdlet. The command then passes the result using the pipeline to the Get-SqlAgentJobStep cmdlet to get the JobStep instance named 'Step1'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagentjobstep</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgent</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJob</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobHistory</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobSchedule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentSchedule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlAgentSchedule</command:name> <command:verb>Get</command:verb> <command:noun>SqlAgentSchedule</command:noun> <maml:description> <maml:para>Gets a SQL job schedule object for each schedule that is present in the target instance of SQL Agent.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlAgentSchedule cmdlet gets a SQL JobSchedule object for each schedule that is present in the target instance of SQL Agent. If you provide the name of the schedule, the cmdlet only gets that specific JobSchedule object.</maml:para> <maml:para>The cmdlet queries the Microsoft.SqlServer.Management.Smo.Agent.SharedSchedules SQL Server Management Object (SMO) object. If you are interested in schedules associated to a specific job, use the Get-SqlAgentJobSchedule cmdlet.</maml:para> <maml:para>This cmdlet supports the following modes of operation to return a collection of JobSchedule objects:</maml:para> <maml:para>- Specify the instance of the SQL Agent. </maml:para> <maml:para>- Specify the Path parameter of the job instance.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlAgentSchedule</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, where the SQL Agent is running. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds that this cmdlet waits for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentSchedule</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL Server Agent of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer</command:parameterValue> <dev:type> <maml:name>JobServer</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlAgentSchedule</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds that this cmdlet waits for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL Server Agent of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">JobServer</command:parameterValue> <dev:type> <maml:name>JobServer</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the JobSchedule object that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Agent of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, where the SQL Agent is running. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Agent.JobServer</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get all job schedules on the specified server instance</maml:title> <dev:code>PS C:\> Get-SqlAgentSchedule -ServerInstance MyComputer | ? { $_.JobCount -eq 0 } Name Jobs Enabled DateCreated ActiveStartDate ActiveEndDate ID ---- ---- ------- ----------- --------------- ------------- -- EveryDay 0 True 4/13/2016 11:36:30 AM 4/13/2016 12:00:00 AM 12/31/9999 12:00:00 AM 3 OnceAWeek 0 True 4/13/2016 11:36:30 AM 4/13/2016 12:00:00 AM 12/31/9999 12:00:00 AM 4</dev:code> <dev:remarks> <maml:para>This command gets all the job schedules on the SQL Agent that are located on the server instance named 'MyComputer' which have no jobs.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlagentschedule</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgent</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJob</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobHistory</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlAgentJobStep</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlBackupHistory</command:name> <command:verb>Get</command:verb> <command:noun>SqlBackupHistory</command:noun> <maml:description> <maml:para>Gets backup information about databases and returns SMO BackupSet objects for each Backup record found based on the parameters specified to this cmdlet.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>This cmdlet searches the server instance and gets the backup records as SMO BackupSet objects for all the records found matching the specified parameters.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlBackupHistory</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>The name of the server instances which this cmdlet will target.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupType</maml:name> <maml:description> <maml:para>The type of backup to filter on. If not specified then gets all backup types. Accepted values are defined below.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Differential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Incremental</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroupDifferential</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupSetType</command:parameterValue> <dev:type> <maml:name>BackupSetType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>The time to wait in seconds for a connection to be established and the dynamically generated -DatabaseName parameter to be populated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>The PSCredential object whose username and password fields are used to connect to the SQL instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>The names of the databases whose backup records are to be retrieved. This is a dynamically populated field and so provides auto-complete suggestions on database names.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">System.Collections.Generic.List`1[System.String]</command:parameterValue> <dev:type> <maml:name>System.Collections.Generic.List`1[System.String]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndTime</maml:name> <maml:description> <maml:para>The time before which all backup records to be retrieved should have completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSnapshotBackups</maml:name> <maml:description> <maml:para>This switch will make the cmdlet obtain records for snapshot backups as well. By default such backups are not retrieved.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartTime parameter.</maml:para> <maml:para>It can be specified with the EndTime parameter.</maml:para> <maml:para>You cannot use the StartTime parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartTime</maml:name> <maml:description> <maml:para>Gets the backup records which started after this specified time.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Suppresses the warning when the cmdlet is using the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TimeSpan</maml:name> <maml:description> <maml:para>If specified, it causes the cmdlet to filter records generated more than 'Timespan' ago.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlBackupHistory</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies SMO Server objects to get the backup records for.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupType</maml:name> <maml:description> <maml:para>The type of backup to filter on. If not specified then gets all backup types. Accepted values are defined below.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Differential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Incremental</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroupDifferential</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupSetType</command:parameterValue> <dev:type> <maml:name>BackupSetType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>The names of the databases whose backup records are to be retrieved. This is a dynamically populated field and so provides auto-complete suggestions on database names.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">System.Collections.Generic.List`1[System.String]</command:parameterValue> <dev:type> <maml:name>System.Collections.Generic.List`1[System.String]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndTime</maml:name> <maml:description> <maml:para>The time before which all backup records to be retrieved should have completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSnapshotBackups</maml:name> <maml:description> <maml:para>This switch will make the cmdlet obtain records for snapshot backups as well. By default such backups are not retrieved.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartTime parameter.</maml:para> <maml:para>It can be specified with the EndTime parameter.</maml:para> <maml:para>You cannot use the StartTime parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartTime</maml:name> <maml:description> <maml:para>Gets the backup records which started after this specified time.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Suppresses the warning when the cmdlet is using the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TimeSpan</maml:name> <maml:description> <maml:para>If specified, it causes the cmdlet to filter records generated more than 'Timespan' ago.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlBackupHistory</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the SQL provider path to either a server instance or a database for this cmdlet to use to obtain BackupSets for. If not specified uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupType</maml:name> <maml:description> <maml:para>The type of backup to filter on. If not specified then gets all backup types. Accepted values are defined below.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Differential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Incremental</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">FileOrFileGroupDifferential</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupSetType</command:parameterValue> <dev:type> <maml:name>BackupSetType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>The names of the databases whose backup records are to be retrieved. This is a dynamically populated field and so provides auto-complete suggestions on database names.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">System.Collections.Generic.List`1[System.String]</command:parameterValue> <dev:type> <maml:name>System.Collections.Generic.List`1[System.String]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndTime</maml:name> <maml:description> <maml:para>The time before which all backup records to be retrieved should have completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSnapshotBackups</maml:name> <maml:description> <maml:para>This switch will make the cmdlet obtain records for snapshot backups as well. By default such backups are not retrieved.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartTime parameter.</maml:para> <maml:para>It can be specified with the EndTime parameter.</maml:para> <maml:para>You cannot use the StartTime parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartTime</maml:name> <maml:description> <maml:para>Gets the backup records which started after this specified time.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Suppresses the warning when the cmdlet is using the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TimeSpan</maml:name> <maml:description> <maml:para>If specified, it causes the cmdlet to filter records generated more than 'Timespan' ago.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupType</maml:name> <maml:description> <maml:para>The type of backup to filter on. If not specified then gets all backup types. Accepted values are defined below.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupSetType</command:parameterValue> <dev:type> <maml:name>BackupSetType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>The time to wait in seconds for a connection to be established and the dynamically generated -DatabaseName parameter to be populated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>The PSCredential object whose username and password fields are used to connect to the SQL instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>The names of the databases whose backup records are to be retrieved. This is a dynamically populated field and so provides auto-complete suggestions on database names.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">System.Collections.Generic.List`1[System.String]</command:parameterValue> <dev:type> <maml:name>System.Collections.Generic.List`1[System.String]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndTime</maml:name> <maml:description> <maml:para>The time before which all backup records to be retrieved should have completed.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSnapshotBackups</maml:name> <maml:description> <maml:para>This switch will make the cmdlet obtain records for snapshot backups as well. By default such backups are not retrieved.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies SMO Server objects to get the backup records for.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the SQL provider path to either a server instance or a database for this cmdlet to use to obtain BackupSets for. If not specified uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>The name of the server instances which this cmdlet will target.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation that you can instead of the StartTime parameter.</maml:para> <maml:para>It can be specified with the EndTime parameter.</maml:para> <maml:para>You cannot use the StartTime parameter, if you use this parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the job history information generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the job history information generated in the last 24 hours)</maml:para> <maml:para>- LastWeek (gets all the job history information generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the job history information generated in the last month)</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StartTime</maml:name> <maml:description> <maml:para>Gets the backup records which started after this specified time.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Suppresses the warning when the cmdlet is using the provider context.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TimeSpan</maml:name> <maml:description> <maml:para>If specified, it causes the cmdlet to filter records generated more than 'Timespan' ago.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS C:\> Get-SqlBackupHistory -ServerInstance test-server -DatabaseName AdventureWorks2014 Name Type Backup Start Date Backup Finish Date ---- ---- ----------------- ------------------ AdventureWorks2014-Full Database Backup Database 2/21/2017 7:52:39 PM 2/21/2017 7:52:40 PM AdventureWorks2014-Full Database Backup Database 3/20/2017 2:41:39 PM 3/20/2017 2:41:39 PM AdventureWorks2014-Full-2017-07-24T22:22 Database 7/24/2017 3:23:11 PM 7/24/2017 3:23:11 PM</dev:code> <dev:remarks> <maml:para>This example gets records for all backup types for AdventureWorks2014 database on test-server SQL instance.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlbackuphistory</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Backup-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlColumnEncryptionKey</command:name> <command:verb>Get</command:verb> <command:noun>SqlColumnEncryptionKey</command:noun> <maml:description> <maml:para>Gets all column encryption key objects defined in the database, or gets one column encryption key object with the specified name.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlColumnEncryptionKey cmdlet returns a column encryption key object for each column encryption key in the target database.</maml:para> <maml:para>If the name of the column encryption key is provided, the cmdlet returns one specific column encryption key object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlColumnEncryptionKey</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column encryption key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlColumnEncryptionKey</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column encryption key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column encryption key value.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnEncryptionKey[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>SqlColumnEncryptionKey</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Get all column encryption keys from a database --</maml:title> <dev:code>PS C:\> Get-SqlColumnEncryptionKey</dev:code> <dev:remarks> <maml:para>This command gets all column encryption keys from the database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Get a column encryption key from a specified ---</maml:title> <dev:code>PS C:\> Get-SqlColumnEncryptionKey -Name "CEK1"</dev:code> <dev:remarks> <maml:para>This command gets a column encryption key from the column encryption key object named 'CEK1'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlcolumnencryptionkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlColumnMasterKey</command:name> <command:verb>Get</command:verb> <command:noun>SqlColumnMasterKey</command:noun> <maml:description> <maml:para>Gets the column master key objects defined in the database or gets one column master key object with the specified name.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlColumnMasterKey cmdlet gets a column master key object for each column master key in the target database.</maml:para> <maml:para>If the name of the column master key is provided, the cmdlet returns one specific column master key object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlColumnMasterKey</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column master key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlColumnMasterKey</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column master key value.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a script to get the SQL column master key value.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKey[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKey</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: Get all column master keys ------------</maml:title> <dev:code>PS C:\> Get-SqlColumnMasterKey</dev:code> <dev:remarks> <maml:para>This command gets all column master keys from the database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Get a column master key with a specific name ---</maml:title> <dev:code>PS C:\>Get-SqlColumnMasterKey -Name "CMK1"</dev:code> <dev:remarks> <maml:para>This command gets a column master key named 'CMK1'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlcolumnmasterkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlCredential</command:name> <command:verb>Get</command:verb> <command:noun>SqlCredential</command:noun> <maml:description> <maml:para>Gets a SQL credential object.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlCredential cmdlet gets a SQL credential object.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get the name of the SQL credential:</maml:para> <maml:para>- Specify the name of the SQL credential and the path of the instance. </maml:para> <maml:para>- Specify the name of the SQL Credential and the server object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object where the credential is located.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object where the credential is located.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- Example 1: Get a credential object --------------</maml:title> <dev:code>PS C:\> Get-SqlCredential -Name "MyCredential"</dev:code> <dev:remarks> <maml:para>This command gets the credential object named 'MyCredential'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlcredential</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlDatabase</command:name> <command:verb>Get</command:verb> <command:noun>SqlDatabase</command:noun> <maml:description> <maml:para>Gets a SQL database object for each database that is present in the target instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlDatabase cmdlet gets a SQL database object for each database that is present in the target instance of SQL Server. If the name of the database is provided, the cmdlet will return only this specific database object.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get the SQL database object:</maml:para> <maml:para>- Specify the instance Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="Database"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL database object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet generates a Transact-SQL script that runs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="Database"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL database object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as a string array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a SQL Server connection before a timeout failure. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target machine.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet generates a Transact-SQL script that runs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="Database"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL database object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet generates a Transact-SQL script that runs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="Database"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL database object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet generates a Transact-SQL script that runs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a SQL Server connection before a timeout failure. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target machine.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="Database"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL database object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet generates a Transact-SQL script that runs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="2" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as a string array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------- Example 1: Get a SQL database object -------------</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Get-SqlDatabase -Name "DbName" -Credential $SqlCredential</dev:code> <dev:remarks> <maml:para>The first command changes the working directory to SQLSERVER:\SQL\Computer\Instance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Get all instances of SQL Server on a computer ---</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer001" | Get-SqlDatabase -Credential $SqlCredential</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server on the computer named 'Computer001' and returns all the databases that are present in the instances.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqldatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Backup-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Restore-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlErrorLog</command:name> <command:verb>Get</command:verb> <command:noun>SqlErrorLog</command:noun> <maml:description> <maml:para>Gets the SQL Server error logs.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlErrorLog cmdlet gets the SQL Server errors logs.</maml:para> <maml:para>This cmdlet supports the following modes of operation to get an error log:</maml:para> <maml:para>- Pass the instance of the SQL Server. </maml:para> <maml:para>- Specify the Path parameter of the SQL Server instance.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlErrorLog</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>After</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated after the given time.</maml:para> <maml:para>If you specify the Before parameter, then this cmdlet gets all the error logs generated before the specified.</maml:para> <maml:para>Do not specify this parameter if you intend to use the Since or Timespan parameters.</maml:para> <maml:para>The format is defined according to the rules of .Net System.DataTime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Ascending</maml:name> <maml:description> <maml:para>Indicates that the cmdlet sorts the collection of error logs by the log date in ascending order. If you do not specify this parameter, the cmdlet sorts the error logs in descending order.</maml:para> <maml:para>When this cmdlet gets error logs multiple sources, the sorting is applied to all the error logs from the same source. The logs this cmdlet get are grouped by source first and then sorted by log date.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Before</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated before the given time.</maml:para> <maml:para>If the After parameter is specified, the cmdlet defaults to now, meaning that the cmdlet gets all the error logs generated after what you specified for this parameter until the present time.</maml:para> <maml:para>Do not specify a value for this parameter if you intend to use the Since or Timespan parameters. The format is defined according to the rules of .Net System.Datatime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation for the Timespan parameter.</maml:para> <maml:para>Do not specify this parameter if you intend to use the After or Before parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the logs generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the logs generated in the last 24 hours).</maml:para> <maml:para>- LastWeek (gets all the logs generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the logs generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timespan</maml:name> <maml:description> <maml:para>Specifies a TimeSpan object that this cmdlet filters out of the error logs that do are outside of the time span.</maml:para> <maml:para>The format of this parameter is d.HH:mm:ss.</maml:para> <maml:para>This parameter is ignored if you use the Since, After, or Before parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlErrorLog</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object, as an array, of the target instance that this cmdlet get the logs from.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>After</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated after the given time.</maml:para> <maml:para>If you specify the Before parameter, then this cmdlet gets all the error logs generated before the specified.</maml:para> <maml:para>Do not specify this parameter if you intend to use the Since or Timespan parameters.</maml:para> <maml:para>The format is defined according to the rules of .Net System.DataTime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Ascending</maml:name> <maml:description> <maml:para>Indicates that the cmdlet sorts the collection of error logs by the log date in ascending order. If you do not specify this parameter, the cmdlet sorts the error logs in descending order.</maml:para> <maml:para>When this cmdlet gets error logs multiple sources, the sorting is applied to all the error logs from the same source. The logs this cmdlet get are grouped by source first and then sorted by log date.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Before</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated before the given time.</maml:para> <maml:para>If the After parameter is specified, the cmdlet defaults to now, meaning that the cmdlet gets all the error logs generated after what you specified for this parameter until the present time.</maml:para> <maml:para>Do not specify a value for this parameter if you intend to use the Since or Timespan parameters. The format is defined according to the rules of .Net System.Datatime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation for the Timespan parameter.</maml:para> <maml:para>Do not specify this parameter if you intend to use the After or Before parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the logs generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the logs generated in the last 24 hours).</maml:para> <maml:para>- LastWeek (gets all the logs generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the logs generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timespan</maml:name> <maml:description> <maml:para>Specifies a TimeSpan object that this cmdlet filters out of the error logs that do are outside of the time span.</maml:para> <maml:para>The format of this parameter is d.HH:mm:ss.</maml:para> <maml:para>This parameter is ignored if you use the Since, After, or Before parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlErrorLog</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path, as an array, to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>After</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated after the given time.</maml:para> <maml:para>If you specify the Before parameter, then this cmdlet gets all the error logs generated before the specified.</maml:para> <maml:para>Do not specify this parameter if you intend to use the Since or Timespan parameters.</maml:para> <maml:para>The format is defined according to the rules of .Net System.DataTime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Ascending</maml:name> <maml:description> <maml:para>Indicates that the cmdlet sorts the collection of error logs by the log date in ascending order. If you do not specify this parameter, the cmdlet sorts the error logs in descending order.</maml:para> <maml:para>When this cmdlet gets error logs multiple sources, the sorting is applied to all the error logs from the same source. The logs this cmdlet get are grouped by source first and then sorted by log date.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Before</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated before the given time.</maml:para> <maml:para>If the After parameter is specified, the cmdlet defaults to now, meaning that the cmdlet gets all the error logs generated after what you specified for this parameter until the present time.</maml:para> <maml:para>Do not specify a value for this parameter if you intend to use the Since or Timespan parameters. The format is defined according to the rules of .Net System.Datatime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation for the Timespan parameter.</maml:para> <maml:para>Do not specify this parameter if you intend to use the After or Before parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the logs generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the logs generated in the last 24 hours).</maml:para> <maml:para>- LastWeek (gets all the logs generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the logs generated in the last month)</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Midnight</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Yesterday</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastWeek</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">LastMonth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timespan</maml:name> <maml:description> <maml:para>Specifies a TimeSpan object that this cmdlet filters out of the error logs that do are outside of the time span.</maml:para> <maml:para>The format of this parameter is d.HH:mm:ss.</maml:para> <maml:para>This parameter is ignored if you use the Since, After, or Before parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>After</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated after the given time.</maml:para> <maml:para>If you specify the Before parameter, then this cmdlet gets all the error logs generated before the specified.</maml:para> <maml:para>Do not specify this parameter if you intend to use the Since or Timespan parameters.</maml:para> <maml:para>The format is defined according to the rules of .Net System.DataTime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Ascending</maml:name> <maml:description> <maml:para>Indicates that the cmdlet sorts the collection of error logs by the log date in ascending order. If you do not specify this parameter, the cmdlet sorts the error logs in descending order.</maml:para> <maml:para>When this cmdlet gets error logs multiple sources, the sorting is applied to all the error logs from the same source. The logs this cmdlet get are grouped by source first and then sorted by log date.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Before</maml:name> <maml:description> <maml:para>Specifies that this cmdlet only gets error logs generated before the given time.</maml:para> <maml:para>If the After parameter is specified, the cmdlet defaults to now, meaning that the cmdlet gets all the error logs generated after what you specified for this parameter until the present time.</maml:para> <maml:para>Do not specify a value for this parameter if you intend to use the Since or Timespan parameters. The format is defined according to the rules of .Net System.Datatime.Parse().</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DateTime</command:parameterValue> <dev:type> <maml:name>DateTime</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object, as an array, of the target instance that this cmdlet get the logs from.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path, as an array, to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Since</maml:name> <maml:description> <maml:para>Specifies an abbreviation for the Timespan parameter.</maml:para> <maml:para>Do not specify this parameter if you intend to use the After or Before parameter.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Midnight (gets all the logs generated after midnight) </maml:para> <maml:para>- Yesterday (gets all the logs generated in the last 24 hours).</maml:para> <maml:para>- LastWeek (gets all the logs generated in the last week)</maml:para> <maml:para>- LastMonth (gets all the logs generated in the last month)</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SinceType</command:parameterValue> <dev:type> <maml:name>SinceType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timespan</maml:name> <maml:description> <maml:para>Specifies a TimeSpan object that this cmdlet filters out of the error logs that do are outside of the time span.</maml:para> <maml:para>The format of this parameter is d.HH:mm:ss.</maml:para> <maml:para>This parameter is ignored if you use the Since, After, or Before parameters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">TimeSpan</command:parameterValue> <dev:type> <maml:name>TimeSpan</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get all logs generated in a specific time frame that have a search word</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance PS SQLSERVER:\SQL\MyServer\MyInstance> Get-SqlErrorLog -Since Yesterday | Where-Object { $_.Text -match 'Error' } | Format-Table Date Source Text ArchiveNo ServerInstance ---- ------ ---- --------- -------------- 6/16/2016 6:04:20 PM Logon Error: 17828, Severity: 20, State: 4. 0 MyServer\MyInstance</dev:code> <dev:remarks> <maml:para>The first command changes the directory to the SQL Server instance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 2: Get all logs generated in a specific time frame --</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance PS SQLSERVER:\SQL\MyServer\MyInstance> Get-SqlErrorLog -Timespan '05:30:00' | Format-Table Date Source Text ---- ------ ---- 6/17/2016 12:00:00 AM spid26s This instance of SQL Server has been using a process ID of 21520 since 6/10/2016 3:56:... 6/16/2016 6:04:20 PM Logon The prelogin packet used to open the connection is structurally invalid; the connectio... 6/16/2016 6:04:20 PM Logon Error: 17828, Severity: 20, State: 4.</dev:code> <dev:remarks> <maml:para>The first command changes the directory to the SQL Server instance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Get all logs generated in a specific time frame sorted ascending and grouped</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer PS SQLSERVER:\SQL\MyServer> ls | Get-SqlErrorLog -After '2016-05-10' -Before '2016-06-18' -Ascending | ? { $_.Text -match 'Login failed' } | Group-Object -Property ServerInstance Count Name Group ----- ---- ----- 1 MyServer {{ Date = 6/17/2016 2:00:04 AM, Source = Logon, Text = Login failed for user ... 2 MyServer\INST1 {{ Date = 6/10/2016 3:58:46 PM, Source = Logon, Text = Login failed for user</dev:code> <dev:remarks> <maml:para>The first command changes the directory to the SQL Server instance.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlerrorlog</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlErrorLog</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlInstance</command:name> <command:verb>Get</command:verb> <command:noun>SqlInstance</command:noun> <maml:description> <maml:para>Gets a SQL Instance object for each instance of SQL Server that is present on the target computer.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlInstance cmdlet gets a SQL Instance object for each instance of SQL Server that is present on the target computer. If the name of the instance of SQL Server is provided, the cmdlet will only get this specific instance of SQL Server.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlInstance</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to the SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Objects (SMO) object that represent the SQL Server on which this cmdlet operates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlInstance</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to the SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Objects (SMO) object that represent the SQL Server on which this cmdlet operates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Get a SQL Server instance on a computer ------</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential -ServerInstance "Computer002\InstanceName"</dev:code> <dev:remarks> <maml:para>This command gets the SQL Server instance named InstanceName on the computer named Computer002.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>- Example 2: Get instances of SQL Server on multiple computers -</maml:title> <dev:code>PS C:\Users\matteot> @('Server1', 'Server2', 'Server3') | % { Get-SqlInstance -ServerInstance $_} Instance Name Version ProductLevel UpdateLevel ------------- ------- ------------ ----------- Server1 11.0.6607 SP3 CU10 Server2 12.0.5600 SP2 CU14 Server3 13.0.1742 RTM n/a</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server running on 3 diffent computers. Note that the output is formatted to display the Version, the ProductLevel, and the ProductUpdateLevel (aliased and abbreviated to "UpdateLevel"), when available.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlinstance</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlLogin</command:name> <command:verb>Get</command:verb> <command:noun>SqlLogin</command:noun> <maml:description> <maml:para>Returns Login objects in an instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlLogin cmdlet returns Login objects in an instance of SQL Server. If you specify the name of the Login object, the cmdlet removes that specific object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only disabled Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HasAccess</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have access to the instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Locked</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only locked Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet gets. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login objects that this cmdlet gets.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PasswordExpired</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have expired passwords.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RegEx</maml:name> <maml:description> <maml:para>Indicates that this cmdlet treats the value of the LoginName parameter as a regular expression.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Like"> <maml:name>Wildcard</maml:name> <maml:description> <maml:para>Indicates that this cmdlet interprets wildcard characters in the value of the LoginName parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Objects (SMO) object the SQL Server for which this cmdlet gets Login objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only disabled Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HasAccess</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have access to the instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Locked</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only locked Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet gets. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login objects that this cmdlet gets.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PasswordExpired</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have expired passwords.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RegEx</maml:name> <maml:description> <maml:para>Indicates that this cmdlet treats the value of the LoginName parameter as a regular expression.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Like"> <maml:name>Wildcard</maml:name> <maml:description> <maml:para>Indicates that this cmdlet interprets wildcard characters in the value of the LoginName parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only disabled Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HasAccess</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have access to the instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Locked</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only locked Login objects.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet gets. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login objects that this cmdlet gets.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">WindowsUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">WindowsGroup</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SqlLogin</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AsymmetricKey</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalUser</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ExternalGroup</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PasswordExpired</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have expired passwords.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RegEx</maml:name> <maml:description> <maml:para>Indicates that this cmdlet treats the value of the LoginName parameter as a regular expression.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Like"> <maml:name>Wildcard</maml:name> <maml:description> <maml:para>Indicates that this cmdlet interprets wildcard characters in the value of the LoginName parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only disabled Login objects.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HasAccess</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have access to the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Objects (SMO) object the SQL Server for which this cmdlet gets Login objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Locked</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only locked Login objects.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet gets. The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoginType</maml:name> <maml:description> <maml:para>Specifies the type of the Login objects that this cmdlet gets.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">LoginType</command:parameterValue> <dev:type> <maml:name>LoginType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PasswordExpired</maml:name> <maml:description> <maml:para>Indicates that this cmdlet gets only Login objects that have expired passwords.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RegEx</maml:name> <maml:description> <maml:para>Indicates that this cmdlet treats the value of the LoginName parameter as a regular expression.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Like"> <maml:name>Wildcard</maml:name> <maml:description> <maml:para>Indicates that this cmdlet interprets wildcard characters in the value of the LoginName parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------- Example 1: Get all Login objects for an instance -------</maml:title> <dev:code>PS C:\> Get-SqlLogin -ServerInstance "MyServerInstance" Name Login Type Created ---- ---------- ------- ##MS_PolicyEventProcessingLogin## SqlLogin 4/30/2016 12:46 AM ##MS_PolicyTsqlExecutionLogin## SqlLogin 4/30/2016 12:46 AM NT AUTHORITY\SYSTEM WindowsUser 6/16/2016 10:29 AM NT Service\MSSQLSERVER WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLSERVERAGENT WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLTELEMETRY WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLWriter WindowsUser 6/16/2016 10:29 AM NT SERVICE\Winmgmt WindowsUser 6/16/2016 10:29 AM sa SqlLogin 4/8/2003 9:10 AM</dev:code> <dev:remarks> <maml:para>This command returns all Login objects in the instance of SQL Server named MyServerInstance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>- Example 2: Get Login objects that match a regular expression -</maml:title> <dev:code>PS C:\> Get-SqlLogin -ServerInstance "MyServerInstance" -LoginName "\bNT.*" -RegEx Name Login Type Created ---- ---------- ------- NT AUTHORITY\SYSTEM WindowsUser 6/16/2016 10:29 AM NT Service\MSSQLSERVER WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLSERVERAGENT WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLTELEMETRY WindowsUser 6/16/2016 10:29 AM NT SERVICE\SQLWriter WindowsUser 6/16/2016 10:29 AM NT SERVICE\Winmgmt WindowsUser 6/16/2016 10:29 AM</dev:code> <dev:remarks> <maml:para>This command returns Login objects that have names that match the regular expression "\bNT.*" in the instance of SQL Server named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------ Example 3: Get Login objects of a type ------------</maml:title> <dev:code>PS C:\> Get-SqlLogin -ServerInstance "MyServerInstance" -LoginType SqlLogin Name Login Type Created ---- ---------- ------- ##MS_PolicyEventProcessingLogin## SqlLogin 4/30/2016 12:46 AM ##MS_PolicyTsqlExecutionLogin## SqlLogin 4/30/2016 12:46 AM sa SqlLogin 4/8/2003 9:10 AM</dev:code> <dev:remarks> <maml:para>This command returns Login objects that are of type SqlLogin in the instance of SQL Server named 'MyServerInstance'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqllogin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlSensitivityClassification</command:name> <command:verb>Get</command:verb> <command:noun>SqlSensitivityClassification</command:noun> <maml:description> <maml:para>Get the sensitivity label and information type of columns in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlSensitivityClassification cmdlet gets the sensitivity labels and information types of columns in the database.</maml:para> <maml:para>The sensitivity labels and information types of columns can also be viewed using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms) release 17.5 and above, or the [Extended Properties catalog view](/sql/relational-databases/security/sql-data-discovery-and-classification?view=sql-server-2017#subheading-3).</maml:para> <maml:para>The sensitivity labels and information types of columns can be set using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms)release 17.5 and above, or with the Set-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlSensitivityClassification</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityClassification</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies either the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityClassification</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityClassification</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityClassification</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies either the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get all information types and sensitivity labels from a database using Windows authentication</maml:title> <dev:code>PS C:\> Get-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.email Contact Info Confidential Medium Sales.Customers.first_name Name Confidential - GDPR Medium</dev:code> <dev:remarks> <maml:para>This command gets the information type and sensitivity label of all columns in the database. The cmdlet returns only the columns that have an information type or a sensitivity label (or both) defined.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Get information type and sensitivity label of a single column from database by providing path</maml:title> <dev:code>PS C:\> Get-SqlSensitivityClassification -Path "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" -ColumnName "Sales.Customers.email" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.email Contact Info Confidential Medium</dev:code> <dev:remarks> <maml:para>This command gets the information type and sensitivity label of the `Sales.Customers.email` column in the database provided in the Path.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Get sensitivity labels and information types of multiple columns using using current path context</maml:title> <dev:code>PS C:\> $columns = @("Sales.Customers.ip_address" , "Sales.Customers.email") PS C:\> Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" PS SQLSERVER:\SQL\MyComputer\MainInstance> Get-SqlSensitivityClassification -ColumnName $columns WARNING: Using provider context. Server = MyComputer, Database = MyDatabase. Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.email Contact Info Confidential Medium Sales.Customers.ip_address</dev:code> <dev:remarks> <maml:para>This command gets the information type and sensitivity label of multiple columns in the database using and array argument containing the column names and the current path context to locate the database.</maml:para> <maml:para>Columns that have no information type or sensitivity label, such as `Sales.Customers.ip_Addess` in the example, will return empty results.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlsensitivityclassification</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQL Data Discovery and Classification</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlSensitivityRecommendations</command:name> <command:verb>Get</command:verb> <command:noun>SqlSensitivityRecommendations</command:noun> <maml:description> <maml:para>Get recommended sensitivity labels and information types for columns in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlSensitivityRecommendations gets the recommended sensitivity labels and information types for columns in the database. The cmdlet does not return values for columns that already have sensitivity label or information type defined.</maml:para> <maml:para>The sensitivity labels and information types of columns can be viewed using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms) release 17.5 and above, the [Extended Properties catalog view](/sql/relational-databases/security/sql-data-discovery-and-classification?view=sql-server-2017#subheading-3), or the Get-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>The sensitivity labels and information types of columns can be set using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms)release 17.5 and above, or with the Set-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlSensitivityRecommendations</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityRecommendations</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifieseither the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityRecommendations</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityRecommendations</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSensitivityRecommendations</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifieseither the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get information type and sensitivity label recommendations for database using Windows authentication</maml:title> <dev:code>PS C:\> Get-SqlSensitivityRecommendations -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.email Contact Info Confidential Medium Sales.Customers.first_name Name Confidential - GDPR Medium Sales.Customers.ip_address Networking Confidential Medium Sales.Customers.last_name Name Confidential - GDPR Medium Sales.Orders.AccountNumber Financial Confidential Medium Sales.Orders.CreditCardApprovalCode Credit Card Confidential Medium Sales.Orders.CreditCardID Credit Card Confidential Medium Sales.Orders.CurrencyRateID Financial Confidential Medium</dev:code> <dev:remarks> <maml:para>Get the recommended information type and sensitivity label for columns in `myDatabase`. The cmdlet will return columns for which the classification algorithm was able to match the column to an information type. Columns that already have an information type or a sensitivity label are not returned by this cmdlet.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlsensitivityrecommendations</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQL Data Discovery and Classification</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Get-SqlSmartAdmin</command:name> <command:verb>Get</command:verb> <command:noun>SqlSmartAdmin</command:noun> <maml:description> <maml:para>Gets the SQL Smart Admin object and its properties.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Get-SqlSmartAdmin cmdlet gets the SQL Smart Admin object. The Smart Admin object includes SQL Server Managed Backup to Windows Azure_2 configuration settings. This cmdlet supports the following modes of operation to return the object:</maml:para> <maml:para>- Pass the name of the server instance using the Name parameter. For a default instance, specify only the computer name. For a named instance, use Computername\InstanceName. - Pass the path of the instance of SQL Server to the Path parameter.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Get-SqlSmartAdmin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server in this format: Computer\Instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the instance of the Server object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL Smart Admin object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of the SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName. Both the Name and the ServerInstance parameters allow you to specify the name of the instance, but ServerInstance also accepts pipeline input of the Server instance name, or the SqInstanceInfo object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSmartAdmin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server in this format: Computer\Instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server. If you do not specify a value for this parameter, the cmdlet sets the path to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL Smart Admin object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of the SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName. Both the Name and the ServerInstance parameters allow you to specify the name of the instance, but ServerInstance also accepts pipeline input of the Server instance name, or the SqInstanceInfo object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Get-SqlSmartAdmin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server in this format: Computer\Instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL Smart Admin object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of the SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName. Both the Name and the ServerInstance parameters allow you to specify the name of the instance, but ServerInstance also accepts pipeline input of the Server instance name, or the SqInstanceInfo object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet gets the SQL Smart Admin object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the instance of the Server object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the instance of the SQL Server in this format: Computer\Instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server. If you do not specify a value for this parameter, the cmdlet sets the path to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of the SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName. Both the Name and the ServerInstance parameters allow you to specify the name of the instance, but ServerInstance also accepts pipeline input of the Server instance name, or the SqInstanceInfo object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Get a Smart Admin object properties from a computer</maml:title> <dev:code>PS C:\> Get-SqlSmartAdmin -Name "Computer\MyInstance"</dev:code> <dev:remarks> <maml:para>This command gets the smart admin object properties from the computer named 'Computer\MyInstance'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/get-sqlsmartadmin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Grant-SqlAvailabilityGroupCreateAnyDatabase</command:name> <command:verb>Grant</command:verb> <command:noun>SqlAvailabilityGroupCreateAnyDatabase</command:noun> <maml:description> <maml:para>Grants the `CREATE ANY DATABASE` permission to an Always On Availability Group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Grants the `CREATE ANY DATABASE` permission to an Always On Availability Group. If automatic seeding is used to seed the secondary replica, you must allow database creation on each replica by calling Grant-SqlAvailabilityGroupCreateAnyDatabase cmdlet.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Grant-SqlAvailabilityGroupCreateAnyDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the target Availability Group object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Grant-SqlAvailabilityGroupCreateAnyDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the availability group on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the target Availability Group object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the availability group on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: How to grant create any database permission ----</maml:title> <dev:code>PS C:\> Grant-SqlAvailabilityGroupCreateAnyDatabase -Path SQLSERVER:\SQL\MYSERVER\MYINSTANCE\AvailabilityGroupS\AG1</dev:code> <dev:remarks> <maml:para>This example shows how to use the cmdlet to grant create any database permission to the Availability Group 'AG1' on SQL Server 'MYSERVER' (instance name 'MYINSTANCE').</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/grant-sqlavailabilitygroupcreateanydatabase</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Import-SqlVulnerabilityAssessmentBaselineSet</command:name> <command:verb>Import</command:verb> <command:noun>SqlVulnerabilityAssessmentBaselineSet</command:noun> <maml:description> <maml:para>Imports a Vulnerability Assessment baseline set from a file.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Import-VulnerabilityAssessmentBaselineSet cmdlet imports a Vulnerability Assessment baseline set from a file. This cmdlet can be used to import baseline sets created by SQL Server Management Studio (SSMS).</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Import-SqlVulnerabilityAssessmentBaselineSet</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>The path of the file which contains the persisted baseline set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>The path of the file which contains the persisted baseline set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>----- Example 1: Export a baseline set and then import it -----</maml:title> <dev:code>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" PS C:\> $importedBaselineSet = Import-SqlVulnerabilityAssessmentBaselineSet -FolderPath ".\baseline.json" SecurityCheckBaselines ---------------------- {VA2109}</dev:code> <dev:remarks> <maml:para>In this example we export a baseline set to a file named 'baseline.json' and then import it to a variable named 'importedBaselineSet'. The variables 'baselineSet' and 'importedBaselineSet' have the same content.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/import-sqlvulnerabilityassessmentbaselineset</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Invoke-PolicyEvaluation</command:name> <command:verb>Invoke</command:verb> <command:noun>PolicyEvaluation</command:noun> <maml:description> <maml:para>Invokes one or more SQL Server policy-based management policy evaluations.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Invoke-PolicyEvaluation cmdlet evaluates one or more policy-based management policies against a set of SQL Server objects named in the target set. </maml:para> <maml:para>The policies specify the allowed values for various properties that are associated with SQL Server objects, such as establishing site standards for database names or collations.</maml:para> <maml:para>When this cmdlet runs in check mode, it reports whether the current properties of the objects in the target set comply with the rules in the policy definitions.</maml:para> <maml:para>The objects in the target set are not reconfigured if their properties do not comply with the policies.</maml:para> <maml:para>In configure mode, this cmdlet reconfigures any objects in the target set that do not comply with the policy definitions.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Invoke-PolicyEvaluation</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>Policy</maml:name> <maml:description> <maml:para>Specifies one or more policies to evaluate.</maml:para> <maml:para>Policies can be stored in an instance of the SQL Server database engine or as exported XML files.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices.</maml:para> <maml:para>For policies that are stored as XML files, use a file system path to specify the location the policies.</maml:para> <maml:para>This parameter can take a string that specifies the names of one or more policies to evaluate.</maml:para> <maml:para>If only a file or policy name is specified in the string, this cmdlet uses the current path.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status." For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml."</maml:para> <maml:para>This parameter can take a set of FileInfo objects, such as the output of Get-ChildItem run against a folder that contains exported XML policies.</maml:para> <maml:para>This parameter can also take a set of Policy objects, such as the output of Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:description> <maml:para>Specifies the adhoc policy evaluation mode. Valid values are:</maml:para> <maml:para>- Check. Report the compliance status of the target set by using the credentials of your login account and without reconfiguring any objects.</maml:para> <maml:para>- CheckSqlScriptAsProxy. Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.</maml:para> <maml:para>- Configure. Reconfigure the target set objects that do not comply with the policies and report the resulting status. This cmdlet only reconfigures properties that are settable and deterministic.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Check</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Configure</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CheckSqlScriptAsProxy</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue> <dev:type> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputXml</maml:name> <maml:description> <maml:para>Indicates that this cmdlet produces its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetExpression</maml:name> <maml:description> <maml:para>Specifies a query that returns the list of objects that define the target set.</maml:para> <maml:para>The queries are specified as a string that has nodes which are separated by the '/' character.</maml:para> <maml:para>Each node is in the format ObjectType[Filter].</maml:para> <maml:para>ObjectType is one of the objects in the SQL Server Management Objects (SMO) object model, and Filter is an expression that filters for specific objects at that node. The nodes must follow the hierarchy of the SMO objects. For example, the following query expression returns the AdventureWorks sample database: </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para>[@Name='MyComputer']/Database[@Name='AdventureWorks']</maml:para> <maml:para>If TargetExpression is specified, do not specify TargetObject.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetServerName</maml:name> <maml:description> <maml:para>Specifies the instance of the database engine that contains the target set.</maml:para> <maml:para>You can specify a variable that contains a Microsoft.SqlServer.Management.Sfc.Sdk.SQLStoreConnection object.</maml:para> <maml:para>You can also specify a string that complies with the formats that are used in the ConnectionString property of the System.Data.SqlClient.SqlConnection class (v21 of the module) or the Microsoft.Data.SqlClient.SqlConnection class (v22+ of the module) in .Net. </maml:para> <maml:para>These include strings such as those created by using either System.Data.SqlClient.SqlConnectionStringBuilder or the Microsoft.Data.SqlClient.SqlConnectionStringBuilder.</maml:para> <maml:para>By default, this cmdlet connects by using Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-PolicyEvaluation</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>Policy</maml:name> <maml:description> <maml:para>Specifies one or more policies to evaluate.</maml:para> <maml:para>Policies can be stored in an instance of the SQL Server database engine or as exported XML files.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices.</maml:para> <maml:para>For policies that are stored as XML files, use a file system path to specify the location the policies.</maml:para> <maml:para>This parameter can take a string that specifies the names of one or more policies to evaluate.</maml:para> <maml:para>If only a file or policy name is specified in the string, this cmdlet uses the current path.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status." For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml."</maml:para> <maml:para>This parameter can take a set of FileInfo objects, such as the output of Get-ChildItem run against a folder that contains exported XML policies.</maml:para> <maml:para>This parameter can also take a set of Policy objects, such as the output of Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:description> <maml:para>Specifies the adhoc policy evaluation mode. Valid values are:</maml:para> <maml:para>- Check. Report the compliance status of the target set by using the credentials of your login account and without reconfiguring any objects.</maml:para> <maml:para>- CheckSqlScriptAsProxy. Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.</maml:para> <maml:para>- Configure. Reconfigure the target set objects that do not comply with the policies and report the resulting status. This cmdlet only reconfigures properties that are settable and deterministic.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Check</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Configure</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CheckSqlScriptAsProxy</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue> <dev:type> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputXml</maml:name> <maml:description> <maml:para>Indicates that this cmdlet produces its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetObjects</maml:name> <maml:description> <maml:para>Specifies the set of SQL Server objects against which the policy is evaluated. To connect to an instance of SQL Server analysis services, specify a Microsoft.AnalysisServices.Server object for TargetObject.</maml:para> <maml:para>If TargetObject is specified, do not specify TargetExpression.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject[]</command:parameterValue> <dev:type> <maml:name>PSObject[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:description> <maml:para>Specifies the adhoc policy evaluation mode. Valid values are:</maml:para> <maml:para>- Check. Report the compliance status of the target set by using the credentials of your login account and without reconfiguring any objects.</maml:para> <maml:para>- CheckSqlScriptAsProxy. Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.</maml:para> <maml:para>- Configure. Reconfigure the target set objects that do not comply with the policies and report the resulting status. This cmdlet only reconfigures properties that are settable and deterministic.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue> <dev:type> <maml:name>AdHocPolicyEvaluationMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputXml</maml:name> <maml:description> <maml:para>Indicates that this cmdlet produces its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>Policy</maml:name> <maml:description> <maml:para>Specifies one or more policies to evaluate.</maml:para> <maml:para>Policies can be stored in an instance of the SQL Server database engine or as exported XML files.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices.</maml:para> <maml:para>For policies that are stored as XML files, use a file system path to specify the location the policies.</maml:para> <maml:para>This parameter can take a string that specifies the names of one or more policies to evaluate.</maml:para> <maml:para>If only a file or policy name is specified in the string, this cmdlet uses the current path.</maml:para> <maml:para>For policies that are stored in an instance of the database engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status." For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml."</maml:para> <maml:para>This parameter can take a set of FileInfo objects, such as the output of Get-ChildItem run against a folder that contains exported XML policies.</maml:para> <maml:para>This parameter can also take a set of Policy objects, such as the output of Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetExpression</maml:name> <maml:description> <maml:para>Specifies a query that returns the list of objects that define the target set.</maml:para> <maml:para>The queries are specified as a string that has nodes which are separated by the '/' character.</maml:para> <maml:para>Each node is in the format ObjectType[Filter].</maml:para> <maml:para>ObjectType is one of the objects in the SQL Server Management Objects (SMO) object model, and Filter is an expression that filters for specific objects at that node. The nodes must follow the hierarchy of the SMO objects. For example, the following query expression returns the AdventureWorks sample database: </maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para>[@Name='MyComputer']/Database[@Name='AdventureWorks']</maml:para> <maml:para>If TargetExpression is specified, do not specify TargetObject.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetObjects</maml:name> <maml:description> <maml:para>Specifies the set of SQL Server objects against which the policy is evaluated. To connect to an instance of SQL Server analysis services, specify a Microsoft.AnalysisServices.Server object for TargetObject.</maml:para> <maml:para>If TargetObject is specified, do not specify TargetExpression.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject[]</command:parameterValue> <dev:type> <maml:name>PSObject[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetServerName</maml:name> <maml:description> <maml:para>Specifies the instance of the database engine that contains the target set.</maml:para> <maml:para>You can specify a variable that contains a Microsoft.SqlServer.Management.Sfc.Sdk.SQLStoreConnection object.</maml:para> <maml:para>You can also specify a string that complies with the formats that are used in the ConnectionString property of the System.Data.SqlClient.SqlConnection class (v21 of the module) or the Microsoft.Data.SqlClient.SqlConnection class (v22+ of the module) in .Net. </maml:para> <maml:para>These include strings such as those created by using either System.Data.SqlClient.SqlConnectionStringBuilder or the Microsoft.Data.SqlClient.SqlConnectionStringBuilder.</maml:para> <maml:para>By default, this cmdlet connects by using Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Evaluate a policy on the default instance of the computer</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Policies\DatabaseEngine\1033" PS C:\> Invoke-PolicyEvaluation -Policy "Trustworthy Database.xml" -TargetServer "MYCOMPUTER"</dev:code> <dev:remarks> <maml:para>This command evaluate a policy on the default instance of the specified computer. The policy is read from an XML file and the connection is authenticated by using Windows Authentication.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------- Example 2: Evaluate policies from XML files ---------</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Policies\DatabaseEngine\1033" PS C:\> Get-ChildItem "Database Status.xml", "Trustworthy Database.xml" | Invoke-PolicyEvaluation -TargetServer "MYCOMPUTER"</dev:code> <dev:remarks> <maml:para>This command reads two policies from XML files in a folder, and then passes them to Invoke-PolicyEvaluation by using the pipeline operator.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Evaluate policies and format the output according to the SMLIF schema</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Policies\DatabaseEngine\1033" PS C:\> Invoke-PolicyEvaluation -Policy "Database Status.xml" -TargetServer "MYCOMPUTER" -OutputXML > C:\MyReportFolder\MyReport.xml</dev:code> <dev:remarks> <maml:para>This command evaluates a policy and formats the output by using the Services Modeling Language Interchange Format (SML-IF) schema. The output is redirected to a file.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 4: Evaluate a filtered set of policies --------</maml:title> <dev:code>PS C:\> Set-Location "SQLSERVER:\SQLPolicy\MYCOMPUTER\DEFAULT\Policies" PS C:\> Get-ChildItem | Where-Object { $_.PolicyCategory -eq "Microsoft Best Practices: Maintenance" } | Invoke-PolicyEvaluation -TargetServer 'MYCOMPUTER'</dev:code> <dev:remarks> <maml:para>The first command sets the current path to a SQL Server policy store.</maml:para> <maml:para>The second command uses Get-ChildItem to read all of the polices and then uses Where-Object to filter the list for the policies that have their PolicyCategory property set to "Microsoft Best Practices: Maintenance".</maml:para> <maml:para>The output is sent to Invoke-PolicyEvaluation by using the pipeline operator.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Evaluate policies from XML files by using a SqlStoreConnection object</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Policies\DatabaseEngine\1033" PS C:\> $Connection = New-Object Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection("server='MYCOMPUTER';Trusted_Connection=True") PS C:\> Invoke-PolicyEvaluation -Policy "Database Status.xml" -TargetServer $Connection</dev:code> <dev:remarks> <maml:para>The first command sets the current location to a local folder that contains policy evaulations in XML files.</maml:para> <maml:para>The second command uses New-Object to create a SqlStoreConnection object.</maml:para> <maml:para>The third command evaluates policy from an XML file against the server defined by the SqlStoreConnection object.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>- Example 6: Evaluate policy using a manually loaded assembly -</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\ tools\Policies\analysisservices\1033" PS C:\> [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") PS C:\> $SSASsvr = New-Object Microsoft.AnalysisServices.Server PS C:\> $SSASsvr.Connect("Data Source=localhost") PS C:\> Invoke-PolicyEvaluation "Surface Area Configuration for Analysis Services Features.xml" -TargetObject $SSASsvr</dev:code> <dev:remarks> <maml:para>The first command sets the current folder location.</maml:para> <maml:para>The second command loads an instance of the SQL Server Analysis Services assembly.</maml:para> <maml:para>The third command creates a Microsoft.AnalysisServices object.</maml:para> <maml:para>The fourth command uses the new AnalysisServices object to open a connection to the default server instance on the local computer.</maml:para> <maml:para>The fifth command evaluates the Analysis Services surface area configuration policy.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 7: Evaluate a filterd set of policies --------</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Policies\DatabaseEngine\1033" PS C:\> Invoke-PolicyEvaluation "Database Status.xml" -TargetServer "MYCOMPUTER" -TargetExpression "Server[@Name='MYCOMPUTER']/Database[@Name='AdventureWorks2014']"</dev:code> <dev:remarks> <maml:para>This command uses the TargetExpression parameter to specify a query expression that filters the database status policy be evaluated against the AdventureWorks2014 sample database and performs the evaluation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 8: Evaluate the reporting services surface area configuration policy</maml:title> <dev:code>PS C:\> Set-Location "C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Policies\ReportingServices\1033" PS C:\> [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Dmf.Adapters") PS C:\> $SSRSsvr = New-Object Microsoft.SqlServer.Management.Adapters.RSContainer('MyComputer') PS C:\> Invoke-PolicyEvaluation -Policy "Surface Area Configuration for Reporting Services 2008 Features.xml" -TargetObject $SSRSsvr</dev:code> <dev:remarks> <maml:para>This command loads the SQL Server Reporting Services assembly, creates a connection to the default server instance on the local computer, and runs the Reporting Services surface area configuration policy.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/invoke-policyevaluation</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Invoke-Sqlcmd</command:name> <command:verb>Invoke</command:verb> <command:noun>Sqlcmd</command:noun> <maml:description> <maml:para>Runs a script containing statements supported by the SQL Server SQLCMD utility.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Invoke-Sqlcmd cmdlet runs a script containing the languages and commands supported by the SQL Server SQLCMD utility.</maml:para> <maml:para>The commands supported are Transact-SQL statements and the subset of the XQuery syntax that is supported by the database engine.</maml:para> <maml:para>This cmdlet also accepts many of the commands supported natively by SQLCMD, such as GO and QUIT.</maml:para> <maml:para>This cmdlet also accepts the SQLCMD scripting variables, such as SQLCMDUSER. By default, this cmdlet does not set SQLCMD scripting variables.</maml:para> <maml:para>This cmdlet does not support the use of commands that are primarily related to interactive script editing.</maml:para> <maml:para>The commands not supported include :!!, :connect, :error, :out, :ed, :list, :listvar, :reset, :perftrace, and :serverlist.</maml:para> <maml:para>When this cmdlet is run, the first result set that the script returns is displayed as a formatted table.</maml:para> <maml:para>If subsequent result sets contain different column lists than the first, those result sets are not displayed.</maml:para> <maml:para>If subsequent result sets after the first set have the same column list, their rows are appended to the formatted table that contains the rows that were returned by the first result set.</maml:para> <maml:para>You can display SQL Server message output, such as those that result from the SQL PRINT statement, by specifying the Verbose parameter.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Invoke-Sqlcmd</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Query</maml:name> <maml:description> <maml:para>Specifies one or more queries that this cmdlet runs. The queries can be Transact-SQL or XQuery statements, or sqlcmd commands. Multiple queries separated by a semicolon can be specified. Do not specify the sqlcmd GO separator. Escape any double quotation marks included in the string. Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AbortOnError</maml:name> <maml:description> <maml:para>Indicates that this cmdlet stops the SQL Server command and returns an error level to the Windows PowerShell ERRORLEVEL variable if this cmdlet encounters an error.</maml:para> <maml:para>The error level returned is 1 if the error has a severity higher than 10, and the error level is 0 if the error has a severity of 10 or less.</maml:para> <maml:para>If the ErrorLevel parameter is also specified, this cmdlet returns 1 only if the error message severity is also equal to or higher than the value specified for ErrorLevel.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity` (see references at the bottom of this page)</maml:para> <maml:para>In common scenarios, this parameter is obtained with something like `(Get-AzAccessToken -ResourceUrl https://database.windows.net).Token` (requires the Az.Account module)</maml:para> <maml:para>Do not specify UserName , Password , or Credential when using this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ApplicationIntent</maml:name> <maml:description> <maml:para>The application workload type when connecting to a database in an SQL Server Availability Group.</maml:para> <maml:para>Allowed values are: ReadOnly and ReadWrite.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ReadWrite</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ReadOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ApplicationIntent</command:parameterValue> <dev:type> <maml:name>ApplicationIntent</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>ReadWrite</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>The name of the application associated with the connection.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>.NET SqlClient Data Provider</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds when this cmdlet times out if it cannot successfully connect to an instance of the Database Engine. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>The PSCredential object whose Username and Password fields will be used to connect to the SQL instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the Database parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path. If the path is not based on the SQL folder, or the path does not contain a database name, this cmdlet connects to the default database for the current login ID. If you specify the IgnoreProviderContext parameter switch, this cmdlet does not consider any database specified in the current path, and connects to the database defined as the default for the current login ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DedicatedAdministratorConnection</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses a Dedicated Administrator Connection (DAC) to connect to an instance of the Database Engine.</maml:para> <maml:para>DAC is used by system administrators for actions such as troubleshooting instances that will not accept new standard connections.</maml:para> <maml:para>The instance must be configured to support DAC.</maml:para> <maml:para>If DAC is not enabled, this cmdlet reports an error and will not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableCommands</maml:name> <maml:description> <maml:para>Indicates that this cmdlet turns off some sqlcmd features that might compromise security when run in batch files.</maml:para> <maml:para>It prevents Windows PowerShell variables from being passed in to the Invoke-Sqlcmd script.</maml:para> <maml:para>The startup script specified in the SQLCMDINI scripting variable is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableVariables</maml:name> <maml:description> <maml:para>Indicates that this cmdlet ignores sqlcmd scripting variables. This is useful when a script contains many INSERT statements that may contain strings that have the same format as variables, such as $(variable_name).</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>When not specified, the default value is `Mandatory`.</maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptConnection</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses Secure Sockets Layer (SSL/TLS) encryption for the connection to the instance of the Database Engine specified in the ServerInstance parameter.</maml:para> <maml:para>> Starting in v22 of the module, this parameter is deprecated. Connections are encrypted by default. Please, consider using the new -Encrypt parameter instead. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLevel</maml:name> <maml:description> <maml:para>Specifies that this cmdlet display only error messages whose severity level is equal to or higher than the value specified. All error messages are displayed if this parameter is not specified or set to 0. Database Engine error severities range from 1 to 24.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverPartner</maml:name> <maml:description> <maml:para>The name or address of the partner server to connect to if the primary server is down.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>""</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="WorkstationID"> <maml:name>HostName</maml:name> <maml:description> <maml:para>Specifies a workstation name. The workstation name is reported by the sp_who system stored procedure and in the hostname column of the sys.processes catalog view. If this parameter is not specified, the default is the name of the computer on which Invoke-Sqlcmd is run. This parameter can be used to identify different Invoke-Sqlcmd sessions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet ignores the database context that was established by the current SQLSERVER:\SQL path. If the Database parameter is not specified, this cmdlet uses the default database for the current login ID or Windows account.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSqlUserErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns SQL user script errors that are otherwise ignored by default. If this parameter is specified, this cmdlet matches the default behavior of the sqlcmd utility.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputFile</maml:name> <maml:description> <maml:para>Specifies a file to be used as the query input to this cmdlet. The file can contain Transact-SQL statements, XQuery statements, and sqlcmd commands and scripting variables. Specify the full path to the file. Spaces are not allowed in the file path or file name. The file is expected to be encoded using UTF-8.</maml:para> <maml:para>You should only run scripts from trusted sources. Ensure all input scripts are secured with the appropriate NTFS permissions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxBinaryLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes returned for columns with binary string data types, such as binary and varbinary. The default value is 1,024 bytes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxCharLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of characters returned for columns with character or Unicode data types, such as char, nchar, varchar, and nvarchar. The default value is 4,000 characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MultiSubnetFailover</maml:name> <maml:description> <maml:para>If your application is connecting to an AlwaysOn Availability Group (AG) on different subnets, passing this parameter provides faster detection of and connection to the (currently) active server.</maml:para> <maml:para>Note: passing -MultiSubnetFailover isn't required with .NET Framework 4.6.1 or later versions.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NewPassword</maml:name> <maml:description> <maml:para>Specifies a new password for a SQL Server Authentication login ID. This cmdlet changes the password and then exits. You must also specify the Username and Password parameters, with Password that specifies the current password for the login.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of the results this cmdlet gets.</maml:para> <maml:para>If you do not specify a value for this parameter, the cmdlet sets the value to DataRows.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTables</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputType</command:parameterValue> <dev:type> <maml:name>OutputType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputSqlErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays error messages in the Invoke-Sqlcmd output.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Password</maml:name> <maml:description> <maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in the Username parameter. Passwords are case-sensitive. When possible, use Windows Authentication. Do not use a blank password, when possible use a strong password.</maml:para> <maml:para>If you specify the Password parameter followed by your password, the password is visible to anyone who can see your monitor.</maml:para> <maml:para>If you code Password followed by your password in a .ps1 script, anyone reading the script file will see your password.</maml:para> <maml:para>Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>QueryTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer value between 1 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies a character string or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeverityLevel</maml:name> <maml:description> <maml:para>Specifies the lower limit for the error message severity level this cmdlet returns to the ERRORLEVEL Windows PowerShell variable.</maml:para> <maml:para>This cmdlet returns the highest severity level from the error messages generated by the queries it runs, provided that severity is equal to or higher than specified in the SeverityLevel parameter.</maml:para> <maml:para>If SeverityLevel is not specified or set to 0, this cmdlet returns 0 to ERRORLEVEL.</maml:para> <maml:para>The severity levels of Database Engine error messages range from 1 to 24.</maml:para> <maml:para>This cmdlet does not report severities for informational messages that have a severity of 10</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatisticsVariable</maml:name> <maml:description> <maml:para>Specify the name of a PowerShell variable that will be assigned the SQL Server run-time statistics when the cmdlet is executed.</maml:para> <maml:para>Common use for this parameter is to capture the `ExecutionTime` (the cumulative amount of time (in milliseconds) that the provider has spent processing the cmdlet), or `IduRows` (the total number of rows affected by INSERT, DELETE, and UPDATE statements).</maml:para> <maml:para>For more details, see Provider Statistics for SQL Server (/dotnet/framework/data/adonet/sql/provider-statistics-for-sql-server).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Username</maml:name> <maml:description> <maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine.</maml:para> <maml:para>The password must be specified through the Password parameter.</maml:para> <maml:para>If Username and Password are not specified, this cmdlet attempts a Windows Authentication connection using the Windows account running the Windows PowerShell session. When possible, use Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Specifies a set of sqlcmd scripting variables for use in the sqlcmd script, and sets a values for the variables.</maml:para> <maml:para>Use a Windows PowerShell array to specify multiple variables and their values; alternatively, use a `Hashtable` where the key represent the variable name and the value the variable value.</maml:para> <maml:para>> When using an array, parameter values are trimmed. This behavior was kept in v22 of the module for backward compatibility with v21. It is recommended not to rely on this behavior, which may change in a future major version of the module.</maml:para> <maml:para>> The parameter of type `Hashtable` is only available in v22+ of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-Sqlcmd</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Query</maml:name> <maml:description> <maml:para>Specifies one or more queries that this cmdlet runs. The queries can be Transact-SQL or XQuery statements, or sqlcmd commands. Multiple queries separated by a semicolon can be specified. Do not specify the sqlcmd GO separator. Escape any double quotation marks included in the string. Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AbortOnError</maml:name> <maml:description> <maml:para>Indicates that this cmdlet stops the SQL Server command and returns an error level to the Windows PowerShell ERRORLEVEL variable if this cmdlet encounters an error.</maml:para> <maml:para>The error level returned is 1 if the error has a severity higher than 10, and the error level is 0 if the error has a severity of 10 or less.</maml:para> <maml:para>If the ErrorLevel parameter is also specified, this cmdlet returns 1 only if the error message severity is also equal to or higher than the value specified for ErrorLevel.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity` (see references at the bottom of this page)</maml:para> <maml:para>In common scenarios, this parameter is obtained with something like `(Get-AzAccessToken -ResourceUrl https://database.windows.net).Token` (requires the Az.Account module)</maml:para> <maml:para>Do not specify UserName , Password , or Credential when using this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableCommands</maml:name> <maml:description> <maml:para>Indicates that this cmdlet turns off some sqlcmd features that might compromise security when run in batch files.</maml:para> <maml:para>It prevents Windows PowerShell variables from being passed in to the Invoke-Sqlcmd script.</maml:para> <maml:para>The startup script specified in the SQLCMDINI scripting variable is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableVariables</maml:name> <maml:description> <maml:para>Indicates that this cmdlet ignores sqlcmd scripting variables. This is useful when a script contains many INSERT statements that may contain strings that have the same format as variables, such as $(variable_name).</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLevel</maml:name> <maml:description> <maml:para>Specifies that this cmdlet display only error messages whose severity level is equal to or higher than the value specified. All error messages are displayed if this parameter is not specified or set to 0. Database Engine error severities range from 1 to 24.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSqlUserErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns SQL user script errors that are otherwise ignored by default. If this parameter is specified, this cmdlet matches the default behavior of the sqlcmd utility.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputFile</maml:name> <maml:description> <maml:para>Specifies a file to be used as the query input to this cmdlet. The file can contain Transact-SQL statements, XQuery statements, and sqlcmd commands and scripting variables. Specify the full path to the file. Spaces are not allowed in the file path or file name. The file is expected to be encoded using UTF-8.</maml:para> <maml:para>You should only run scripts from trusted sources. Ensure all input scripts are secured with the appropriate NTFS permissions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if any column to be queried is protected with Always Encrypted using a column master key stored in a key vault in Azure Key Vault. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if any column to be queried is protected with Always Encrypted using a column master key stored in a managed HSM in Azure Key Vault. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxBinaryLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes returned for columns with binary string data types, such as binary and varbinary. The default value is 1,024 bytes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxCharLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of characters returned for columns with character or Unicode data types, such as char, nchar, varchar, and nvarchar. The default value is 4,000 characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of the results this cmdlet gets.</maml:para> <maml:para>If you do not specify a value for this parameter, the cmdlet sets the value to DataRows.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTables</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputType</command:parameterValue> <dev:type> <maml:name>OutputType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputSqlErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays error messages in the Invoke-Sqlcmd output.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>QueryTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer value between 1 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeverityLevel</maml:name> <maml:description> <maml:para>Specifies the lower limit for the error message severity level this cmdlet returns to the ERRORLEVEL Windows PowerShell variable.</maml:para> <maml:para>This cmdlet returns the highest severity level from the error messages generated by the queries it runs, provided that severity is equal to or higher than specified in the SeverityLevel parameter.</maml:para> <maml:para>If SeverityLevel is not specified or set to 0, this cmdlet returns 0 to ERRORLEVEL.</maml:para> <maml:para>The severity levels of Database Engine error messages range from 1 to 24.</maml:para> <maml:para>This cmdlet does not report severities for informational messages that have a severity of 10</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatisticsVariable</maml:name> <maml:description> <maml:para>Specify the name of a PowerShell variable that will be assigned the SQL Server run-time statistics when the cmdlet is executed.</maml:para> <maml:para>Common use for this parameter is to capture the `ExecutionTime` (the cumulative amount of time (in milliseconds) that the provider has spent processing the cmdlet), or `IduRows` (the total number of rows affected by INSERT, DELETE, and UPDATE statements).</maml:para> <maml:para>For more details, see Provider Statistics for SQL Server (/dotnet/framework/data/adonet/sql/provider-statistics-for-sql-server).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Specifies a set of sqlcmd scripting variables for use in the sqlcmd script, and sets a values for the variables.</maml:para> <maml:para>Use a Windows PowerShell array to specify multiple variables and their values; alternatively, use a `Hashtable` where the key represent the variable name and the value the variable value.</maml:para> <maml:para>> When using an array, parameter values are trimmed. This behavior was kept in v22 of the module for backward compatibility with v21. It is recommended not to rely on this behavior, which may change in a future major version of the module.</maml:para> <maml:para>> The parameter of type `Hashtable` is only available in v22+ of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AbortOnError</maml:name> <maml:description> <maml:para>Indicates that this cmdlet stops the SQL Server command and returns an error level to the Windows PowerShell ERRORLEVEL variable if this cmdlet encounters an error.</maml:para> <maml:para>The error level returned is 1 if the error has a severity higher than 10, and the error level is 0 if the error has a severity of 10 or less.</maml:para> <maml:para>If the ErrorLevel parameter is also specified, this cmdlet returns 1 only if the error message severity is also equal to or higher than the value specified for ErrorLevel.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity` (see references at the bottom of this page)</maml:para> <maml:para>In common scenarios, this parameter is obtained with something like `(Get-AzAccessToken -ResourceUrl https://database.windows.net).Token` (requires the Az.Account module)</maml:para> <maml:para>Do not specify UserName , Password , or Credential when using this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ApplicationIntent</maml:name> <maml:description> <maml:para>The application workload type when connecting to a database in an SQL Server Availability Group.</maml:para> <maml:para>Allowed values are: ReadOnly and ReadWrite.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ApplicationIntent</command:parameterValue> <dev:type> <maml:name>ApplicationIntent</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>ReadWrite</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ApplicationName</maml:name> <maml:description> <maml:para>The name of the application associated with the connection.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>.NET SqlClient Data Provider</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds when this cmdlet times out if it cannot successfully connect to an instance of the Database Engine. The timeout value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>The PSCredential object whose Username and Password fields will be used to connect to the SQL instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the Database parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path. If the path is not based on the SQL folder, or the path does not contain a database name, this cmdlet connects to the default database for the current login ID. If you specify the IgnoreProviderContext parameter switch, this cmdlet does not consider any database specified in the current path, and connects to the database defined as the default for the current login ID.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DedicatedAdministratorConnection</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses a Dedicated Administrator Connection (DAC) to connect to an instance of the Database Engine.</maml:para> <maml:para>DAC is used by system administrators for actions such as troubleshooting instances that will not accept new standard connections.</maml:para> <maml:para>The instance must be configured to support DAC.</maml:para> <maml:para>If DAC is not enabled, this cmdlet reports an error and will not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableCommands</maml:name> <maml:description> <maml:para>Indicates that this cmdlet turns off some sqlcmd features that might compromise security when run in batch files.</maml:para> <maml:para>It prevents Windows PowerShell variables from being passed in to the Invoke-Sqlcmd script.</maml:para> <maml:para>The startup script specified in the SQLCMDINI scripting variable is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DisableVariables</maml:name> <maml:description> <maml:para>Indicates that this cmdlet ignores sqlcmd scripting variables. This is useful when a script contains many INSERT statements that may contain strings that have the same format as variables, such as $(variable_name).</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>When not specified, the default value is `Mandatory`.</maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptConnection</maml:name> <maml:description> <maml:para>Indicates that this cmdlet uses Secure Sockets Layer (SSL/TLS) encryption for the connection to the instance of the Database Engine specified in the ServerInstance parameter.</maml:para> <maml:para>> Starting in v22 of the module, this parameter is deprecated. Connections are encrypted by default. Please, consider using the new -Encrypt parameter instead. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLevel</maml:name> <maml:description> <maml:para>Specifies that this cmdlet display only error messages whose severity level is equal to or higher than the value specified. All error messages are displayed if this parameter is not specified or set to 0. Database Engine error severities range from 1 to 24.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverPartner</maml:name> <maml:description> <maml:para>The name or address of the partner server to connect to if the primary server is down.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>""</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="WorkstationID"> <maml:name>HostName</maml:name> <maml:description> <maml:para>Specifies a workstation name. The workstation name is reported by the sp_who system stored procedure and in the hostname column of the sys.processes catalog view. If this parameter is not specified, the default is the name of the computer on which Invoke-Sqlcmd is run. This parameter can be used to identify different Invoke-Sqlcmd sessions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet ignores the database context that was established by the current SQLSERVER:\SQL path. If the Database parameter is not specified, this cmdlet uses the default database for the current login ID or Windows account.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IncludeSqlUserErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns SQL user script errors that are otherwise ignored by default. If this parameter is specified, this cmdlet matches the default behavior of the sqlcmd utility.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputFile</maml:name> <maml:description> <maml:para>Specifies a file to be used as the query input to this cmdlet. The file can contain Transact-SQL statements, XQuery statements, and sqlcmd commands and scripting variables. Specify the full path to the file. Spaces are not allowed in the file path or file name. The file is expected to be encoded using UTF-8.</maml:para> <maml:para>You should only run scripts from trusted sources. Ensure all input scripts are secured with the appropriate NTFS permissions.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if any column to be queried is protected with Always Encrypted using a column master key stored in a key vault in Azure Key Vault. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if any column to be queried is protected with Always Encrypted using a column master key stored in a managed HSM in Azure Key Vault. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxBinaryLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes returned for columns with binary string data types, such as binary and varbinary. The default value is 1,024 bytes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxCharLength</maml:name> <maml:description> <maml:para>Specifies the maximum number of characters returned for columns with character or Unicode data types, such as char, nchar, varchar, and nvarchar. The default value is 4,000 characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MultiSubnetFailover</maml:name> <maml:description> <maml:para>If your application is connecting to an AlwaysOn Availability Group (AG) on different subnets, passing this parameter provides faster detection of and connection to the (currently) active server.</maml:para> <maml:para>Note: passing -MultiSubnetFailover isn't required with .NET Framework 4.6.1 or later versions.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NewPassword</maml:name> <maml:description> <maml:para>Specifies a new password for a SQL Server Authentication login ID. This cmdlet changes the password and then exits. You must also specify the Username and Password parameters, with Password that specifies the current password for the login.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of the results this cmdlet gets.</maml:para> <maml:para>If you do not specify a value for this parameter, the cmdlet sets the value to DataRows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">OutputType</command:parameterValue> <dev:type> <maml:name>OutputType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OutputSqlErrors</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays error messages in the Invoke-Sqlcmd output.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Password</maml:name> <maml:description> <maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in the Username parameter. Passwords are case-sensitive. When possible, use Windows Authentication. Do not use a blank password, when possible use a strong password.</maml:para> <maml:para>If you specify the Password parameter followed by your password, the password is visible to anyone who can see your monitor.</maml:para> <maml:para>If you code Password followed by your password in a .ps1 script, anyone reading the script file will see your password.</maml:para> <maml:para>Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Query</maml:name> <maml:description> <maml:para>Specifies one or more queries that this cmdlet runs. The queries can be Transact-SQL or XQuery statements, or sqlcmd commands. Multiple queries separated by a semicolon can be specified. Do not specify the sqlcmd GO separator. Escape any double quotation marks included in the string. Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>QueryTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer value between 1 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies a character string or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeverityLevel</maml:name> <maml:description> <maml:para>Specifies the lower limit for the error message severity level this cmdlet returns to the ERRORLEVEL Windows PowerShell variable.</maml:para> <maml:para>This cmdlet returns the highest severity level from the error messages generated by the queries it runs, provided that severity is equal to or higher than specified in the SeverityLevel parameter.</maml:para> <maml:para>If SeverityLevel is not specified or set to 0, this cmdlet returns 0 to ERRORLEVEL.</maml:para> <maml:para>The severity levels of Database Engine error messages range from 1 to 24.</maml:para> <maml:para>This cmdlet does not report severities for informational messages that have a severity of 10</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StatisticsVariable</maml:name> <maml:description> <maml:para>Specify the name of a PowerShell variable that will be assigned the SQL Server run-time statistics when the cmdlet is executed.</maml:para> <maml:para>Common use for this parameter is to capture the `ExecutionTime` (the cumulative amount of time (in milliseconds) that the provider has spent processing the cmdlet), or `IduRows` (the total number of rows affected by INSERT, DELETE, and UPDATE statements).</maml:para> <maml:para>For more details, see Provider Statistics for SQL Server (/dotnet/framework/data/adonet/sql/provider-statistics-for-sql-server).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>> This parameter is new in v22 of the module. For more details, see `Strict Connection Encryption` under Related Links (#related-links).</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Username</maml:name> <maml:description> <maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine.</maml:para> <maml:para>The password must be specified through the Password parameter.</maml:para> <maml:para>If Username and Password are not specified, this cmdlet attempts a Windows Authentication connection using the Windows account running the Windows PowerShell session. When possible, use Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Variable</maml:name> <maml:description> <maml:para>Specifies a set of sqlcmd scripting variables for use in the sqlcmd script, and sets a values for the variables.</maml:para> <maml:para>Use a Windows PowerShell array to specify multiple variables and their values; alternatively, use a `Hashtable` where the key represent the variable name and the value the variable value.</maml:para> <maml:para>> When using an array, parameter values are trimmed. This behavior was kept in v22 of the module for backward compatibility with v21. It is recommended not to rely on this behavior, which may change in a future major version of the module.</maml:para> <maml:para>> The parameter of type `Hashtable` is only available in v22+ of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Connect to a named instance and run a script ---</maml:title> <dev:code>Invoke-Sqlcmd -Query "SELECT GETDATE() AS TimeOfQuery" -ServerInstance "MyComputer\MainInstance" TimeOfQuery ----------- 9/21/2017 2:48:24 PM</dev:code> <dev:remarks> <maml:para>This command connects to a named instance of the SQL Database Engine on a computer and runs a basic Transact-SQL script.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Invoke commands in a script file and save the output in a text file</maml:title> <dev:code>Invoke-Sqlcmd -InputFile "C:\ScriptFolder\TestSqlCmd.sql" | Out-File -FilePath "C:\ScriptFolder\TestSqlCmd.rpt" Output sent to TestSqlCmd.rpt.</dev:code> <dev:remarks> <maml:para>This command reads a file containing Transact-SQL statements and SQLCMD commands, runs the file, and writes the output to another file.</maml:para> <maml:para>The output file may contain proprietary information, so you should secure the output files with the appropriate NTFS permissions.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Invoke a script and pass in variable values from a string</maml:title> <dev:code>$StringArray = "MYVAR1='String1'", "MYVAR2='String2'" Invoke-Sqlcmd -Query "SELECT `$(MYVAR1) AS Var1, `$(MYVAR2) AS Var2" -Variable $StringArray Var1 Var2 ---- ---- String1 String2</dev:code> <dev:remarks> <maml:para>This command uses an array of character strings as input to the Variable parameter.</maml:para> <maml:para>The array defines multiple SQLCMD variables.</maml:para> <maml:para>The $ signs in the SELECT statement that identify the SQLCMD variables are escaped using the back-tick (`) character.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Invoke a script and pass in variables from the SQL database engine</maml:title> <dev:code>Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance" PS SQLSERVER:\SQL\MyComputer\MainInstance> Invoke-Sqlcmd -Query "SELECT SERVERPROPERTY('MachineName') AS ComputerName" -ServerInstance (Get-Item .) ComputerName ------------ MyComputer</dev:code> <dev:remarks> <maml:para>This command uses Set-Location to navigate to the SQL ServerWindows PowerShell provider path for an instance of the SQL Database Engine.</maml:para> <maml:para>Then it calls Get-Item to retrieve a SQL Management Object Server object for use as the ServerInstance parameter of Invoke-Sqlcmd.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------ Example 5: Run a query and display verbose output ------</maml:title> <dev:code>Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance" Invoke-SqlCmd -Query "PRINT N'abc'" -Verbose VERBOSE: abc</dev:code> <dev:remarks> <maml:para>This command uses the Windows PowerShellVerbose parameter to return the message output of the SQL PRINT command.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 6: Invoke a command using a positional string as input</maml:title> <dev:code>Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" PS SQLSERVER:\SQL\MyComputer\MainInstance> Invoke-Sqlcmd "SELECT DB_NAME() AS DatabaseName" WARNING: Using provider context. Server = MyComputer\MainInstance, Database = MyDatabase. DatabaseName ------------ MyDatabase</dev:code> <dev:remarks> <maml:para>This command uses a positional string to supply the input to the Query parameter.</maml:para> <maml:para>It also demonstrates how Invoke-Sqlcmd uses the current path to set the database context to MyDatabase.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 7: Capture data into a DataSet object --------</maml:title> <dev:code>$DS = Invoke-Sqlcmd -ServerInstance "MyComputer" -Query "SELECT ID, Item FROM MyDB.dbo.MyTable" -As DataSet $DS.Tables[0].Rows | %{ echo "{ $($_['ID']), $($_['Item']) }" } { 10, AAA } { 20, BBB } { 30, CCC }</dev:code> <dev:remarks> <maml:para>This command uses the As DataSet parameter to capture the data into a .Net System.Data.DataSet object and stores the result in the variable '$DS'. The object can be used for further processing.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------------- Example 8: Get specific column sets -------------</maml:title> <dev:code>$Tables = Invoke-Sqlcmd -ServerInstance "MyComputer" -Query "SELECT Item, id FROM MyDatabase.dbo.MyTable; SELECT GETDATE() AS T" -As DataTables $Tables[0].Rows | %{ echo $_.ID } $Tables[1].Rows | %{ echo $_.T.DayOfWeek } 10 20 30 Monday</dev:code> <dev:remarks> <maml:para>The first command uses the As DataTables parameter to capture the data into a collection of .Net System.Data.DataTable objects. The command gets two tables with different column sets.</maml:para> <maml:para>Each table can be processed individually, based on its own schema.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------- Example 9: Gain full control of a connection ---------</maml:title> <dev:code>Invoke-Sqlcmd -Query "SELECT COUNT(*) AS Count FROM MyTable" -ConnectionString "Data Source=MYSERVER;Initial Catalog=MyDatabase;Integrated Security=True;ApplicationIntent=ReadOnly" Count ----- 127432</dev:code> <dev:remarks> <maml:para>This command users the -ConnectionString parameter to gain full control of the connection that this cmdlet establishes, instead of the Invoke-Sqlcmd to build the connection string based on the parameters passed on the command line.</maml:para> <maml:para>This is useful for less-common properties that you may want to use.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 10: Execute a stored procedure and capture the SQL errors</maml:title> <dev:code>$script_sp_with_errors = @' CREATE PROCEDURE [dbo].[TestProcedure3] AS BEGIN CREATE TABLE [dbo].[TestTable] (col INT NOT NULL); INSERT INTO [dbo].[TestTable] VALUES (NULL); -- will cause an error END GO '@ # Create a test database Invoke-SqlCmd -ServerInstance MyServer -Query 'CREATE DATABASE TestDB' # ... adds a stored procedure that has errors in it... Invoke-SqlCmd -ServerInstance MyServer -Database 'TestDB' -Query $script_sp_with_errors # ... executes the SP and collected the errors Invoke-SqlCmd -ServerInstance MyServer -Database 'TestDB' -Query 'EXEC TestProcedure3' -OutputSqlErrors $true Here's the output: Invoke-SqlCmd : Cannot insert the value NULL into column 'col', table 'TestDB.dbo.TestTable'; column does not allow nulls. INSERT fails. The statement has been terminated. Msg 515, Level 16, State 2, Procedure TestProcedure3, Line 5. At line:1 char:1 ...</dev:code> <dev:remarks> <maml:para>This command users the -OutputSqlErrors parameter to report the errors to the user. Note that the error message in this case provides extra information like the SP name and the line number where the error occurred.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 11: Connect to Azure SQL Database (or Managed Instance) using an Access Token</maml:title> <dev:code>Import-Module SQLServer Import-Module Az.Accounts -MinimumVersion 2.2.0 # Note: the sample assumes that you or your DBA configured the server to accept connections using # that Service Principal and has granted it access to the database (in this example at least # the SELECT permission). ### Obtain the Access Token: this will bring up the login dialog Connect-AzAccount $access_token = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token # Now that we have the token, we use it to connect to the database 'mydb' on server 'myserver' Invoke-Sqlcmd -ServerInstance myserver.database.windows.net -Database mydb -AccessToken $access_token` -query 'select * from Table1'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 12: Connect to Azure SQL Database (or Managed Instance) using a Service Principal</maml:title> <dev:code>Import-Module SQLServer # Note: the sample assumes that you or your DBA configured the server to accept connections using # that Service Principal and has granted it access to the database (in this example at least # the SELECT permission). $clientid = "enter application id that corresponds to the Service Principal" # Do not confuse with its display name $tenantid = "enter the tenant ID of the Service Principal" $secret = "enter the secret associated with the Service Principal" $request = Invoke-RestMethod -Method POST ` -Uri "https://login.microsoftonline.com/$tenantid/oauth2/token"` -Body @{ resource="https://database.windows.net/"; grant_type="client_credentials"; client_id=$clientid; client_secret=$secret }` -ContentType "application/x-www-form-urlencoded" $access_token = $request.access_token # Now that we have the token, we use it to connect to the database 'mydb' on server 'myserver' Invoke-Sqlcmd -ServerInstance myserver.database.windows.net -Database mydb -AccessToken $access_token` -query 'select * from Table1'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 13: Connect to Azure SQL Database (or Managed Instance) using a System Assigned Managed Identity (SAMI)</maml:title> <dev:code>Import-Module SQLServer # Note: the sample assumes that you or your DBA configured the server to accept connections using # that VM Identity you are running on and has granted it access to the database (in this # example at least the SELECT permission). Connect-AzAccount -Identity $access_token = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token # Now that we have the token, we use it to connect to the database 'mydb' on server 'myserver' Invoke-Sqlcmd -ServerInstance myserver.database.windows.net -Database mydb -AccessToken $access_token ` -query 'select * from Table1'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 14: Connect to Azure SQL Database (or Managed Instance) using a User Assigned Managed Identity (UAMI)</maml:title> <dev:code>Import-Module SQLServer # Note: the sample assumes that you or your DBA configured the server to accept connections using # that VM Identity you are running on and has granted it access to the database (in this # example at least the SELECT permission). Connect-AzAccount -Identity -AccountId '<your-user-assigned-managed-identity-client-id>' $access_token = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token # Now that we have the token, we use it to connect to the database 'mydb' on server 'myserver' Invoke-Sqlcmd -ServerInstance myserver.database.windows.net -Database mydb -AccessToken $access_token ` -query 'select * from Table1'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 15: Connect to an Availability Group configured for Read-Only Routing using -ApplicationIntent</maml:title> <dev:code># In the following example: # - MT_2009250511 is a listener for an AG configured for Read-Only Routing (port 5555) # - AGDB_2_1 is the DB in the AG # - VLM00226138 is the primary replica configured to only allow ReadWrite connections # - VLM00226137 is the secondary replica # Invoke-Sqlcmd -ServerInstance "MT_2009250511,5555" -Database AGDB_2_1 ` -HostName "PowershellBox1" -ApplicationName "ReadWrite" -ApplicationIntent ReadWrite ` -Query "select HOST_NAME() AS HostName, APP_NAME() AS ApplicationIntent, @@SERVERNAME AS ServerName" Invoke-Sqlcmd -ServerInstance "MT_2009250511,5555" -Database AGDB_2_1 ` -HostName "PowershellBox2" -ApplicationName "ReadOnly" -ApplicationIntent ReadOnly ` -Query "select HOST_NAME() AS HostName, APP_NAME() AS ApplicationIntent, @@SERVERNAME AS ServerName" # When you run the 2 cmdlets above, the output is going to be something like this: # # HostName ApplicationIntent ServerName # -------- ----------------- ---------- # PowershellBox1 ReadWrite VLM00226138 # # HostName ApplicationIntent ServerName # -------- ----------------- ---------- # PowershellBox2 ReadOnly VLM00226137</dev:code> <dev:remarks> <maml:para>which shows that, depending on the value of the `-ApplicationIntent` parameter, the connection is routed to a different server in the AG. Incidentally, observe the uses of the `-ApplicationName` and `-HostName` parameters to visually differentiate the two results: this is a common technique that can be used to trace connections and their intents, beyond the -ApplicationIntent example illustrated here.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 16: Capture connection statistics via -StatisticsVariable parameter</maml:title> <dev:code>Import-Module SQLServer Invoke-Sqlcmd -ServerInstance localhost -StatisticsVariable stats ` -Query 'CREATE TABLE #Table (ID int); INSERT INTO #Table VALUES(1), (2); INSERT INTO #Table VALUES(3); SELECT * FROM #Table' Write-Host "Number of rows affected......: $($stats.IduRows)" Write-Host "Number of insert statements..: $($stats.IduCount)" Write-Host "Number of select statements..: $($stats.SelectCount)" Write-Host "Total execution time.........: $($stats.ExecutionTime)ms" # When you run the code fragment above, is going to be something like this: # # Number of rows affected......: 3 # Number of insert statements..: 2 # Number of select statements..: 1 # Total execution time.........: 5ms</dev:code> <dev:remarks> <maml:para>This example shows how to use the `-StatisticsVariable` parameter to capture informations about the connection, the statements executed, and the execution time when running some T-SQL that creates a temporary table, insert some value, and finally issues a select to get all the inserted rows.</maml:para> <maml:para>Note: when the same query is executed against multiple servers (e.g. by piping the server names thru the cmdlet), the `StatisticsVariable` captures an array of statistics, one for each connection. Results can then be aggregated by using, for example, `($stats.IduRows | Measure-Object -Sum).Sum`.</maml:para> <maml:para>Refer to Provider Statistics for SQL Server (/dotnet/framework/data/adonet/sql/provider-statistics-for-sql-server)for a more information about the available statistics.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 17: Run a query that decrypts data retrieved from columns encrypted using Always Encrypted. Assume the column master key is stored in a key vault in Azure Key Vault.</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Pass the token to the cmdlet, so that it can use it to authenticate to Azure when decrypting data protected with Always Encrypted. $connString = 'Data Source=MYSERVER;Initial Catalog=MyDatabase;Integrated Security=True;ApplicationIntent=ReadOnly;Column Encryption Setting=Enabled' Invoke-Sqlcmd -Query 'SELECT COUNT(*) AS Count FROM MyTable' -ConnectionString $connString -KeyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/invoke-sqlcmd</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Service Principal</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Managed Identity</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>High Availability</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Provider Statistics for SQL Server</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Strict Connection Encryption</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Invoke-SqlColumnMasterKeyRotation</command:name> <command:verb>Invoke</command:verb> <command:noun>SqlColumnMasterKeyRotation</command:noun> <maml:description> <maml:para>Initiates the rotation of a column master key.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Invoke-SqlColumnMasterKeyRotation cmdlet initiates replacing an existing source column master key with a new target column master key for the Always Encrypted feature.</maml:para> <maml:para>The cmdlet retrieves all column encryption key objects that contain encrypted key values that are encrypted with the specified source column master key.</maml:para> <maml:para>Then, the cmdlet decrypts the current encrypted values, re-encrypts the resulting plaintext values with the target column master key, and then updates the impacted column encryption key objects to add the new encrypted values.</maml:para> <maml:para>As a result, each impacted column encryption key contains two encrypted values: one produced using the current source column master key and another, produced using the target column master key.</maml:para> <maml:para>If a source or a target column master key is stored in Azure, you need to specify a valid authentication token (or tokens) for a key vault or a managed HSM holding the key. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Invoke-SqlColumnMasterKeyRotation</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the target column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-SqlColumnMasterKeyRotation</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation.</maml:para> <maml:para>If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the target column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the current and/or the target column master key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation.</maml:para> <maml:para>If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SourceColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the source column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TargetColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the target column master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Initiate the process of rotating the column master key.</maml:title> <dev:code>Invoke-SqlColumnMasterKeyRotation -SourceColumnMasterKeyName "CMK1" -TargetColumnMasterKeyName "CMK2"</dev:code> <dev:remarks> <maml:para>This command initiates the process of rotating the column master key named CMK1, and replacing it with the column master key named CMK2.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Initiate the process of rotating the column master key with authentication tokens specified</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain access tokens. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token $managedHSMAccessToken = (Get-AzAccessToken -ResourceUrl https://managedhsm.azure.net).Token # Pass the tokens to the cmdlet. Invoke-SqlColumnMasterKey -SourceColumnMasterKeyName CMK1 -TargetColumnMasterKeyName CMK2 -KeyVaultAccessToken $keyVaultAccessToken -ManagedHSMAccessToken $managedHSMAccessToken</dev:code> <dev:remarks> <maml:para>The example initiates the process of rotating the column master key named CMK1 and replacing it with the column master key named CMK2. We assume one of the keys is stored in a key vault and the other key is stored in a managed HSM in Azure Key Vault. The `Invoke-SqlColumnMasterKey` will use the obtained authentication tokens to communicate with key vault and managed HSM endpoints.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/invoke-sqlcolumnmasterkeyrotation</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Complete-SqlColumnMasterKeyRotation</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Invoke-SqlVulnerabilityAssessmentScan</command:name> <command:verb>Invoke</command:verb> <command:noun>SqlVulnerabilityAssessmentScan</command:noun> <maml:description> <maml:para>Invokes a new Vulnerability Assessment scan.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Invoke-SqlVulnerabilityAssessmentScan cmdlet runs a scan on your database. The cmdlet employs a knowledge base of security checks that flag security vulnerabilities and highlight deviations from best practices, such as misconfigurations, excessive permissions, and unprotected sensitive data. The security checks are based on Microsoft's recommended best practices, and focus on the security issues that present the biggest risks to your database and its valuable data. These security checks also represent many of the requirements from various regulatory bodies to meet their compliance standards.</maml:para> <maml:para>Results of the scan include actionable steps to resolve each issue and provide customized remediation scripts where applicable. An assessment report can be customized for your environment by setting an acceptable baseline for permission configurations, feature configurations and database settings.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Invoke-SqlVulnerabilityAssessmentScan</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Baseline</maml:name> <maml:description> <maml:para>A Vulnerability Assessment security check baseline set</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OmitMetadata</maml:name> <maml:description> <maml:para>Whether to omit the security checks metadata (e.g. title, description, etc.) Please notice that Export-VulnerabilityAssessmentScan requires the security checks metadata to execute correctly.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ScanId</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan id</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-SqlVulnerabilityAssessmentScan</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Baseline</maml:name> <maml:description> <maml:para>A Vulnerability Assessment security check baseline set</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the Database parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OmitMetadata</maml:name> <maml:description> <maml:para>Whether to omit the security checks metadata (e.g. title, description, etc.) Please notice that Export-VulnerabilityAssessmentScan requires the security checks metadata to execute correctly.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ScanId</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan id</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies a character string or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-SqlVulnerabilityAssessmentScan</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Baseline</maml:name> <maml:description> <maml:para>A Vulnerability Assessment security check baseline set</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the input object for the scan operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OmitMetadata</maml:name> <maml:description> <maml:para>Whether to omit the security checks metadata (e.g. title, description, etc.) Please notice that Export-VulnerabilityAssessmentScan requires the security checks metadata to execute correctly.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ScanId</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan id</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Invoke-SqlVulnerabilityAssessmentScan</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Baseline</maml:name> <maml:description> <maml:para>A Vulnerability Assessment security check baseline set</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OmitMetadata</maml:name> <maml:description> <maml:para>Whether to omit the security checks metadata (e.g. title, description, etc.) Please notice that Export-VulnerabilityAssessmentScan requires the security checks metadata to execute correctly.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server to execute the scan.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ScanId</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan id</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Baseline</maml:name> <maml:description> <maml:para>A Vulnerability Assessment security check baseline set</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaselineSet</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaselineSet</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the Database parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the input object for the scan operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>OmitMetadata</maml:name> <maml:description> <maml:para>Whether to omit the security checks metadata (e.g. title, description, etc.) Please notice that Export-VulnerabilityAssessmentScan requires the security checks metadata to execute correctly.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server to execute the scan.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ScanId</maml:name> <maml:description> <maml:para>The Vulnerability Assessment scan id</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies a character string or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Invoke a Vulnerability Assessment scan using Windows authentication on master database</maml:title> <dev:code>PS C:\> Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database "master" -ScanId "MyScan" Id : MyScan ScanType : BoxDatabase ScanTriggerType : OnDemand Server : MyComputer\MainInstance Database : master Platform : SqlServer2017 SqlVersion : 14.0.3015 StartTimeUtc : 3/17/2018 8:58:02 PM EndTimeUtc : 3/17/2018 8:58:41 PM ToolName : PowerShell ToolVersion : 1.0 Results : {VA1017, VA1019, VA1020, VA1021...} SecurityChecks : {[VA1017, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1019, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1020, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1021, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck]...}</dev:code> <dev:remarks> <maml:para>In this example we invoke a Vulnerability Assessment scan on master database using Windows authentication.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Invoke a Vulnerability Assessment scan using current path context</maml:title> <dev:code>PS C:\> Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" PS SQLSERVER:\SQL\MyComputer\MainInstance> Invoke-SqlVulnerabilityAssessmentScan WARNING: Using provider context. Server = MyComputer\MainInstance, Database = MyDatabase. Id : 2018-03-17T22-58-02 ScanType : BoxDatabase ScanTriggerType : OnDemand Server : MyComputer\MainInstance Database : MyDatabase Platform : SqlServer2017 SqlVersion : 14.0.3015 StartTimeUtc : 3/17/2018 8:58:02 PM EndTimeUtc : 3/17/2018 8:58:41 PM ToolName : PowerShell ToolVersion : 1.0 Results : {VA1017, VA1019, VA1020, VA1021...} SecurityChecks : {[VA1017, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1019, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1020, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck], [VA1021, Microsoft.SQL.VulnerabilityAssessment.SecurityCheck]...}</dev:code> <dev:remarks> <maml:para>This example demonstrates how Invoke-SqlVulnerabilityAssessmentScan uses the current path to set the database context to MyDatabase.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Invoke a Vulnerability Assessment scan using credential and omit security checks metadata</maml:title> <dev:code>PS C:\> $cred = Get-Credential PS C:\> Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database "master" -Credential $cred Id : 2018-03-17T22-58-02 ScanType : BoxDatabase ScanTriggerType : OnDemand Server : MyComputer\MainInstance Database : MyDatabase Platform : SqlServer2017 SqlVersion : 14.0.3015 StartTimeUtc : 3/17/2018 8:58:02 PM EndTimeUtc : 3/17/2018 8:58:41 PM ToolName : PowerShell ToolVersion : 1.0 Results : {VA1017, VA1019, VA1020, VA1021...} SecurityChecks :</dev:code> <dev:remarks> <maml:para>This example demonstrates how to invoke a scan using a PSCredential. It also demonstrates the use of -OmitMetadata flag (notice that the result doesn't contain the security checks dictionary - this is the metadata of the checks, such as title, description, etc.).</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Invoke a Vulnerability Assessment scan with a baseline</maml:title> <dev:code>PS C:\> [string[][]]$expectedResults = ,("guest", "db_datareader", "SQLUSER", "NONE") PS C:\> $baseline = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId "VA2109" -ExpectedResult $expectedResults PS C:\> $baselineSet = New-SqlVulnerabilityAssessmentBaselineSet -Baselines $baseline PS C:\> $scanResult = Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database "master" -Baseline $baselineSet PS C:\> $result2109 = $scanResult.Results.GetEnumerator() | where {$_.Value.SecurityCheckId -eq "VA2109" }</dev:code> <dev:remarks> <maml:para>This example demonstrates how to create a baseline set and invoke a scan with it. The BaselineAdjustedSecurityCheckResult property in the result of 'VA2109' contains the baseline adjusted result. Notice that the original status of this result is Failed, but the baseline adjusted result status is Passed.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/invoke-sqlvulnerabilityassessmentscan</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Join-SqlAvailabilityGroup</command:name> <command:verb>Join</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Joins the local secondary replica to an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Join-SqlAvailabilityGroup cmdlet joins the local secondary replica to an availability group.</maml:para> <maml:para>Run this cmdlet on an instance of SQL Server that hosts a secondary replica that is not joined to the availability group.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Join-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group to which this cmdlet joins a secondary replica.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server that hosts the instance of SQL Server that hosts the secondary replica that this cmdlet joins to the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Wsfc</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Join-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group to which this cmdlet joins a secondary replica.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server that hosts the secondary replica that this cmdlet joins to the availability group. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Wsfc</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server that hosts the instance of SQL Server that hosts the secondary replica that this cmdlet joins to the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group to which this cmdlet joins a secondary replica.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server that hosts the secondary replica that this cmdlet joins to the availability group. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para>You can pass a server instance to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para>The high availability data recovery service must be enabled on the server instance. The availability replica specified by the Path parameter must exist.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>- Example 1: Join a secondary replica to an availability group -</maml:title> <dev:code>PS C:\> Join-SqlAvailabilityGroup -Path "SQLSERVER:\SQL\SecondaryServer\InstanceName" -Name "MainAG"</dev:code> <dev:remarks> <maml:para>This command joins a secondary replica to the availability group named 'MainAG'. This server instance must host a secondary replica in this availability group.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a script that joins a secondary replica to an availability group</maml:title> <dev:code>PS C:\> Join-SqlAvailabilityGroup -Path "SQLSERVER:\SQL\SecondaryServer\InstanceName" -Name "MainAG" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that joins a secondary replica to the availability group named 'MainAG'.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/join-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Switch-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlAvailabilityGroup</command:name> <command:verb>New</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Creates an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlAvailabilityGroup cmdlet creates an availability group in Always On Availability Groups.</maml:para> <maml:para>The InputObject or Path parameter specifies the server that hosts the initial primary replica.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the instance of SQL Server that hosts the primary replica of the availability group that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Primary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SecondaryOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Secondary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityReplica</maml:name> <maml:description> <maml:para>Specifies an array of availability replicas that this cmdlet includes in the availability group. To obtain an AvailabilityReplica , use the New-SqlAvailabilityReplica cmdlet. Specify the AsTemplate parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BasicAvailabilityGroup</maml:name> <maml:description> <maml:para>Specifies whether to create an `advanced` (default) or a `basic` availability group.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> <maml:para>Note: An exception will be thrown if the -ClusterType parameter is used when the target server is SQL Server 2016 and below.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Wsfc</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContainedAvailabilityGroup</maml:name> <maml:description> <maml:para>Used to create a contained availability group. This option is used to create an availability group with its own `master` and `msdb` databases, which are kept in sync across the set of replicas in the availability group. This parameter may be used with its companion -ReuseSystemDatabases .</maml:para> <maml:para>> This parameter is allowed only when the target SQL Server supports Contained Availability Groups (SQL 2022 and above). Trying to use is against versions of SQL that do not support Contained Availability Groups would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of local, read/write user databases. These databases must use the full recovery model and must not use AUTO_CLOSE. These databases cannot belong to another availability group and cannot be configured for database mirroring. You must specify a value for this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DtcSupportEnabled</maml:name> <maml:description> <maml:para>Specifies whether databases within an availability group register with MSDTC at the instance-level (default) or at the per-database level.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical Server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, which includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">OnServerDown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnServerUnresponsive</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnCriticalServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnModerateServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnAnyQualifiedFailureCondition</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On availability groups declare an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReuseSystemDatabases</maml:name> <maml:description> <maml:para>This parameter causes the contained `master` and `msdb` databases from a prior version of the AG to be used in the creation of this new availability group. </maml:para> <maml:para>> Trying to use this parameter without specifying -ContainedAvailabilityGroup is not allowed would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server that hosts the initial primary replica of the availability group that this cmdlet creates. If you do not specify this parameter, this cmdlet uses current working location. If you specify a value, the path must currently exist.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Primary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SecondaryOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Secondary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityReplica</maml:name> <maml:description> <maml:para>Specifies an array of availability replicas that this cmdlet includes in the availability group. To obtain an AvailabilityReplica , use the New-SqlAvailabilityReplica cmdlet. Specify the AsTemplate parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BasicAvailabilityGroup</maml:name> <maml:description> <maml:para>Specifies whether to create an `advanced` (default) or a `basic` availability group.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> <maml:para>Note: An exception will be thrown if the -ClusterType parameter is used when the target server is SQL Server 2016 and below.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Wsfc</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContainedAvailabilityGroup</maml:name> <maml:description> <maml:para>Used to create a contained availability group. This option is used to create an availability group with its own `master` and `msdb` databases, which are kept in sync across the set of replicas in the availability group. This parameter may be used with its companion -ReuseSystemDatabases .</maml:para> <maml:para>> This parameter is allowed only when the target SQL Server supports Contained Availability Groups (SQL 2022 and above). Trying to use is against versions of SQL that do not support Contained Availability Groups would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of local, read/write user databases. These databases must use the full recovery model and must not use AUTO_CLOSE. These databases cannot belong to another availability group and cannot be configured for database mirroring. You must specify a value for this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DtcSupportEnabled</maml:name> <maml:description> <maml:para>Specifies whether databases within an availability group register with MSDTC at the instance-level (default) or at the per-database level.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical Server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, which includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">OnServerDown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnServerUnresponsive</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnCriticalServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnModerateServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnAnyQualifiedFailureCondition</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On availability groups declare an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReuseSystemDatabases</maml:name> <maml:description> <maml:para>This parameter causes the contained `master` and `msdb` databases from a prior version of the AG to be used in the creation of this new availability group. </maml:para> <maml:para>> Trying to use this parameter without specifying -ContainedAvailabilityGroup is not allowed would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityReplica</maml:name> <maml:description> <maml:para>Specifies an array of availability replicas that this cmdlet includes in the availability group. To obtain an AvailabilityReplica , use the New-SqlAvailabilityReplica cmdlet. Specify the AsTemplate parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BasicAvailabilityGroup</maml:name> <maml:description> <maml:para>Specifies whether to create an `advanced` (default) or a `basic` availability group.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClusterType</maml:name> <maml:description> <maml:para>The type of cluster backing the AG. Possible values are:</maml:para> <maml:para>- Wsfc. The AG will be integrated in Windows Server Failover Cluster. This is how AGs in SQL Server 2016 and below are created. This is the default. - None. The AG will be cluster-independent.</maml:para> <maml:para>- External. The AG will be managed by a cluster manager that is not a Windows Server Failover Cluster, like Pacemaker on Linux.</maml:para> <maml:para> This is supported in SQL Server 2017 and above. When targeting SQL Server on Linux, you must specify this value or an error will occour.</maml:para> <maml:para>Note: An exception will be thrown if the -ClusterType parameter is used when the target server is SQL Server 2016 and below.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupClusterType</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupClusterType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Wsfc</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContainedAvailabilityGroup</maml:name> <maml:description> <maml:para>Used to create a contained availability group. This option is used to create an availability group with its own `master` and `msdb` databases, which are kept in sync across the set of replicas in the availability group. This parameter may be used with its companion -ReuseSystemDatabases .</maml:para> <maml:para>> This parameter is allowed only when the target SQL Server supports Contained Availability Groups (SQL 2022 and above). Trying to use is against versions of SQL that do not support Contained Availability Groups would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies an array of local, read/write user databases. These databases must use the full recovery model and must not use AUTO_CLOSE. These databases cannot belong to another availability group and cannot be configured for database mirroring. You must specify a value for this parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DtcSupportEnabled</maml:name> <maml:description> <maml:para>Specifies whether databases within an availability group register with MSDTC at the instance-level (default) or at the per-database level.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical Server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, which includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On availability groups declare an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the instance of SQL Server that hosts the primary replica of the availability group that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the availability group that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server that hosts the initial primary replica of the availability group that this cmdlet creates. If you do not specify this parameter, this cmdlet uses current working location. If you specify a value, the path must currently exist.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReuseSystemDatabases</maml:name> <maml:description> <maml:para>This parameter causes the contained `master` and `msdb` databases from a prior version of the AG to be used in the creation of this new availability group. </maml:para> <maml:para>> Trying to use this parameter without specifying -ContainedAvailabilityGroup is not allowed would cause the cmdlet to throw an error.</maml:para> <maml:para>> This parameter is only available in version 22+ of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para>You can pass a server instance to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet returns an availability group.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>----------- Example 1: Create an Availability Group -----------</maml:title> <dev:code>PS C:\> $PrimaryServer = Get-Item "SQLSERVER:\SQL\PrimaryServer\Instance22" PS C:\> $SecondaryServer = Get-Item "SQLSERVER:\SQL\SecondaryServer\Instance22" PS C:\> $PrimaryReplica = New-SqlAvailabilityReplica -Name "PrimaryServer\Instance22" -EndpointUrl "TCP://PrimaryServer.domain:5022" -FailoverMode "Automatic" -AvailabilityMode "SynchronousCommit" -AsTemplate -Version ($PrimaryServer.Version) PS C:\> $SecondaryReplica = New-SqlAvailabilityReplica -Name "SecondaryServer\Instance22" -EndpointUrl "TCP://SecondaryServer.domain:5022" -FailoverMode "Automatic" -AvailabilityMode "SynchronousCommit" -AsTemplate -Version ($SecondaryServer.Version) PS C:\> New-SqlAvailabilityGroup -InputObject $PrimaryServer -Name "MainAG" -AvailabilityReplica ($PrimaryReplica, $SecondaryReplica) -Database @("Database01","Database02")</dev:code> <dev:remarks> <maml:para>The first command gets an instance of SQL Server on the primary server, and then stores it in the $PrimaryServer variable.</maml:para> <maml:para>The fourth command creates a replica that includes the secondary server instance by using New-SqlAvailabilityReplica, and then stores it in the $SecondaryReplica variable.</maml:para> <maml:para>The command specifies the version of the server instance by using the Version property of $SecondaryServer.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---- Example 2: Create an Availability Group backed by WSFC ----</maml:title> <dev:code># Get server PS C:\> cd 'SQLSERVER:\SQL\some-hostname\Default' PS SQLSERVER:\SQL\some-hostname\Default> $server = Get-Item $PWD # Create primary replica PS SQLSERVER:\SQL\some-hostname\Default> $primaryReplica = New-SqlAvailabilityReplica -Name 'some-hostname' -EndpointUrl 'tcp://some-hostname:5022' -FailoverMode Automatic -AvailabilityMode SynchronousCommit -AsTemplate # Create AG with explicit cluster type WSFC (same as not passing -ClusterType, since it is the default value) PS SQLSERVER:\SQL\some-hostname\Default> $server | New-SqlAvailabilityGroup -Name 'ag1' -AvailabilityReplica $PrimaryReplica -Script -ClusterType Wsfc</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>- Example 3: Create an availability groups cluster independent -</maml:title> <dev:code># Get server PS C:\> CD 'SQLSERVER:\SQL\some-hostname\Default' PS SQLSERVER:\SQL\some-hostname\Default> $server = Get-Item $PWD # Create primary replica PS SQLSERVER:\SQL\some-hostname\Default> $primaryReplica = New-SqlAvailabilityReplica -Name 'some-hostname' -EndpointUrl 'tcp://some-hostname:5022' -FailoverMode Automatic -AvailabilityMode SynchronousCommit -AsTemplate # Create AG cluster group independent PS SQLSERVER:\SQL\some-hostname\Default> $server | New-SqlAvailabilityGroup -Name 'ag1' -AvailabilityReplica $PrimaryReplica -Script -ClusterType None</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Create an availability groups setting the number of SYNCHRONOUS_COMMIT secondaries that must be available for transactions to commit on the primary</maml:title> <dev:code># Get server PS C:\> Get-Item 'SQLSERVER:\SQL\some-hostname\Default' # Create primary replica PS C:\> $primaryReplica = New-SqlAvailabilityReplica -Name 'some-hostname' -EndpointUrl 'tcp://some-hostname:5022' -FailoverMode Automatic -AvailabilityMode SynchronousCommit -AsTemplate # Create AG with RequiredSynchronizedSecondariesToCommit = 3 PS C:\> $server | New-SqlAvailabilityGroup -Name 'ag1' -AvailabilityReplica $PrimaryReplica -RequiredSynchronizedSecondariesToCommit 3</dev:code> <dev:remarks> <maml:para>Note: An exception will be thrown if the -RequiredSynchronizedSecondariesToCommit parameter is used when the target server version is SQL Server 2016 or lower.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Join-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Switch-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlAvailabilityGroupListener</command:name> <command:verb>New</command:verb> <command:noun>SqlAvailabilityGroupListener</command:noun> <maml:description> <maml:para>Creates an availability group listener and attaches it to an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlAvailabilityGroupListener cmdlet creates an availability group listener, and attaches it to an availability group. Run this cmdlet on the server instance that hosts the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlAvailabilityGroupListener</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the listener.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which this cmdlet attaches the listener.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DhcpSubnet</maml:name> <maml:description> <maml:para>Specifies an IPv4 address and subnet mask of a network. The listener determines the address on this network by using DHCP. Specify the address in for following format: 192.168.0.1/255.255.255.0.</maml:para> <maml:para>If you specify this parameter, do not specify the StaticIp parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> <maml:para>If you specify this parameter, do not specify the DhcpSubnet parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlAvailabilityGroupListener</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the listener.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which this cmdlet attaches a listener. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DhcpSubnet</maml:name> <maml:description> <maml:para>Specifies an IPv4 address and subnet mask of a network. The listener determines the address on this network by using DHCP. Specify the address in for following format: 192.168.0.1/255.255.255.0.</maml:para> <maml:para>If you specify this parameter, do not specify the StaticIp parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> <maml:para>If you specify this parameter, do not specify the DhcpSubnet parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DhcpSubnet</maml:name> <maml:description> <maml:para>Specifies an IPv4 address and subnet mask of a network. The listener determines the address on this network by using DHCP. Specify the address in for following format: 192.168.0.1/255.255.255.0.</maml:para> <maml:para>If you specify this parameter, do not specify the StaticIp parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which this cmdlet attaches the listener.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the listener.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which this cmdlet attaches a listener. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StaticIp</maml:name> <maml:description> <maml:para>Specifies an array of addresses. Each address entry is either an IPv4 address and subnet mask or an IPv6 address. The listener listens on the addresses that this parameter specifies.</maml:para> <maml:para>If you specify this parameter, do not specify the DhcpSubnet parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: Create a listener for an availability group ----</maml:title> <dev:code>PS C:\> New-SqlAvailabilityGroupListener -Name "MainListener" -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command creates an availability group listener named 'MainListener' for the availability group named 'MainAG'. This listener acquires a virtual IP address by using DHCP. Run this command on the server instance that hosts the primary replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a listener for an availability group that has a nondefault port</maml:title> <dev:code>PS C:\> New-SqlAvailabilityGroupListener -Name "MainListener" -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -Port 1434</dev:code> <dev:remarks> <maml:para>This command creates an availability group listener named 'MainListener' for the availability group named 'MainAG'. As in the previous example, this listener acquires a virtual IP address by using DHCP. This example assigns the port 1434 on which it listens.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a listener for an availability group that uses DHCP</maml:title> <dev:code>PS C:\> New-SqlAvailabilityGroupListener -Name "MainListener" -DhcpSubnet "192.169.0.1/255.255.252.0" -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command creates an availability group listener named 'MainListener' for the availability group named 'MainAG'. This listener acquires a virtual IP address in the specified subnet by using DHCP.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Create a listener for an availability group that uses a static address</maml:title> <dev:code>PS C:\> New-SqlAvailabilityGroupListener -Name "MainListener" -StaticIp "192.168.3.1/255.255.252.0" -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command creates an availability group listener named 'MainListener' for the availability group named 'MainAG'. This listener uses the IPv4 address specified by the StaticIp parameter as its virtual IP address.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------ Example 5: Create a script that creates a listener ------</maml:title> <dev:code>PS C:\> New-SqlAvailabilityGroupListener -Name "MainListener" -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAG" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that creates an availability group listener named 'MainListener' for the availability group named 'MainAG'. The command does not create a listener.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlavailabilitygrouplistener</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityGroupListenerStaticIp</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroupListener</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlAvailabilityReplica</command:name> <command:verb>New</command:verb> <command:noun>SqlAvailabilityReplica</command:noun> <maml:description> <maml:para>Creates an availability replica.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlAvailabilityReplica cmdlet creates an availability replica. Run this cmdlet on the instance of SQL Server that hosts the primary replica.</maml:para> <maml:para>To create an availability replica before you create an availability group, specify the AsTemplate parameter. To add a replica to an existing availability group, either the InputObject or Path parameter specifies the availability group.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the availability replica in the following format: Computer\Instance</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsTemplate</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates a temporary AvailabilityReplica object in memory. Specify this parameter to create an availability group before you create an availability replica. Create an availability group by using the New-SqlAvailabilityGroup cmdlet. Specify the temporary availability replica as the value of the AvailabilityReplica parameter.</maml:para> <maml:para>If you specify AsTemplate , this cmdlet ignores values for the InputObject and Path parameters.</maml:para> <maml:para>If you specify this parameter, you must also specify a SQL Server version for the Version parameter, or your current session must have an active connection to an instance.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null.`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AsynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ConfigurationOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadWriteConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowNoConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadIntentConnectionsOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form:</maml:para> <maml:para>TCP://system-address:port</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections, as in the following example: TCP://DBSERVER8.manufacturing.Contoso.com:7024</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Manual</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies a SQL Server version. If you specify the AsTemplate parameter, you must specify a version. The template object is created in design mode on a server that includes this version. You can specify an integer or a string, as in the following examples (SQL Server 2017):</maml:para> <maml:para>- 14</maml:para> <maml:para>- '14.0.0'</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ServerVersion</command:parameterValue> <dev:type> <maml:name>ServerVersion</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the availability replica in the following format: Computer\Instance</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which the replica belongs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null.`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AsynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ConfigurationOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadWriteConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowNoConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadIntentConnectionsOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form:</maml:para> <maml:para>TCP://system-address:port</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections, as in the following example: TCP://DBSERVER8.manufacturing.Contoso.com:7024</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Manual</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the availability replica in the following format: Computer\Instance</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null.`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AsynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ConfigurationOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadWriteConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowNoConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadIntentConnectionsOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form:</maml:para> <maml:para>TCP://system-address:port</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections, as in the following example: TCP://DBSERVER8.manufacturing.Contoso.com:7024</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Manual</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AsTemplate</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates a temporary AvailabilityReplica object in memory. Specify this parameter to create an availability group before you create an availability replica. Create an availability group by using the New-SqlAvailabilityGroup cmdlet. Specify the temporary availability replica as the value of the AvailabilityReplica parameter.</maml:para> <maml:para>If you specify AsTemplate , this cmdlet ignores values for the InputObject and Path parameters.</maml:para> <maml:para>If you specify this parameter, you must also specify a SQL Server version for the Version parameter, or your current session must have an active connection to an instance.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null.`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role.</maml:para> <maml:para>The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections</maml:para> <maml:para>- AllowAllConnections. Allows all connections</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form:</maml:para> <maml:para>TCP://system-address:port</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which the replica belongs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies a name for the availability replica in the following format: Computer\Instance</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections, as in the following example: TCP://DBSERVER8.manufacturing.Contoso.com:7024</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>Manual</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Version</maml:name> <maml:description> <maml:para>Specifies a SQL Server version. If you specify the AsTemplate parameter, you must specify a version. The template object is created in design mode on a server that includes this version. You can specify an integer or a string, as in the following examples (SQL Server 2017):</maml:para> <maml:para>- 14</maml:para> <maml:para>- '14.0.0'</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ServerVersion</command:parameterValue> <dev:type> <maml:name>ServerVersion</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup</maml:name> </dev:type> <maml:description> <maml:para>You can pass an availability group to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityReplica</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet returns an availability replica.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Creates a representation of an availability replica</maml:title> <dev:code>PS C:\> $ServerObject = Get-Item "SQLSERVER:\Sql\PrimaryServer\InstanceName" PS C:\> New-SqlAvailabilityReplica -Name "PrimaryServer\Instance" -EndpointUrl "TCP://PrimaryServerName.domain.com:5022" -FailoverMode Automatic -AvailabilityMode SynchronousCommit -AsTemplate -Version $ServerObject.Version</dev:code> <dev:remarks> <maml:para>This example creates an in-memory representation of an availability replica. No changes are committed to the server. You can use this replica as a value for the AvailabilityReplica parameter of New-SqlAvailabilityGroup The first command gets an instance of the primary server.</maml:para> <maml:para>The second command creates the availability replica. This replica uses the database mirroring endpoint located at the specified URL to communicate with other replicas in the availability group. This replica supports automatic failover and the synchronous-commit availability mode. The Version parameter specifies the version of the server instance that will host this new replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Creates an availability replica that supports manual failover and the asynchronouscommit</maml:title> <dev:code>PS C:\> $ServerObject = Get-Item "SQLSERVER:\Sql\PrimaryServer\InstanceName" PS C:\> New-SqlAvailabilityReplica -Name "SecondaryServer\Instance" -EndpointUrl "TCP://PrimaryServerName.domain.com:5022" -FailoverMode Manual -AvailabilityMode AsynchronousCommit -AsTemplate -Version $ServerObject.Version</dev:code> <dev:remarks> <maml:para>This example creates an in-memory representation of an availability replica. No changes are committed to the server.</maml:para> <maml:para>The first command gets an instance of the primary server.</maml:para> <maml:para>The second command creates the availability replica. This replica uses the database mirroring endpoint located at the specified URL to communicate with other replicas in the availability group. This replica supports manual failover and the asynchronous-commit availability mode. The Version parameter specifies the version of the server instance that will host this new replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Add an availability replica to an availability group</maml:title> <dev:code>PS C:\> New-SqlAvailabilityReplica -Name "SecondaryServer\Instance" -EndpointUrl "TCP://PrimaryServerName.domain.com:5022" -FailoverMode Manual -AvailabilityMode AsynchronousCommit -ConnectionModeInSecondaryRole AllowAllConnections -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command adds an availability replica to an existing availability group named 'MainAG'. This replica supports manual failover and asynchronous-commit availability mode. In the secondary role, this replica supports read access connections. This configuration lets you offload read-only processing to this replica.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlavailabilityreplica</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlAzureKeyVaultColumnMasterKeySettings</command:name> <command:verb>New</command:verb> <command:noun>SqlAzureKeyVaultColumnMasterKeySettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object describing an asymmetric key stored in Azure Key Vault.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object describing a column master key stored in a key vault or in a managed HSM in Azure Key Vault.</maml:para> <maml:para>If you're using the cmdlet to sign key metadata, you need to specify a valid authentication token for key vaults or managed HSMs. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlAzureKeyVaultColumnMasterKeySettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>KeyUrl</maml:name> <maml:description> <maml:para>Specifies the link, as a URL, of the key in Azure Key Vault or a managed HSM.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with.</maml:para> <maml:para>This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the specified column master key is stored in a key vault in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the specified column master key is stored in a managed HSM in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>KeyUrl</maml:name> <maml:description> <maml:para>Specifies the link, as a URL, of the key in Azure Key Vault or a managed HSM.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the specified column master key is stored in a key vault in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the specified column master key is stored in a managed HSM in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with.</maml:para> <maml:para>This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>- Example 1: Create a simple SqlColumnMasterKeySettings object -</maml:title> <dev:code>$CMKSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.contoso.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700'</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object that references a key in Azure Key Vault and stores the result in the variable named $CMKSettings</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a SqlColumnMasterKeySettings with auto-signed properties allowing enclave computations</maml:title> <dev:code># Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Pass the token to the cmdlet. It will use the token to communicate with the key vault containing the column master key to sign the column master key metadata properties. $cmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -keyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object that references a key in a key vault and stores the result in the variable named $cmkSettings. The key allows enclave computations. Since the signature parameter is not specified, the cmdlet automatically computes the signature and populates the Signature property of the SqlColumnMasterKeySettings object.</maml:para> <maml:para>This example illustrates obtaining an authentication token for key vaults in Azure Key Vault, and passing it to the cmdlet.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a SqlColumnMasterKeySettings object allowing enclave computations</maml:title> <dev:code># Note: actual signature truncated for brevity $signature = "0x19BEB4F27F582F...89D5433CE9266C6F867334654BE12" $cmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.contoso.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -Signature $signature</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object that references a key in a key vault and stores the result in the variable named $cmkSettings. The key allows enclave computations. The signature of the key properties is specified in the Signature parameter.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlazurekeyvaultcolumnmasterkeysettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlBackupEncryptionOption</command:name> <command:verb>New</command:verb> <command:noun>SqlBackupEncryptionOption</command:noun> <maml:description> <maml:para>Creates the encryption options for the Backup-SqlDatabase cmdlet or the Set-SqlSmartAdmin cmdlet.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlBackupEncryptionOption cmdlet creates the encryption options for the Backup-SqlDatabase cmdlet or the Set-SqlSmartAdmin cmdlet.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlBackupEncryptionOption</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Algorithm</maml:name> <maml:description> <maml:para>Specifies the encryption algorithm.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Aes128</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes192</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes256</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">TripleDes</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>BackupEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptorName</maml:name> <maml:description> <maml:para>Specifies the name of the server certificate or server asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptorType</maml:name> <maml:description> <maml:para>Specifies the encryptor type.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ServerCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ServerAsymmetricKey</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">BackupEncryptorType</command:parameterValue> <dev:type> <maml:name>BackupEncryptorType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoEncryption</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables encryption. This parameter cannot be used with any other parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Algorithm</maml:name> <maml:description> <maml:para>Specifies the encryption algorithm.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>BackupEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptorName</maml:name> <maml:description> <maml:para>Specifies the name of the server certificate or server asymmetric key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptorType</maml:name> <maml:description> <maml:para>Specifies the encryptor type.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptorType</command:parameterValue> <dev:type> <maml:name>BackupEncryptorType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoEncryption</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables encryption. This parameter cannot be used with any other parameters.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.BackupEncryptionOptions</maml:name> </dev:type> <maml:description> <maml:para>This cmdlet is used as input to the EncryptionOption parameter for the Backup-SqlDatabase and Set-SqlSmartAdmin cmdlets.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------- Example 1: Create encryption options -------------</maml:title> <dev:code>PS C:\> $EncryptionOption = New-SqlBackupEncryptionOption -Algorithm Aes256 -EncryptorType ServerCertificate -EncryptorName "BackupCert"</dev:code> <dev:remarks> <maml:para>This command creates the encryption options and stores the result in the variable named $EncrytionOption</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlbackupencryptionoption</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Backup-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlCertificateStoreColumnMasterKeySettings</command:name> <command:verb>New</command:verb> <command:noun>SqlCertificateStoreColumnMasterKeySettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object referencing the specified certificate.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlCertificateStoreColumnMasterKeySettings cmdlet creates a SqlColumnMasterKeySettings object that references the specified certificate, stored in the Windows Certificate Store, which is intended to be used as a column master key for the Always Encrypted feature.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlCertificateStoreColumnMasterKeySettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CertificateStoreLocation</maml:name> <maml:description> <maml:para>Specifies the certificate store location, containing the certificate. The acceptable values for this parameter are:</maml:para> <maml:para>- CurrentUser</maml:para> <maml:para>- LocalMachine</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Thumbprint</maml:name> <maml:description> <maml:para>Specifies the thumbprint of the certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with. This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CertificateStoreLocation</maml:name> <maml:description> <maml:para>Specifies the certificate store location, containing the certificate. The acceptable values for this parameter are:</maml:para> <maml:para>- CurrentUser</maml:para> <maml:para>- LocalMachine</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with. This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Thumbprint</maml:name> <maml:description> <maml:para>Specifies the thumbprint of the certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Create a SqlColumnMasterKeySettings object referencing a certificate</maml:title> <dev:code>PS C:\> $CMKSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation "CurrentUser" -CertificateThumbprint "f2260f28d909d21c642a3d8e0b45a830e79a1420"</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object referencing a certificate in Windows Certificate Store.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a SqlColumnMasterKeySettings object referencing an enclave-enabled certificate with auto-signed properties</maml:title> <dev:code>PS C:\>$CMKSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation "CurrentUser" -CertificateThumbprint "f2260f28d909d21c642a3d8e0b45a830e79a1420" -AllowEnclaveComputations</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object referencing a certificate in Windows Certificate Store that allows enclave computations. Since Signature is not specified, the cmdlet automatically computes the signature and populates the Signature property of the SqlColumnMasterKeySettings object.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a SqlColumnMasterKeySettings object referencing an enclave-enabled certificate</maml:title> <dev:code>PS C:\>$CMKSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation "CurrentUser" -CertificateThumbprint "f2260f28d909d21c642a3d8e0b45a830e79a1420" -AllowEnclaveComputations -Signature "0x19BEB4F27F582FDBBD0C7E5F92CF161D79D5E7F5A5183F9C8E710252E7028A3654FBEAF834EE45925024F1A32BD3C6D7D92B46E38690830E20E0777607B073E6665EB05E39263C02557D1208ACECB2251A108D0DEFC25232B67FD223C590258C817292FAFCE2388507812D64A0AEC9E546B0B8E4B2F3EA436053CB158F3CF478C5F5EDA511D0F752F60C3B129BF21356A93368FCC7FD6FAA8DB4E919EB551F375181CA3F4D0404A811C99BD2C8D10C0003AC12B138371F2D76611768B4E84D44116C42F00D679B36D41FBD9467B58291B1F4348C7B422793DA0614EF980CA0A7F42B6D627AFA5A753F0869D2C2F9B0FD38289D5433CE9266C6F867334654BE12"</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object referencing a certificate in Windows Certificate Store that allows enclave computations. The signature of the certificate properties is specified in the Signature parameter.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcertificatestorecolumnmasterkeysettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlCngColumnMasterKeySettings</command:name> <command:verb>New</command:verb> <command:noun>SqlCngColumnMasterKeySettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object describing an asymmetric key stored in a key store supporting the CNG API.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlCngColumnMasterKeySettings cmdlet creates a SqlColumnMasterKeySettings object. The SqlColumnMasterKeySettings object references a key, stored in a key store supporting the Cryptography Next Generation (CNG) API. The SqlColumnMasterKeySettings object has two properties: KeyStoreProviderName and KeyPath . This cmdlet sets the KeyStoreProviderName property to contain the name of the column master key store provider for CNG, then generates and sets the value of the KeyPath property to reference the specified key.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlCngColumnMasterKeySettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CngProviderName</maml:name> <maml:description> <maml:para>Specifies the name of the CNG provider for the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyName</maml:name> <maml:description> <maml:para>Specifies the name of the key in the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CngProviderName</maml:name> <maml:description> <maml:para>Specifies the name of the CNG provider for the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyName</maml:name> <maml:description> <maml:para>Specifies the name of the key in the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: Create a SqlColumnMasterKeySettings object ----</maml:title> <dev:code>PS C:\> $CMKSettings = New-SqlCngColumnMasterKeySettings -CngProviderName "Microsoft Software Key Storage Provider" -KeyName "AlwaysEncryptedKey"</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object referencing a key in a key store encapsulated by a CNG provider named Microsoft Software Key Storage Provider. The command then stores the result of the operation in the variable named $CMKSettings .</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcngcolumnmasterkeysettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlColumnEncryptionKey</command:name> <command:verb>New</command:verb> <command:noun>SqlColumnEncryptionKey</command:noun> <maml:description> <maml:para>Creates a column encryption key object in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlColumnEncryptionKey cmdlet creates a column encryption key object in the database. A column encryption key object encapsulates an encrypted value of a symmetric cryptographic key that can be subsequently used to encrypt database columns using the Always Encrypted feature.</maml:para> <maml:para>This cmdlet supports two modes of operation:</maml:para> <maml:para>- If the encrypted value of a column encryption key is specified, the cmdlet simply creates a new column encryption key object encapsulating the specified encrypted value.</maml:para> <maml:para>- If the encrypted value of a column encryption key is not specified, the cmdlet first generates a plaintext key value, encrypts it with the specified column master key, and then creates a new column encryption key object encapsulating the generated encrypted value. In this mode, the cmdlet communicates with a key store holding the column master key. If the key is stored in Azure, you need to specify a valid authentication token for a key vault or a managed HSM holding the key. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlColumnEncryptionKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object to be created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the specified encrypted value of the column encryption key, or the name the column master key that is used to produce the new encrypted value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is an encrypted column encryption key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlColumnEncryptionKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object to be created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the specified encrypted value of the column encryption key, or the name the column master key that is used to produce the new encrypted value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is an encrypted column encryption key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the specified encrypted value of the column encryption key, or the name the column master key that is used to produce the new encrypted value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is an encrypted column encryption key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the column master key you want to use to encrypt the new column encryption key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object to be created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs a Transact-SQL script that performs the operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnEncryptionKey</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Generate and encrypt a column encryption key ---</maml:title> <dev:code>New-SqlColumnEncryptionKey -Name 'CEK1' -ColumnMasterKeyName 'CMK1'</dev:code> <dev:remarks> <maml:para>This command generates a plaintext value of a column encryption key, encrypts the plaintext value with the specified master key, and then creates a column encryption key object, encapsulating the generated encrypted value in the database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Generate and encrypt a column encryption key using a column master key stored in a key vault in Azure Key Vault.</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain the access token. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Pass the token to the cmdlet. It will use the token to communicate with the key vault containing the column master key. New-SqlColumnEncryptionKey -Name 'CEK1' -ColumnMasterKeyName 'CMK1' -KeyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a column encryption key object for an existing encrypted value of a column encryption key.</maml:title> <dev:code>New-SqlColumnEncryptionKey -Name 'CEK1' -ColumnMasterKeyName 'CMK1' -EncryptedValue '0x01700000016C006F00630061006C006D0061006300680069006E0065002F006D0079002F003200660061006600640038003100320031003400340034006500620031006100320065003000360039003300340038006100350064003400300032003300380065006600620063006300610031006300284FC4316518CF3328A6D9304F65DD2CE387B79D95D077B4156E9ED8683FC0E09FA848275C685373228762B02DF2522AFF6D661782607B4A2275F2F922A5324B392C9D498E4ECFC61B79F0553EE8FB2E5A8635C4DBC0224D5A7F1B136C182DCDE32A00451F1A7AC6B4492067FD0FAC7D3D6F4AB7FC0E86614455DBB2AB37013E0A5B8B5089B180CA36D8B06CDB15E95A7D06E25AACB645D42C85B0B7EA2962BD3080B9A7CDB805C6279FE7DD6941E7EA4C2139E0D4101D8D7891076E70D433A214E82D9030CF1F40C503103075DEEB3D64537D15D244F503C2750CF940B71967F51095BFA51A85D2F764C78704CAB6F015EA87753355367C5C9F66E465C0C66BADEDFDF76FB7E5C21A0D89A2FCCA8595471F8918B1387E055FA0B816E74201CD5C50129D29C015895CD073925B6EA87CAF4A4FAF018C06A3856F5DFB724F42807543F777D82B809232B465D983E6F19DFB572BEA7B61C50154605452A891190FB5A0C4E464862CF5EFAD5E7D91F7D65AA1A78F688E69A1EB098AB42E95C674E234173CD7E0925541AD5AE7CED9A3D12FDFE6EB8EA4F8AAD2629D4F5A18BA3DDCC9CF7F352A892D4BEBDC4A1303F9C683DACD51A237E34B045EBE579A381E26B40DCFBF49EFFA6F65D17F37C6DBA54AA99A65D5573D4EB5BA038E024910A4D36B79A1D4E3C70349DADFF08FD8B4DEE77FDB57F01CB276ED5E676F1EC973154F86'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcolumnencryptionkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlColumnEncryptionKeyEncryptedValue</command:name> <command:verb>New</command:verb> <command:noun>SqlColumnEncryptionKeyEncryptedValue</command:noun> <maml:description> <maml:para>Creates the encrypted value of a column encryption key.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlColumnEncryptionKeyEncryptedValue cmdlet creates the encrypted value of a column encryption key. The returned encrypted value is a hexadecimal string.</maml:para> <maml:para>The cmdlet supports two modes of operation:</maml:para> <maml:para>- If no encrypted value is specified, the cmdlet generates a new plaintext symmetric key and encrypts the key with the specified column master key.</maml:para> <maml:para>- If an encrypted value is specified, the cmdlet first decrypts the specified encrypted value and then re-encrypts the obtained plaintext key with the specified column master key. The cmdlet communicates with a key store holding the column master key. If the key is stored in Azure, you need to specify a valid authentication token for a key vault or a managed HSM holding the key. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlColumnEncryptionKeyEncryptedValue</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>TargetColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that this cmdlet uses to determine where the column master key, to be used to encrypt the new encrypted value, is stored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that this cmdlet uses to find where the column master key is stored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies the existing encrypted value.</maml:para> <maml:para>If you specify a value for this parameter, the cmdlet will first decrypt this value using the column master key referenced by the ColumnMasterKeySettings parameter and then re-encrypt it using the column master key referenced by the TargetColumnMasterKeySettings parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the column master key for encrypting or decrypting a symmetric column encryption key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the column master key for encrypting or decrypting a symmetric column encryption key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>ColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that this cmdlet uses to find where the column master key is stored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>EncryptedValue</maml:name> <maml:description> <maml:para>Specifies the existing encrypted value.</maml:para> <maml:para>If you specify a value for this parameter, the cmdlet will first decrypt this value using the column master key referenced by the ColumnMasterKeySettings parameter and then re-encrypt it using the column master key referenced by the TargetColumnMasterKeySettings parameter.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the column master key for encrypting or decrypting a symmetric column encryption key is stored in a key vault in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the column master key for encrypting or decrypting a symmetric column encryption key is stored in a managed HSM in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>TargetColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that this cmdlet uses to determine where the column master key, to be used to encrypt the new encrypted value, is stored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>- Example 1: Generate a key and encrypt it using a certificate -</maml:title> <dev:code>$cmkSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation 'CurrentUser' -certificateThumbprint 'f2260f28d909d21c642a3d8e0b45a830e79a1420' New-SqlColumnEncryptionKeyEncryptedValue -TargetColumnMasterKeySettings $cmkSettings</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Generate a column encryption key value and encrypt it using a column master key that is a key stored in a key vault in Azure Key Vault.</maml:title> <dev:code># Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Pass the token to the cmdlet. It will use the token to communicate with the key vault containing the column master key to sign the column master key metadata properties. $cmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -KeyVaultAccessToken $keyVaultAccessToken # Generate a column encryption key value and encrypt it with the column master key. Pass the access token, so that the cmdlet can communicate with Azure Key Vault. New-SqlColumnEncryptionKeyEncryptedValue -TargetColumnMasterKeySettings $cmkSettings -KeyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Decrypt an existing encrypted key value, which was produced using a column master key that is a certificate. Re-encrypt the key value using a column master key that is a key in Azure Key Vault.</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Create a SqlColumnMasterKeySettings object referencing a certificate. $currentCmkSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation 'CurrentUser' -certificateThumbprint 'f2260f28d909d21c642a3d8e0b45a830e79a1420' # Create a SqlColumnMasterKeySettings object, referencing a column master key in a key vault in Azure Key Vault. $targetCmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' # Decrypt a column encryption key value using the current column master key and re-encrypt it with the new column master key. Pass the access token, so that the cmdlet can communicate with Azure Key Vault. New-SqlColumnEncryptionKeyEncryptedValue -TargetColumnMasterKeySettings $targetCmkSettings -ColumnMasterKeySettings $currentCmkSettings -KeyVaultAccessToken $keyVaultAccessToken -EncryptedValue '0x016E000001630075007200720065006E00740075007300650072002F006D0079002F006200330039003900340035006200370031003100330037003700350032006400380061003100310033003900660035006200640036006400380066003700330038006600320033006200360032003000307925663D2C3E275DD272E15E606927DA4326F5735C2C8E84F91B9EFE44F503ED01C130984E83AF4513F8A4A8D0878D42364E958291AE25111A868D25B69FC5143EEC04131DA27D05F3442CB665ACB4BB3F6A7A9F07DBD5D212A772414A2CCA03BEBEB7BF0E22C644C715D739B983872AFB2D390229A0B5311BCA07E3C1D857EE8982320BBBE9382C960B9674E3CC3D618AD623D6A362BEAEF68B1B1BB49660DD643A4375A9285CD9EAA5B13BFE2792DA92025351E7B6067BA07B6178D03041F40F00D84326627094C9D6944DD912497B080058A529D2DA11C8D609604449714420B4E44ECD1EB26DEE18BF712146A51DD99A02E3D4EE692A503CF02F874497010772DE743DDFB2A74801AC9A94C876D1F93554B70CE0ECC437E7FC28BC11A08222977CDA807E256ED536C41700C631878226E513AFE1199A1DB4732F975AA09A1E75B8A19802AE018871A7A0AD5B1E29B942F30490EDABD310A4170B991EBCFDA2AFE43285D5406476204B381D8A33EEB0B967073B4C0127B1C7F0281AB310EE4B9A3C2D3EAB44A1F5D15D4739FFAEF6110ED4808446F6A05DBF4121B2B33A0AF5A457CD38F895B8F7ABDF792E3ADBC3AF55B1442625F88F80127D08DE9E4AC1BB2AAA46843A477135053CEEFA4327D8C999C16D8B49C225F34AD7588A5F9E93FB5532B1F1DC5AFB3CE23DDC8DC12327DD6B5985104D14F4A1BC0F61F0AACD'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcolumnencryptionkeyencryptedvalue</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlColumnEncryptionKeyValue</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnEncryptionKeyValue</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlCertificateStoreColumnMasterKeySettings</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAzureKeyVaultColumnMasterKeySettings</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlColumnEncryptionSettings</command:name> <command:verb>New</command:verb> <command:noun>SqlColumnEncryptionSettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnEncryptionSettings object that encapsulates information about a single column's encryption, including CEK and encryption type.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlColumnEncryptionSettings cmdlet creates a SqlColumnEncryptionSettings object. The SqlColumnEncryptionSettings object encapsulates information about the Always Encrypted settings for a single database columns, including the encryption type and the column encryption key.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlColumnEncryptionSettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies the name of the database column that uses the following format: [<schemaName>.]<tableName>.<columnName>.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>EncryptionType</maml:name> <maml:description> <maml:para>Specifies the type of encryption. The acceptable values for this parameter are:</maml:para> <maml:para>- Deterministic, for deterministic encryption</maml:para> <maml:para>- Randomized, for randomized encryption</maml:para> <maml:para>- Plaintext, indicating that the column is not encrypted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>EncryptionKey</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object. This argument is not allowed if the EncryptionType parameter value is set to Plaintext.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies the name of the database column that uses the following format: [<schemaName>.]<tableName>.<columnName>.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>EncryptionKey</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object. This argument is not allowed if the EncryptionType parameter value is set to Plaintext.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>EncryptionType</maml:name> <maml:description> <maml:para>Specifies the type of encryption. The acceptable values for this parameter are:</maml:para> <maml:para>- Deterministic, for deterministic encryption</maml:para> <maml:para>- Randomized, for randomized encryption</maml:para> <maml:para>- Plaintext, indicating that the column is not encrypted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnEncryptionSettings</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Create an encrypted SqlColumnEncryptionSettings object for a column</maml:title> <dev:code>PS C:\> $EncryptionSettings = New-SqlColumnEncryptionSettings dbo.Person.LastName "Deterministic" MyCEK</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnEncryptionSettings object for the column named `dbo.Person.LastName`, specifying the deterministic encryption and column encryption key named `MyCEK` for the column. The command stores the result in the variable named `$EncryptionSettings`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create an unencrypted SqlColumnEncryptionSettings object for a column</maml:title> <dev:code>PS C:\> $EncryptionSettings = New-SqlColumnEncryptionSettings dbo.Person.FirstName "Plaintext"</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnEncryptionSettings object for the `dbo.Person.FirstName` column, specifying the column is not encrypted. The command stores the result in the variable named `$EncryptionSettings`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcolumnencryptionsettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlColumnMasterKey</command:name> <command:verb>New</command:verb> <command:noun>SqlColumnMasterKey</command:noun> <maml:description> <maml:para>Creates a column master key object in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlColumnMasterKey cmdlet creates a column master key object in the database. A column master key object captures the location of a physical cryptographic key that is intended to be used as a column master key for the Always Encrypted feature.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlColumnMasterKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that specifies the location of the actual column master key.</maml:para> <maml:para>The SqlColumnMasterKeySettings object has two properties: KeyStoreProviderName and KeyPath . KeyStoreProviderName specifies the name of a column master key store provider, which an Always Encrypted-enabled client driver must use to access the key store containing the column master key. KeyPath specifies the location of the column master key within the key store. The KeyPath format is specific to the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlColumnMasterKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that specifies the location of the actual column master key.</maml:para> <maml:para>The SqlColumnMasterKeySettings object has two properties: KeyStoreProviderName and KeyPath . KeyStoreProviderName specifies the name of a column master key store provider, which an Always Encrypted-enabled client driver must use to access the key store containing the column master key. KeyPath specifies the location of the column master key within the key store. The KeyPath format is specific to the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeySettings</maml:name> <maml:description> <maml:para>Specifies the SqlColumnMasterKeySettings object that specifies the location of the actual column master key.</maml:para> <maml:para>The SqlColumnMasterKeySettings object has two properties: KeyStoreProviderName and KeyPath . KeyStoreProviderName specifies the name of a column master key store provider, which an Always Encrypted-enabled client driver must use to access the key store containing the column master key. KeyPath specifies the location of the column master key within the key store. The KeyPath format is specific to the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnMasterKeySettings</command:parameterValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet creates.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.SqlColumnMasterKey</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Create a column master key object that references a certificate</maml:title> <dev:code>$CmkSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation 'CurrentUser' -CertificateThumbprint 'f2260f28d909d21c642a3d8e0b45a830e79a1420' New-SqlColumnMasterKey -Name 'CMK1' -ColumnMasterKeySettings $CmkSettings</dev:code> <dev:remarks> <maml:para>The first command uses the New-SqlCertificateStoreColumnMasterKeySettings cmdlet to create a column master settings referencing a certificate in Windows Certificate Store and stores the result in the variable named `$CmkSettings`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a column master key object that references a key in Azure Key Vault</maml:title> <dev:code>$CmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.contoso.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' New-SqlColumnMasterKey 'CMK1' -ColumnMasterKeySettings $CmkSettings</dev:code> <dev:remarks> <maml:para>The first command uses the New-SqlCertificateStoreColumnMasterKeySettings cmdlet to create column master key object referencing a key in Azure Key Vault and stores the result in the variable named `$CmkSettings`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a column master key object that references a key supporting CNG</maml:title> <dev:code>$CmkSettings = New-SqlCngColumnMasterKeySettings -CngProviderName 'Microsoft Software Key Storage Provider' -KeyName 'AlwaysEncryptedKey' New-SqlColumnMasterKey 'CMK1' -ColumnMasterKeySettings $CmkSettings</dev:code> <dev:remarks> <maml:para>The first command uses the New-SqlCertificateStoreColumnMasterKeySettings cmdlet to create column master key object referencing a key in a key store supporting the Cryptography Next Generation (CNG) API and stores the result in the variable named `$CmkSettings`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Create a column master key object that references a key supporting CSP</maml:title> <dev:code>$CmkSettings = New-SqlCspColumnMasterKeySettings 'MyCspProvider' 'AlwaysEncryptedKey' New-SqlColumnMasterKey 'CMK1' -ColumnMasterKeySettings $CmkSettings</dev:code> <dev:remarks> <maml:para>The first command uses the New-SqlCertificateStoreColumnMasterKeySettings cmdlet to create column master key object referencing a key in a key store key store with a Cryptography Service Provider (CSP) supporting Cryptography API (CAPI).</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Create a column master key object that references a certificate, it is auto-signed and supports enclave computations</maml:title> <dev:code>$CmkSettings = New-SqlCertificateStoreColumnMasterKeySettings -CertificateStoreLocation 'CurrentUser' -CertificateThumbprint 'f2260f28d909d21c642a3d8e0b45a830e79a1420' -AllowEnclaveComputations New-SqlColumnMasterKey -Name 'CMK1' -ColumnMasterKeySettings $CmkSettings</dev:code> <dev:remarks> <maml:para>The first command uses the New-SqlCertificateStoreColumnMasterKeySettings cmdlet to create column master settings referencing a certificate that supports enclave computations and is stored in Windows Certificate Store.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcolumnmasterkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlColumnMasterKeySettings</command:name> <command:verb>New</command:verb> <command:noun>SqlColumnMasterKeySettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object describing a master key stored in an arbitrarily specified key store provider and path.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlColumnMasterKeySettings cmdlet creates a SqlColumnMasterKeySettings in-memory object that stores properties of a column master key for Always Encrypted: KeyStoreProviderName, KeyPath, AllowEnclaveComputations, and Signature. This cmdlet can be used for custom key store providers and when both the key store provider name and a fully-formatted key path are known.</maml:para> <maml:para>The cmdlet may communicate with a key store holding the column master key to generate a signature of key metadata properties. If the key is stored in Azure, you need to specify a valid authentication token for a key vault or a managed HSM holding the key. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlColumnMasterKeySettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>KeyStoreProviderName</maml:name> <maml:description> <maml:para>Specifies the provider name of the key store used to protect the physical master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyPath</maml:name> <maml:description> <maml:para>Specifies the path within the key store of the physical master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with. This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the specified column master key is stored in a key vault in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the specified column master key is stored in a managed HSM in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>AllowEnclaveComputations</maml:name> <maml:description> <maml:para>Specifies whether the column master key allows enclave computations. If the parameter is specified, server-side secure enclaves will be allowed to perform computations on data protected with the column master key. Not valid for SQL Server 2017 and older versions.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyPath</maml:name> <maml:description> <maml:para>Specifies the path within the key store of the physical master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>KeyStoreProviderName</maml:name> <maml:description> <maml:para>Specifies the provider name of the key store used to protect the physical master key.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if the specified column master key is stored in a key vault in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if the specified column master key is stored in a managed HSM in Azure Key Vault and the cmdlet is expected to sign key metadata.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Signature</maml:name> <maml:description> <maml:para>Specifies a hexadecimal string that is a digital signature of column master key properties. A client driver can verify the signature to ensure the column master key properties have not been tampered with. This parameter is allowed only if AllowEnclaveComputations is specified. If AllowEnclaveComputations is specified, but Signature is not, the cmdlet automatically computes the signature and populates the Signature property of the new SqlColumnMasterKeySettings object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Generate settings for a column master key that is in Azure Key Vault and is not enclaved-enabled.</maml:title> <dev:code>$cmkSettings = New-SqlColumnMasterKeySettings -KeyStoreProviderName 'AZURE_KEY_VAULT' -KeyPath 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Generate settings for a column master key that is in a custom provider</maml:title> <dev:code>$cmkSettings = New-SqlColumnMasterKeySettings -KeyStoreProviderName 'CUSTOM_PROVIDER' -KeyPath '\\SecureNetworkShare\Keys\AlwaysEncrypted.key'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Generate settings for a column master key that is in Azure Key Vault, allows enclave computations and is signed using the provided signature.</maml:title> <dev:code>$cmkSettings = New-SqlColumnMasterKeySettings -KeyStoreProviderName 'AZURE_KEY_VAULT' -KeyPath 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -Signature '0x19BEB4F27F582FDBBD0C7E5F92CF161D79D5E7F5A5183F9C8E710252E7028A3654FBEAF834EE45925024F1A32BD3C6D7D92B46E38690830E20E0777607B073E6665EB05E39263C02557D1208ACECB2251A108D0DEFC25232B67FD223C590258C817292FAFCE2388507812D64A0AEC9E546B0B8E4B2F3EA436053CB158F3CF478C5F5EDA511D0F752F60C3B129BF21356A93368FCC7FD6FAA8DB4E919EB551F375181CA3F4D0404A811C99BD2C8D10C0003AC12B138371F2D76611768B4E84D44116C42F00D679B36D41FBD9467B58291B1F4348C7B422793DA0614EF980CA0A7F42B6D627AFA5A753F0869D2C2F9B0FD38289D5433CE9266C6F867334654BE12'</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Generate settings for a column master key that is in Azure Key Vault, allows enclave computations and is auto-signed.</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token # Pass the token to the cmdlet. It will use the token to communicate with a key vault in Azure Key Vault to sign the column master key properties. $cmkSettings = New-SqlColumnMasterKeySettings -KeyStoreProviderName 'AZURE_KEY_VAULT' -KeyPath 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -KeyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcolumnmasterkeysettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlCngColumnMasterKeySettings</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlCspColumnMasterKeySettings</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlCredential</command:name> <command:verb>New</command:verb> <command:noun>SqlCredential</command:noun> <maml:description> <maml:para>Creates a SQL Server credential object.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlCredential cmdlet creates a new SQL Server credential object. A SQL Server credential object is used to store authentication information. The SQL Server credential is required when backing up to or restoring from the Windows Azure storage service, and is used to store the Windows Azure storage account name and access key information.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object where the credential should be created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the name of user or account. For Windows Azure storage service authentication, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ProviderName</maml:name> <maml:description> <maml:para>Specifies the cryptographic provider name for the Enterprise Key Management Provider (EKM).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service authentication, this is the storage account access key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the name of user or account. For Windows Azure storage service authentication, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ProviderName</maml:name> <maml:description> <maml:para>Specifies the cryptographic provider name for the Enterprise Key Management Provider (EKM).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service authentication, this is the storage account access key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the name of user or account. For Windows Azure storage service authentication, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object where the credential should be created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the instance of SQL Server for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ProviderName</maml:name> <maml:description> <maml:para>Specifies the cryptographic provider name for the Enterprise Key Management Provider (EKM).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service authentication, this is the storage account access key value.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Create a SQL credential for the current instance of SQL Server</maml:title> <dev:code>PS C:\> cd SQLServer:\SQL\Computer\Instance PS SQLServer:\SQL\Computer\Instance> New-SqlCredential -Name "MySqlCredential" -Identity "MyWindowsAzureStorageAccount" -Secret "P4ssw0rd"</dev:code> <dev:remarks> <maml:para>The first command changes the directory to SQLServer:\SQL\Computer\Instance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a SQL credential for all instances of SQL Server</maml:title> <dev:code>PS C:\> cd SQLServer:\SQL\Computer\Instance PS SQLServer:\SQL\Computer\Instance> $SecureString = ConvertTo-SecureString "[Placeholder]" -AsPlainText -Force PS SQLServer:\SQL\Computer\Instance> $Instances = Get-ChildItem PS SQLServer:\SQL\Computer\Instance> $Instances | New-SqlCredential -Name "MySqlCredential" -Identity "MyWindowsAzureStorageAccount" -Secret $SecureString</dev:code> <dev:remarks> <maml:para>The first command changes the directory to SQLServer:\SQL\Computer\Instance.</maml:para> <maml:para>The forth command uses the pipeline to pass the instances to the New-SqlCredential to create a SQL Credential named `MySqlCredential` on all the instances of SQL Server.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcredential</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlCspColumnMasterKeySettings</command:name> <command:verb>New</command:verb> <command:noun>SqlCspColumnMasterKeySettings</command:noun> <maml:description> <maml:para>Creates a SqlColumnMasterKeySettings object describing an asymmetric key stored in a key store with a CSP supporting CAPI.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlCspColumnMasterKeySettings cmdlet creates a SqlColumnMasterKeySettings object. The SqlColumnMasterKeySettings object references a key, stored in a key store using a Cryptographic Service Provider (CSP) supporting the Microsoft Crypto API (CAPI). The SqlColumnMasterKeySettings object has two properties: KeyStoreProviderName and KeyPath . This cmdlet sets the KeyStoreProviderName property to contain the name of the column master key store provider using CSP/CAPI, then generates and sets the value of the KeyPath property to reference the specified key.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlCspColumnMasterKeySettings</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CspProviderName</maml:name> <maml:description> <maml:para>Specifies the name of the CSP provider for the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyName</maml:name> <maml:description> <maml:para>Specifies the name of the key in the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>CspProviderName</maml:name> <maml:description> <maml:para>Specifies the name of the CSP provider for the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>KeyName</maml:name> <maml:description> <maml:para>Specifies the name of the key in the key store.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SqlColumnMasterKeySettings</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: Create a SqlColumnMasterKeySettings object ----</maml:title> <dev:code>PS C:\> $CmkSettings = New-SqlCspColumnMasterKeySettings -CspProviderName "Microsoft Software Key Storage Provider" -KeyName "AlwaysEncryptedKey"</dev:code> <dev:remarks> <maml:para>This command creates a SqlColumnMasterKeySettings object referencing a key in a key store encapsulated by a CSP provider called Microsoft Software Key Storage Provider.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlcspcolumnmasterkeysettings</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlHADREndpoint</command:name> <command:verb>New</command:verb> <command:noun>SqlHADREndpoint</command:noun> <maml:description> <maml:para>Creates a database mirroring endpoint on a SQL Server instance.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlHADREndpoint cmdlet creates a database mirroring endpoint on a SQL Server instance. This endpoint is required on every server instance that hosts an availability replica for any availability group. Each server instance can only have one database mirroring endpoint. If a server instance possesses a database mirroring endpoint, use the existing endpoint.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlHADREndpoint</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the endpoint name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance where the endpoint is created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint.</maml:para> <maml:para>If the specified option calls for a certificate, the Certificate parameter must be set.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Ntlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Kerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Negotiate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NtlmCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">KerberosCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NegotiateCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNtlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateKerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNegotiate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate that the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the encryption option for the endpoint.</maml:para> <maml:para>The default value is `Required`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Supported</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Required</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>By default the endpoint will use Aes encryption.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using RC4 or RC4_128 when the database is in compatibility level 90 or 100, but this is not recommended. For increased security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AesRC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4Aes</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address of the endpoint. The default is ALL, which indicates that the listener accepts a connection on any valid IP address.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the login of the owner of the endpoint. By default, this is the current login.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port on which the endpoint will listen for connections. The default is `5022`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>New-SqlHADREndpoint</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the endpoint name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL Server instance of the endpoint. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint.</maml:para> <maml:para>If the specified option calls for a certificate, the Certificate parameter must be set.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Ntlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Kerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Negotiate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NtlmCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">KerberosCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NegotiateCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNtlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateKerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNegotiate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate that the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the encryption option for the endpoint.</maml:para> <maml:para>The default value is `Required`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Supported</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Required</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>By default the endpoint will use Aes encryption.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using RC4 or RC4_128 when the database is in compatibility level 90 or 100, but this is not recommended. For increased security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AesRC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4Aes</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address of the endpoint. The default is ALL, which indicates that the listener accepts a connection on any valid IP address.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the login of the owner of the endpoint. By default, this is the current login.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port on which the endpoint will listen for connections. The default is `5022`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint.</maml:para> <maml:para>If the specified option calls for a certificate, the Certificate parameter must be set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate that the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the encryption option for the endpoint.</maml:para> <maml:para>The default value is `Required`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>By default the endpoint will use Aes encryption.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using RC4 or RC4_128 when the database is in compatibility level 90 or 100, but this is not recommended. For increased security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance where the endpoint is created.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address of the endpoint. The default is ALL, which indicates that the listener accepts a connection on any valid IP address.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the endpoint name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the login of the owner of the endpoint. By default, this is the current login.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the SQL Server instance of the endpoint. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port on which the endpoint will listen for connections. The default is `5022`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SMO.Endpoint</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------- Example 1: Create a database mirroring endpoint -------</maml:title> <dev:code>PS C:\> New-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance" -Name "MainEndpoint"</dev:code> <dev:remarks> <maml:para>This command creates a database mirroring endpoint named `MainEndpoint` on the server instance located at the specified path. This endpoint uses the default port, `5022`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Create a database mirroring endpoint that requires encryption</maml:title> <dev:code>PS C:\> New-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance" -Name "MainEndpoint" -Port 4022 -EncryptionAlgorithm Aes -Encryption Required</dev:code> <dev:remarks> <maml:para>This command creates a database mirroring endpoint named `MainEndpoint` on the server instance located at the specified path. This endpoint listens on port `4022`. The endpoint uses the `AES` algorithm for encryption and requires that connections use encryption.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Create a database mirroring endpoint that is encrypted with a certificate</maml:title> <dev:code>PS C:\> New-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance" -Name "MainEndpoint" -AuthenticationOrder Certificate -Certificate "EncryptionCertificate"</dev:code> <dev:remarks> <maml:para>This command creates a database mirroring endpoint named `MainEndpoint` on the server instance located at the specified path. This endpoint uses the certificate named `EncryptionCertificate` to authenticate connections.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---- Example 4: Create a database mirroring endpoint script ----</maml:title> <dev:code>PS C:\> New-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance" -Name "MainEndpoint" -Script</dev:code> <dev:remarks> <maml:para>This command outputs the Transact-SQL script that creates a database mirroring endpoint named `MainEndpoint` on the server instance located at the specified path. The endpoint is not actually created by this command.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlhadrendpoint</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlHADREndpoint</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlVulnerabilityAssessmentBaseline</command:name> <command:verb>New</command:verb> <command:noun>SqlVulnerabilityAssessmentBaseline</command:noun> <maml:description> <maml:para>Creates a new instance of Microsoft.SQL.VulnerabilityAssessment.SecurityCheckBaseline.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlVulnerabilityAssessmentBaseline cmdlet creates a new instance of Microsoft.SQL.VulnerabilityAssessment.SecurityCheckBaseline.</maml:para> <maml:para>As you review your assessment results, you can mark specific results of a security check as being an acceptable Baseline in your environment. </maml:para> <maml:para>The baseline is essentially a customization of how the results of a specific security check are evaluated. </maml:para> <maml:para>If the results of a security check match those that are expected according to the baseline, this check will be evaluated as passing.</maml:para> <maml:para>Baselines should be added to a Baseline set, and you should run the scan with it to receive applicable results.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlVulnerabilityAssessmentBaseline</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>SecurityCheckId</maml:name> <maml:description> <maml:para>The security check id which the baseline applies to.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpectedResult</maml:name> <maml:description> <maml:para>The baseline expected result for the security check query. This expected result overrides the security check original expected results.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Severity</maml:name> <maml:description> <maml:para>The new severity for the security check. This severity overrides the security check original severity.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SecurityCheckSeverity</command:parameterValue> <dev:type> <maml:name>SecurityCheckSeverity</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ExpectedResult</maml:name> <maml:description> <maml:para>The baseline expected result for the security check query. This expected result overrides the security check original expected results.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>SecurityCheckId</maml:name> <maml:description> <maml:para>The security check id which the baseline applies to.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Severity</maml:name> <maml:description> <maml:para>The new severity for the security check. This severity overrides the security check original severity.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckSeverity</command:parameterValue> <dev:type> <maml:name>SecurityCheckSeverity</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>None</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Create a new security check baseline using a Vulnerability Assessment scan results</maml:title> <dev:code>PS C:\> $scanResult = Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database some_database PS C:\> $result2010 = $scanResult.Results.VA2010 PS C:\> $baseline2010 = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId $result2010.SecurityCheckId -ExpectedResult $result2010.QueryResults -Severity Medium</dev:code> <dev:remarks> <maml:para>In this example we run a Vulnerability Assessment scan, and search for failed security checks. We see that we have two failed security checks - VA2042 and VA2109. We decide that we want to set a baseline for security check VA2109, so we create a new SecurityCheckBaseline with the security check id and query results that we got from the scan result object.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Create a new security check baseline manually ---</maml:title> <dev:code>PS C:\> [string[][]]$expectedResults = ("guest", "db_datareader", "SQLUSER", "NONE"), ("guest", "db_owner", "SQLUSER", "NONE") PS C:\> $baseline = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId "VA2109" -ExpectedResult $expectedResults SecurityCheckId Severity ExpectedResults --------------- -------- --------------- VA2109 {guest db_datareader SQLUSER NONE, guest db_owner SQLUSER NONE}</dev:code> <dev:remarks> <maml:para>In this example we create a baseline for security check 'VA2109' manually. We first create the expected results which contains two rows. Then we create the baseline with the expected results.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlvulnerabilityassessmentbaseline</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>New-SqlVulnerabilityAssessmentBaselineSet</command:name> <command:verb>New</command:verb> <command:noun>SqlVulnerabilityAssessmentBaselineSet</command:noun> <maml:description> <maml:para>Creates a new instance of Microsoft.SQL.VulnerabilityAssessment.SecurityCheckBaselineSet.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The New-SqlVulnerabilityAssessmentBaselineSet cmdlet creates a new instance of Microsoft.SQL.VulnerabilityAssessment.BaselineSet.</maml:para> <maml:para>A baseline set consists of a set of baselines (of type Microsoft.SQL.VulnerabilityAssessment.SecurityCheckBaseline). Each baseline defines the expected results of a specific security check. Grouped in a baseline set these baselines define the expected results for all security checks in a scan.</maml:para> <maml:para>The baseline set can be created with 0 or more baselines.</maml:para> <maml:para>The baseline set is used as an input of a scan to apply these baseline settings to its results.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> <maml:para>> `This cmdlet was removed in v22.3+ of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>New-SqlVulnerabilityAssessmentBaselineSet</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Baselines</maml:name> <maml:description> <maml:para>A list of security check baselines. The baseline set will be initialized with this list.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaseline[]</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaseline[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>Baselines</maml:name> <maml:description> <maml:para>A list of security check baselines. The baseline set will be initialized with this list.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecurityCheckBaseline[]</command:parameterValue> <dev:type> <maml:name>SecurityCheckBaseline[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.VulnerabilityAssessment.SecurityCheckBaseline[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Create a baseline set with a list of baselines --</maml:title> <dev:code>PS C:\> $baseline1 = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId VA1234 -ExpectedResult $null PS C:\> $baseline2 = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId VA1235 -ExpectedResult $null PS C:\> $baselineSet = New-SqlVulnerabilityAssessmentBaselineSet -Baselines $baseline1, $baseline2 SecurityCheckBaselines ---------------------- {VA1234, VA1235}</dev:code> <dev:remarks> <maml:para>This example creates two baselines and then creates a baseline set with them.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/new-sqlvulnerabilityassessmentbaselineset</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Read-SqlTableData</command:name> <command:verb>Read</command:verb> <command:noun>SqlTableData</command:noun> <maml:description> <maml:para>Reads data from a table of a SQL database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Read-SqlTableData cmdlet reads data stored in a table of a SQL database. You can select which columns to read, limit the number of rows, and sort and order columns.</maml:para> <maml:para>You can use this cmdlet with the Windows PowerShell SQL provider. This cmdlet can infer information such as server, database, schema, and table from its current path.</maml:para> <maml:para>This cmdlet supports the follow output formats:</maml:para> <maml:para>- DataSet. An object of type System.Data.DataSet that contains one table. </maml:para> <maml:para>- DataTable. An object of type System.Data.DataTable. The TableName property of this object</maml:para> <maml:para> is the same as the table that this cmdlet queries. - DataRows. A collection of System.Data.DateRow objects.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Read-SqlTableData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the DatabaseName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and TableName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>TableName</maml:name> <maml:description> <maml:para>Specifies the name of the table from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the TableName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Read-SqlTableData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the table that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptSchemaObjectBase[]</command:parameterValue> <dev:type> <maml:name>ScriptSchemaObjectBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Read-SqlTableData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the table that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the DatabaseName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and TableName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the table that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptSchemaObjectBase[]</command:parameterValue> <dev:type> <maml:name>ScriptSchemaObjectBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the table that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>TableName</maml:name> <maml:description> <maml:para>Specifies the name of the table from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the TableName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: Get three rows from a table ------------</maml:title> <dev:code>PS C:\> Read-SqlTableData -ServerInstance "MyServer\MyInstance" -DatabaseName "MyDatabase" -SchemaName "dbo" -TableName "MyTable" -TopN 3 Id Name Amount -- ---- ------ 10 AAAAA -1.2 11 BBBBB 1.2 12 CCCCC -1.0</dev:code> <dev:remarks> <maml:para>This command gets the first three rows from table `MyDatabase.dbo.MyTable` on the `MyServer\MyInstance` instance. The TopN parameter specifies the number of rows (3 in this case).</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------------- Example 2: Display a whole table ---------------</maml:title> <dev:code>PS C:\> cd SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Tables\dbo.CSVTable PS SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Tables\dbo.CSVTable> Read-SqlTableData Id Name Amount -- ---- ------ 10 AAAA -1.2 11 BBBB 1.2 12 CCCC -1.0 13 DDDD -2.0</dev:code> <dev:remarks> <maml:para>The first command changes the location to be a table in the SQLSERVER provider. The command prompt reflects the new location.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---------- Example 3: Display selected sorted columns ----------</maml:title> <dev:code>PS C:\> cd SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Tables\dbo.CSVTable PS SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Tables\dbo.CSVTable> Read-SqlTableData -TopN 3 -ColumnName "Id","Name" -ColumnOrder "Id","Name" -ColumnOrderType DESC,ASC Id Name -- ---- 12 CCCC 11 BBBB 10 AAAA</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/read-sqltabledata</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Read-SqlViewData</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Write-SqlTableData</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Read-SqlViewData</command:name> <command:verb>Read</command:verb> <command:noun>SqlViewData</command:noun> <maml:description> <maml:para>Reads data from a view of a SQL database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Read-SqlViewData cmdlet reads data stored in a view of a SQL database. You can select which columns to read, limit the number of rows, and sort and order columns.</maml:para> <maml:para>You can use this cmdlet with the Windows PowerShell SQL provider. This cmdlet can infer information such as server, database, schema, and table from its current path.</maml:para> <maml:para>This cmdlet supports the follow output formats:</maml:para> <maml:para>- DataSet. An object of type System.Data.DataSet that contains one table. </maml:para> <maml:para>- DataTable. An object of type System.Data.DataTable. The TableName property of this object</maml:para> <maml:para> is the same as the table that this cmdlet queries. - DataRows. A collection of System.Data.DateRow objects.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Read-SqlViewData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the view.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the DatabaseName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and ViewName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the view.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>ViewName</maml:name> <maml:description> <maml:para>Specifies the name of the view from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ViewName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Read-SqlViewData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the view that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptSchemaObjectBase[]</command:parameterValue> <dev:type> <maml:name>ScriptSchemaObjectBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Read-SqlViewData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the view that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">ASC</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DESC</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">DataSet</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataTable</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">DataRows</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="ColumnToReturn"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Specifies an array of names of columns that this cmdlet returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="OrderBy"> <maml:name>ColumnOrder</maml:name> <maml:description> <maml:para>Specifies an array of names of columns by which this cmdlet sorts the columns that it returns.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnOrderType</maml:name> <maml:description> <maml:para>Specifies an array of order types for columns that this cmdlet returns. The acceptable values for this parameter are:</maml:para> <maml:para>- ASC. Ascending. </maml:para> <maml:para>- DESC. Descending.</maml:para> <maml:para></maml:para> <maml:para>The values that you specify for this parameter match the columns that you specify in the ColumnOrder parameter. This cmdlet ignores any extra values.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">OrderType[]</command:parameterValue> <dev:type> <maml:name>OrderType[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the view.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the DatabaseName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and ViewName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the view that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ScriptSchemaObjectBase[]</command:parameterValue> <dev:type> <maml:name>ScriptSchemaObjectBase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="As"> <maml:name>OutputAs</maml:name> <maml:description> <maml:para>Specifies the type of output.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">OutputTypeSingleTable</command:parameterValue> <dev:type> <maml:name>OutputTypeSingleTable</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the view that this cmdlet reads.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the view.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="First"> <maml:name>TopN</maml:name> <maml:description> <maml:para>Specifies the number of rows of data that this cmdlet returns. If you do not specify this parameter, the cmdlet returns all the rows.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64</command:parameterValue> <dev:type> <maml:name>Int64</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>ViewName</maml:name> <maml:description> <maml:para>Specifies the name of the view from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ViewName parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------- Example 1: Get two rows from a view -------------</maml:title> <dev:code>PS C:\> Read-SqlViewData -ServerInstance "MyServer\MyInstance" -DatabaseName "MyDatabase" -SchemaName "dbo" -ViewName "MyView" -TopN 2 Id Name Amount -- ---- ------ 10 AAAAA -1.2 11 BBBBB 1.2</dev:code> <dev:remarks> <maml:para>This command gets the first two rows from the database view `MyDatabase.dbo.MyView` on the `MyServer\MyInstance` instance. The TopN parameter specifies the number of rows (2 in this case).</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------------- Example 2: Display a whole view ---------------</maml:title> <dev:code>PS C:\> cd SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Views\dbo.MyView PS SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Views\dbo.MyView> Read-SqlViewData Id Name Amount -- ---- ------ 10 AAAA -1.2 11 BBBB 1.2 12 CCCC -1.0 13 DDDD -2.0</dev:code> <dev:remarks> <maml:para>The first command changes the location to be a view in the SQLSERVER provider. The command prompt reflects the new location.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---------- Example 3: Display selected sorted columns ----------</maml:title> <dev:code>PS C:\> cd SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Views\dbo.MyView PS SQLSERVER:\sql\MyServer\MyInstance\Databases\MyDatabase\Views\dbo.MyView> Read-SqlViewData -TopN 3 -ColumnName "Id","Name" -ColumnOrder "Id","Name" -ColumnOrderType DESC,ASC Id Name -- ---- 12 CCCC 11 BBBB 10 AAAA</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/read-sqlviewdata</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Read-SqlXEvent</command:name> <command:verb>Read</command:verb> <command:noun>SqlXEvent</command:noun> <maml:description> <maml:para>Reads SQL Server XEvents from XEL file or live SQL XEvent session.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Read-SqlXEvent reads SQL Server XEvents from a file or live SQL XEvent session. XEvent sessions are created by the CREATE EVENT SESSION Transact-SQL API. SQL XEvent files usually have the .XEL or .sqlaudit extensions and contain a stream of XEvents. The structure of the XEvents is defined in the session configuration. SQL live streams are available via the SQL TDS protocol and require authetication against the server that produced them.</maml:para> <maml:para>> `New in v22: if you are using the -ConnectionString parameter, you may get an error like "The certificate chain was issued by an authority that is not trusted." This is because the new SQL driver changed its default to something more secure. Either make sure you configure your server properly, or install/trust the certificate; alternatively (not recommended), you can pass Encrypt=Optional or TrustServerCertificate=true in the connection string to go back to the behavior that existed in v21 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Read-SqlXEvent</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>SQL Server connection string.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionName</maml:name> <maml:description> <maml:para>The SQL Server XEvent session name as defined by the CREATE EVENT SESSION Transact-SQL.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Read-SqlXEvent</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>FileName</maml:name> <maml:description> <maml:para>File name of a XEvent file to read.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>SQL Server connection string.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none"> <maml:name>FileName</maml:name> <maml:description> <maml:para>File name of a XEvent file to read.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionName</maml:name> <maml:description> <maml:para>The SQL Server XEvent session name as defined by the CREATE EVENT SESSION Transact-SQL.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>Microsoft.SqlServer.XEvent.XELite.IXEvent</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Read and parse the sqlaudit file. Each object returned will contain all the information from a single audit record.</maml:title> <dev:code>Read-SqlXEvent -FileName C:\audits\Audit-20190529-132659.sqlaudit # The output would look like this: # # Name : audit_event # UUID : c6479a6f-f1bd-4759-9881-fcb493821aff # Timestamp : 6/13/2019 7:49:42 AM +00:00 # Fields : {[audit_schema_version, 1], [event_time, 6/13/2019 7:49:42 AM +00:00], [sequence_number, 1], [action_id, # 1129534785]...} # Actions : {} # # Name : audit_event # UUID : c6479a6f-f1bd-4759-9881-fcb493821aff # Timestamp : 6/13/2019 12:42:28 PM +00:00 # Fields : {[audit_schema_version, 1], [event_time, 6/13/2019 12:42:28 PM +00:00], [sequence_number, 1], [action_id, # 1129534785]...} # Actions : {} # ...</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Read and parse the live stream of XEvents from the SQL Server running on the same machine connected with Windows authentication. Each object returned will contain all the information from a single XEvent record.</maml:title> <dev:code>Read-SQLXEvent -ConnectionString "Server=.;Database=master;Trusted_Connection=True" -SessionName telemetry_xevents # The output would look like this: # # Name : auto_stats # UUID : 9237e17a-a73d-4832-8936-f319e19e219b # Timestamp : 11/14/2022 5:31:12 AM +00:00 # Fields : {[database_id, 1], [object_id, 74], [index_id, 1], [job_id, 0]…} # Actions : {} # # Name : auto_stats # UUID : 9237e17a-a73d-4832-8936-f319e19e219b # Timestamp : 11/14/2022 5:31:12 AM +00:00 # Fields : {[database_id, 1], [object_id, 74], [index_id, 17], [job_id, 0]…} # Actions : {} # ...</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/read-sqlxevent</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Extended events in Azure SQL Database</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>CREATE EVENT SESSION (Transact-SQL)</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>CREATE SERVER AUDIT (Transact-SQL)</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlAvailabilityDatabase</command:name> <command:verb>Remove</command:verb> <command:noun>SqlAvailabilityDatabase</command:noun> <maml:description> <maml:para>Removes an availability database from its availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlAvailabilityDatabase cmdlet removes availability database from its availability group. The InputObject or Path parameter specifies the availability database.</maml:para> <maml:para>If you run this cmdlet at the server instance that hosts the primary replica, the cmdlet removes the primary database and all corresponding secondary databases from the availability group.</maml:para> <maml:para>If you run this cmdlet at a server instance that hosts a secondary replica, the cmdlet removes only the local secondary database from the availability group. The secondary database is no longer joined to the availability group, but other copies of the database continue to be joined.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityDatabase</maml:name> </dev:type> <maml:description> <maml:para>You can pass an availability database to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Remove a database from an availability group ---</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16"</dev:code> <dev:remarks> <maml:para>This command removes the availability database named `Database16` from the availability group named `MainAG`. This command runs on the server instance that hosts the primary replica. Therefore, it removes the primary database and all its corresponding secondary databases from the availability group. Data synchronization no longer occurs for this database on any secondary replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 2: Remove all databases from an availability group --</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityDatabases" | Remove-SqlAvailabilityDatabase</dev:code> <dev:remarks> <maml:para>This command gets all the availability databases that belong to `MainAG`, and then passes them to the current cmdlet by using the pipeline operator. The current cmdlet removes each availability database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Remove a secondary database from an availability group</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\SecondaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16"</dev:code> <dev:remarks> <maml:para>This command removes the secondary database named `Database16` from the secondary replica hosted by the server instance named `SecondaryServer\Instance`. Data synchronization to the removed secondary databases stops. This command does not affect the primary database or any other secondary databases.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Create a script to remove a database from an availability group</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that removes the availability database named `Database16` from the availability group named `MainAG`. The command does not perform this action.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlavailabilitydatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Resume-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Suspend-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlAvailabilityGroup</command:name> <command:verb>Remove</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Removes an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlAvailabilityGroup cmdlet removes an availability group in Always On Availability Groups. You can run this cmdlet on any instance of SQL Server that has Always On Availability Groups enabled on a Windows Server Failover Cluster (WSFC) node that has security credentials for the availability group.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: Remove an availabity group ------------</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command removes the availability group named `MainAG`. You can run this command on any server instance that hosts an availability replica for the availability group.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---------- Example 2: Remove all availability groups ----------</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups" | Remove-SqlAvailabilityGroup</dev:code> <dev:remarks> <maml:para>This command gets all availability groups that have availability replicas in the specified location in the SQLSERVER: provider. The command passes them to the current cmdlet by using the pipeline operator. That cmdlet deletes each availability group.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 3: Create a script to remove an availability group --</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups\MainAG" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that removes the availability group named MainAG. The command does not perform this action.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Join-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Switch-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlAvailabilityReplica</command:name> <command:verb>Remove</command:verb> <command:noun>SqlAvailabilityReplica</command:noun> <maml:description> <maml:para>Removes a secondary availability replica.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlAvailabilityReplica cmdlet removes the secondary replica that is specified by the InputObject or Path parameters. This cmdlet must be executed at the server instance that hosts the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the AvailabilityReplica object for the replica to remove.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this command returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the availability replica. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this command returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the AvailabilityReplica object for the replica to remove.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the availability replica. This parameter is required.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this command returns a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityReplica[]</maml:name> </dev:type> <maml:description> <maml:para>Specifies the availability replica to remove.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---------- Example 1: Remove an availability replica ----------</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityReplica -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAg\AvailabilityReplicas\MainReplica"</dev:code> <dev:remarks> <maml:para>This command removes the availability replica named `MainReplica` from the availability group named `MainAg`. This command must be run on the server instance that hosts the primary replica of the availability group.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Generate a TransactSQL script that removes an availability replica</maml:title> <dev:code>PS C:\> Remove-SqlAvailabilityReplica -Path "SQLSERVER:\SQL\PrimaryServer\InstanceName\AvailabilityGroups\MainAg\AvailabilityReplicas\MainReplica" -Script</dev:code> <dev:remarks> <maml:para>This command outputs the Transact-SQL script that removes the availability replica named `MainReplica` from the availability group named `MainAg`. This command does not remove the replica.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlavailabilityreplica</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlColumnEncryptionKey</command:name> <command:verb>Remove</command:verb> <command:noun>SqlColumnEncryptionKey</command:noun> <maml:description> <maml:para>Removes the column encryption key object from the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlColumnEncryptionKey cmdlet removes the column encryption key object with the specified name from the database.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlColumnEncryptionKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlColumnEncryptionKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Remove a column encryption key by name ------</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase> Remove-SqlColumnEncryptionKey -Name -Name "CEK1"</dev:code> <dev:remarks> <maml:para>This command removes the column encryption key named `CEK1` from database `MyDatabase` on server instance `MyServer\MyInstance`</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlcolumnencryptionkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlColumnEncryptionKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlColumnEncryptionKeyValue</command:name> <command:verb>Remove</command:verb> <command:noun>SqlColumnEncryptionKeyValue</command:noun> <maml:description> <maml:para>Removes an encrypted value from an existing column encryption key object in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlColumnEncryptionKeyValue cmdlet modifies a column encryption key object in the database, by removing an entry for an encrypted value produced using the specified column master key.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlColumnEncryptionKeyValue</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the encrypted value that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlColumnEncryptionKeyValue</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the encrypted value that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnMasterKeyName</maml:name> <maml:description> <maml:para>Specifies the name of the column master key that was used to produce the encrypted value that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column encryption key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database for which this cmdlet runs the operation. If you do not specify a value for this parameter, this cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------- Example 1: Remove a column encryption key value -------</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase> Remove-SqlColumnEncryptionKeyValue -Name "CEK1" -ColumnMasterKey "CMK1"</dev:code> <dev:remarks> <maml:para>This command removes the column encryption key value encrypted with a column master key named `CMK1` from the column encryption key database object named `CEK1`. The operation happens on database `MyDatabase` on server instance `MyServer\MyInstance`</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlcolumnencryptionkeyvalue</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlColumnEncryptionKeyValue</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlColumnMasterKey</command:name> <command:verb>Remove</command:verb> <command:noun>SqlColumnMasterKey</command:noun> <maml:description> <maml:para>Removes the column master key object from the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlColumnMasterKey cmdlet removes the column master key object with the specified name from the database.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlColumnMasterKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet performs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlColumnMasterKey</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="2" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet performs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Name</maml:name> <maml:description> <maml:para>Specifies the name of the column master key object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Remove a column master key object from the database</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase> Remove-SqlColumnMasterKey -Name "CMK1"</dev:code> <dev:remarks> <maml:para>This command removes the column master key object named `CMK1` from the database `MyDatabase` on server instance `MyServer\MyInstance`</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlcolumnmasterkey</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlColumnMasterKey</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlCredential</command:name> <command:verb>Remove</command:verb> <command:noun>SqlCredential</command:noun> <maml:description> <maml:para>Removes the SQL credential object.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlCredential cmdlet removes a SQL Server credential object. This cmdlet supports the following two modes of operation:</maml:para> <maml:para>- Specifies the path or location of the credential including the credential name using the Path parameter.</maml:para> <maml:para>- Passes a Smo.Credential object to the object using the InputObject parameter.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an input credential object, as an array. You can use the Get-SqlCredential to get the object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Credential[]</command:parameterValue> <dev:type> <maml:name>Credential[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the credential, as an array, on which this cmdlet performs this operation. For instance, `SQLSERVER:\SQL\Computer\Instance\Credentials\Credential`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an input credential object, as an array. You can use the Get-SqlCredential to get the object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Credential[]</command:parameterValue> <dev:type> <maml:name>Credential[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the credential, as an array, on which this cmdlet performs this operation. For instance, `SQLSERVER:\SQL\Computer\Instance\Credentials\Credential`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Credential[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------- Example 1: Remove a SQL credential --------------</maml:title> <dev:code>PS C:\> Remove-SqlCredential -Path "SQLSERVER:\SQL\Computer\Instance\Credentials\MySqlCredential"</dev:code> <dev:remarks> <maml:para>This command removes the SQL credential named MySqlCredential using the path specified in the Path parameter.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---- Example 2: Remove a SQL credential through input pipe ----</maml:title> <dev:code>PS C:\> $Cred = Get-SqlCredential -Name MySqlCredential -Path "SQLSERVER:\SQL\Computer\Instance\Credentials\MySqlCredential" PS C:\> $Cred | Remove-SqlCredential</dev:code> <dev:remarks> <maml:para>The command gets the credential object from the Get-Credential cmdlet and then uses the pipeline to pass it to the Remove-SqlCredential cmdlet to remove the SQL credential named `MySqlCredential`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlcredential</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlFirewallRule</command:name> <command:verb>Remove</command:verb> <command:noun>SqlFirewallRule</command:noun> <maml:description> <maml:para>Disables the Windows Firewall rule that allows connections to a specific instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlFirewallRule cmdlet disables the Windows Firewall rule that allows connections to a specific instance of SQL Server.</maml:para> <maml:para>SQL Server Cloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation:</maml:para> <maml:para>- Specify the instance Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object, as an array, of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that we need to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that we need to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlFirewallRule</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that we need to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Server object, as an array, of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that we need to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as an array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Disable a Windows Firewall rule that blocks connections to a SQL Server instance</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Remove-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command disables the Windows Firewall rule on the computer to block connections to the SQL Server instance on this computer. The current working directory is used to determine the server instance where the operation should occur. The self-signed certificate of the target computer is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Disable a Windows Firewall rule that blocks connections to all SQL Server instances</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer002" | Remove-SqlFirewallRule -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server on the computer named `Computer002` and disables the Windows Firewall rules to block connections to each one of them. The self-signed certificate of the target computer is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlfirewallrule</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlFirewallRule</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlLogin</command:name> <command:verb>Remove</command:verb> <command:noun>SqlLogin</command:noun> <maml:description> <maml:para>Removes Login objects from an instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlLogin cmdlet removes Login objects form an instance of SQL Server. If you specify the name of the Login object, the cmdlet removes that specific object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet removes. > Note: The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RemoveAssociatedUsers</maml:name> <maml:description> <maml:para>Indicates that this cmdlet removes the users that are associated with the Login object.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlLogin</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an SQL Server Management Objects (SMO) object that represents the Login object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Login</command:parameterValue> <dev:type> <maml:name>Login</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet removes. > Note: The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RemoveAssociatedUsers</maml:name> <maml:description> <maml:para>Indicates that this cmdlet removes the users that are associated with the Login object.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlLogin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet removes. > Note: The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RemoveAssociatedUsers</maml:name> <maml:description> <maml:para>Indicates that this cmdlet removes the users that are associated with the Login object.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an SQL Server Management Objects (SMO) object that represents the Login object that this cmdlet removes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Login</command:parameterValue> <dev:type> <maml:name>Login</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="Name"> <maml:name>LoginName</maml:name> <maml:description> <maml:para>Specifies an array of names of Login objects that this cmdlet removes. > Note: The case sensitivity is the same as that of the instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server on which this cmdlet runs the operation. The default value is the current working directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RemoveAssociatedUsers</maml:name> <maml:description> <maml:para>Indicates that this cmdlet removes the users that are associated with the Login object.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Login</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>----------- Example 1: Remove a Login object by name -----------</maml:title> <dev:code>PS C:\> Get-SqlLogin -ServerInstance "MyServerInstance" -LoginName "Login01" | Remove-SqlLogin</dev:code> <dev:remarks> <maml:para>This command gets the Login object named `Login01` on the specified instance by using the Get-SqlLogin cmdlet. The command passes it to the current cmdlet by using the pipeline operator. That cmdlet removes the Login object.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 2: Remove objects that match a string --------</maml:title> <dev:code>PS C:\> Get-SqlLogin -ServerInstance "MyServerInstance" -LoginName 'Login.*' -Regex | Remove-SqlLogin -RemoveAssociatedUsers</dev:code> <dev:remarks> <maml:para>This command gets the Login objects that contain the string `Login. ` as a regular expression on the specified instance by using Get-SqlLogin *. The command passes it to the current cmdlet. That cmdlet removes the Login objects. The command removes associated users.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 3: Remove several Login objects -----------</maml:title> <dev:code>PS C:\> Remove-Login -ServerInstance "MyServerInstance" -LoginName "login01","login02","login03"</dev:code> <dev:remarks> <maml:para>This command removes the 3 Login objects named `login01`, `login02`, and `login03`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqllogin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlLogin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Remove-SqlSensitivityClassification</command:name> <command:verb>Remove</command:verb> <command:noun>SqlSensitivityClassification</command:noun> <maml:description> <maml:para>Remove the sensitivity label and/or information type of columns in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Remove-SqlSensitivityClassification cmdlet removes the sensitivity label and information type of columns in the database.</maml:para> <maml:para>The sensitivity labels and information types of columns can be set using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms)release 17.5 and above, or with the Set-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>The sensitivity labels and information types of columns can be viewed using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms) release 17.5 and above, the [Extended Properties catalog view](/sql/relational-databases/security/sql-data-discovery-and-classification?view=sql-server-2017#subheading-3), or the Get-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Remove-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifieseither the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Remove-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is fetched.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifieseither the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Remove sensitivity label and information type from a column using Windows authentication</maml:title> <dev:code>PS C:\> Remove-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -ColumnName "Sales.Customers.email"</dev:code> <dev:remarks> <maml:para>Remove the sensitivity label and information type of column `Sales.Customers.email` in `myDatabase`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Remove sensitivity label and information type from a column by providing a database path</maml:title> <dev:code>PS C:\> Remove-SqlSensitivityClassification -Path "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" -ColumnName "Sales.Customers.email"</dev:code> <dev:remarks> <maml:para>Remove the sensitivity label and information type of column `Sales.Customers.email` in `MyDatabase`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Remove sensitivity labels and information types on multiple columns using current path context</maml:title> <dev:code>PS C:\> $columns = @("Sales.Customers.ip_address" , "Sales.Customers.email") PS C:\> Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" PS SQLSERVER:\SQL\MyComputer\MainInstance> Remove-SqlSensitivityClassification -ColumnName $columns WARNING: Using provider context. Server = MyComputer, Database = MyDatabase.</dev:code> <dev:remarks> <maml:para>Remove the sensitivity labels and information types of columns `Sales.Customers.ip_address` and `Slaes.Customers.email` in `MyDatabase`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/remove-sqlsensitivityclassification</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>What's new in SSMS 17.5: Data Discovery and Classification</maml:linkText> <maml:uri>https://cloudblogs.microsoft.com/sqlserver/2018/02/20/whats-new-in-ssms-17-5-data-discovery-and-classification/</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQL Data Discovery and Classification</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Restore-SqlDatabase</command:name> <command:verb>Restore</command:verb> <command:noun>SqlDatabase</command:noun> <maml:description> <maml:para>Restores a database from a backup or transaction log records.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Restore-SqlDatabase cmdlet performs restore operations on a SQL Server database. This includes full database restores, transaction log restores, and database file restores.</maml:para> <maml:para>This cmdlet is modeled after the Microsoft.SqlServer.Management.Smo.Restore class. The parameters on this cmdlet generally correspond to properties on the Smo.Restore object.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Restore-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to restore. This cannot be used with the DatabaseObject parameter. When this parameter is used, the Path , InputObject , or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location or locations where the backup files are stored. This parameter is optional. If not specified, the default backup location of the server is searched for the name `<database name>.trn` for log restores, or `<database name>.bak` for all other types of restores. This parameter cannot be used with the BackupDevice parameter. If you are backing up to the Windows Azure Blob Storage service (URL), either this parameter or the BackupDevice parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutoRelocateFile</maml:name> <maml:description> <maml:para>When this switch is specified, the cmdlet will take care of automatically relocating all the the logical files in the backup, unless such logical file is specified with the RelocateFile . The server DefaultFile and DefaultLog are used to relocate the files.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are be stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to a tape device.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size, in bytes, for the backup. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the total number of I/O buffers to be used for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClearSuspectPageTable</maml:name> <maml:description> <maml:para>Indicates that the suspect page table is deleted after the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a timeout failure. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that contains the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies the database files targeted by the restore operation. This is only used when the RestoreAction parameter is set to Files. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the restore operation. This is only used when the RestoreAction parameter is set to File. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FileNumber</maml:name> <maml:description> <maml:para>Specifies the index number that is used to identify the targeted backup set on the backup medium.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepReplication</maml:name> <maml:description> <maml:para>Indicates that the replication configuration is preserved. If not set, the replication configuration is ignored by the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the SQL Server instance. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name that identifies a media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the database is restored into the restoring state. A roll back operation does not occur and additional backups can be restored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the restore is completed. If not set, the tape is rewound after the operation is completed. This does not apply to disk restores.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Offset</maml:name> <maml:description> <maml:para>Specifies the page addresses to be restored. This is only used when RestoreAction is set to OnlinePage.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Partial</maml:name> <maml:description> <maml:para>Indicates that the restore operation is a partial restore.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs the Smo.Backup object used to perform the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RelocateFile</maml:name> <maml:description> <maml:para>Specifies a list of Smo.Relocate file objects. Each object consists of a logical backup file name and a physical file system location. The restore moves the restored database into the specified physical location on the target server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RelocateFile[]</command:parameterValue> <dev:type> <maml:name>RelocateFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReplaceDatabase</maml:name> <maml:description> <maml:para>Indicates that a new image of the database is created. This overwrites any existing database with the same name. If not set, the restore operation will fail when a database with that name already exists on the server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet resumes a partially completed restore operation. If not set, the cmdlet restarts an interrupted restore operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestoreAction</maml:name> <maml:description> <maml:para>Specifies the type of restore operation that is performed. Valid values are:</maml:para> <maml:para>- Database. The database is restored. </maml:para> <maml:para>- Files. One or more data files are restored. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- OnlinePage. A data page is restored online so that the database remains available to users.</maml:para> <maml:para>- OnlineFiles. Data files are restored online so that the database remains available to users. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- Log. The translaction log is restored.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlinePage</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlineFiles</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">RestoreActionType</command:parameterValue> <dev:type> <maml:name>RestoreActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestrictedUser</maml:name> <maml:description> <maml:para>Indicates that access to the restored database is restricted to the db_owner fixed database role, and the dbcreator and sysadmin fixed server roles.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of a SQL Server instance. This server instance becomes the target of the restore operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StandbyFile</maml:name> <maml:description> <maml:para>Specifies the name of an undo file that is used as part of the imaging strategy for a SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with the mark name specified by the StopAtMarkName parameter to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction at which to stop the recovery operation. This is used with StopAtMarkAfterDate to determine the stopping point of the recovery operation. The recoverd data includes the transaction that contains the mark. If the StopAtMarkAfterDate value is not set, recovery stops at the first mark with the specified name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with StopBeforeMarkName to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction before which to stop the recovery operation. This is used with StopBeforeMarkAfterDate to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ToPointInTime</maml:name> <maml:description> <maml:para>Specifies the endpoint for database log restoration. This only applies when RestoreAction is set to Log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation is completed. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Restore-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to restore. This cannot be used with the DatabaseObject parameter. When this parameter is used, the Path , InputObject , or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location or locations where the backup files are stored. This parameter is optional. If not specified, the default backup location of the server is searched for the name `<database name>.trn` for log restores, or `<database name>.bak` for all other types of restores. This parameter cannot be used with the BackupDevice parameter. If you are backing up to the Windows Azure Blob Storage service (URL), either this parameter or the BackupDevice parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutoRelocateFile</maml:name> <maml:description> <maml:para>When this switch is specified, the cmdlet will take care of automatically relocating all the the logical files in the backup, unless such logical file is specified with the RelocateFile . The server DefaultFile and DefaultLog are used to relocate the files.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are be stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to a tape device.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size, in bytes, for the backup. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the total number of I/O buffers to be used for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClearSuspectPageTable</maml:name> <maml:description> <maml:para>Indicates that the suspect page table is deleted after the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies the database files targeted by the restore operation. This is only used when the RestoreAction parameter is set to Files. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the restore operation. This is only used when the RestoreAction parameter is set to File. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FileNumber</maml:name> <maml:description> <maml:para>Specifies the index number that is used to identify the targeted backup set on the backup medium.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepReplication</maml:name> <maml:description> <maml:para>Indicates that the replication configuration is preserved. If not set, the replication configuration is ignored by the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the SQL Server instance. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name that identifies a media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the database is restored into the restoring state. A roll back operation does not occur and additional backups can be restored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the restore is completed. If not set, the tape is rewound after the operation is completed. This does not apply to disk restores.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Offset</maml:name> <maml:description> <maml:para>Specifies the page addresses to be restored. This is only used when RestoreAction is set to OnlinePage.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Partial</maml:name> <maml:description> <maml:para>Indicates that the restore operation is a partial restore.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs the Smo.Backup object used to perform the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server instance on which to execute the restore operation. This parameter is optional. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RelocateFile</maml:name> <maml:description> <maml:para>Specifies a list of Smo.Relocate file objects. Each object consists of a logical backup file name and a physical file system location. The restore moves the restored database into the specified physical location on the target server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RelocateFile[]</command:parameterValue> <dev:type> <maml:name>RelocateFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReplaceDatabase</maml:name> <maml:description> <maml:para>Indicates that a new image of the database is created. This overwrites any existing database with the same name. If not set, the restore operation will fail when a database with that name already exists on the server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet resumes a partially completed restore operation. If not set, the cmdlet restarts an interrupted restore operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestoreAction</maml:name> <maml:description> <maml:para>Specifies the type of restore operation that is performed. Valid values are:</maml:para> <maml:para>- Database. The database is restored. </maml:para> <maml:para>- Files. One or more data files are restored. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- OnlinePage. A data page is restored online so that the database remains available to users.</maml:para> <maml:para>- OnlineFiles. Data files are restored online so that the database remains available to users. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- Log. The translaction log is restored.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlinePage</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlineFiles</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">RestoreActionType</command:parameterValue> <dev:type> <maml:name>RestoreActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestrictedUser</maml:name> <maml:description> <maml:para>Indicates that access to the restored database is restricted to the db_owner fixed database role, and the dbcreator and sysadmin fixed server roles.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StandbyFile</maml:name> <maml:description> <maml:para>Specifies the name of an undo file that is used as part of the imaging strategy for a SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with the mark name specified by the StopAtMarkName parameter to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction at which to stop the recovery operation. This is used with StopAtMarkAfterDate to determine the stopping point of the recovery operation. The recoverd data includes the transaction that contains the mark. If the StopAtMarkAfterDate value is not set, recovery stops at the first mark with the specified name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with StopBeforeMarkName to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction before which to stop the recovery operation. This is used with StopBeforeMarkAfterDate to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ToPointInTime</maml:name> <maml:description> <maml:para>Specifies the endpoint for database log restoration. This only applies when RestoreAction is set to Log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation is completed. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Restore-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to restore. This cannot be used with the DatabaseObject parameter. When this parameter is used, the Path , InputObject , or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location or locations where the backup files are stored. This parameter is optional. If not specified, the default backup location of the server is searched for the name `<database name>.trn` for log restores, or `<database name>.bak` for all other types of restores. This parameter cannot be used with the BackupDevice parameter. If you are backing up to the Windows Azure Blob Storage service (URL), either this parameter or the BackupDevice parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutoRelocateFile</maml:name> <maml:description> <maml:para>When this switch is specified, the cmdlet will take care of automatically relocating all the the logical files in the backup, unless such logical file is specified with the RelocateFile . The server DefaultFile and DefaultLog are used to relocate the files.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are be stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to a tape device.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size, in bytes, for the backup. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the total number of I/O buffers to be used for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClearSuspectPageTable</maml:name> <maml:description> <maml:para>Indicates that the suspect page table is deleted after the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies the database files targeted by the restore operation. This is only used when the RestoreAction parameter is set to Files. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the restore operation. This is only used when the RestoreAction parameter is set to File. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FileNumber</maml:name> <maml:description> <maml:para>Specifies the index number that is used to identify the targeted backup set on the backup medium.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance where the restore occurs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepReplication</maml:name> <maml:description> <maml:para>Indicates that the replication configuration is preserved. If not set, the replication configuration is ignored by the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the SQL Server instance. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name that identifies a media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the database is restored into the restoring state. A roll back operation does not occur and additional backups can be restored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the restore is completed. If not set, the tape is rewound after the operation is completed. This does not apply to disk restores.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Offset</maml:name> <maml:description> <maml:para>Specifies the page addresses to be restored. This is only used when RestoreAction is set to OnlinePage.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Partial</maml:name> <maml:description> <maml:para>Indicates that the restore operation is a partial restore.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs the Smo.Backup object used to perform the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RelocateFile</maml:name> <maml:description> <maml:para>Specifies a list of Smo.Relocate file objects. Each object consists of a logical backup file name and a physical file system location. The restore moves the restored database into the specified physical location on the target server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RelocateFile[]</command:parameterValue> <dev:type> <maml:name>RelocateFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReplaceDatabase</maml:name> <maml:description> <maml:para>Indicates that a new image of the database is created. This overwrites any existing database with the same name. If not set, the restore operation will fail when a database with that name already exists on the server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet resumes a partially completed restore operation. If not set, the cmdlet restarts an interrupted restore operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestoreAction</maml:name> <maml:description> <maml:para>Specifies the type of restore operation that is performed. Valid values are:</maml:para> <maml:para>- Database. The database is restored. </maml:para> <maml:para>- Files. One or more data files are restored. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- OnlinePage. A data page is restored online so that the database remains available to users.</maml:para> <maml:para>- OnlineFiles. Data files are restored online so that the database remains available to users. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- Log. The translaction log is restored.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlinePage</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlineFiles</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">RestoreActionType</command:parameterValue> <dev:type> <maml:name>RestoreActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestrictedUser</maml:name> <maml:description> <maml:para>Indicates that access to the restored database is restricted to the db_owner fixed database role, and the dbcreator and sysadmin fixed server roles.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StandbyFile</maml:name> <maml:description> <maml:para>Specifies the name of an undo file that is used as part of the imaging strategy for a SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with the mark name specified by the StopAtMarkName parameter to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction at which to stop the recovery operation. This is used with StopAtMarkAfterDate to determine the stopping point of the recovery operation. The recoverd data includes the transaction that contains the mark. If the StopAtMarkAfterDate value is not set, recovery stops at the first mark with the specified name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with StopBeforeMarkName to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction before which to stop the recovery operation. This is used with StopBeforeMarkAfterDate to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ToPointInTime</maml:name> <maml:description> <maml:para>Specifies the endpoint for database log restoration. This only applies when RestoreAction is set to Log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation is completed. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Restore-SqlDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>DatabaseObject</maml:name> <maml:description> <maml:para>Specifies a database object for the restore operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location or locations where the backup files are stored. This parameter is optional. If not specified, the default backup location of the server is searched for the name `<database name>.trn` for log restores, or `<database name>.bak` for all other types of restores. This parameter cannot be used with the BackupDevice parameter. If you are backing up to the Windows Azure Blob Storage service (URL), either this parameter or the BackupDevice parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutoRelocateFile</maml:name> <maml:description> <maml:para>When this switch is specified, the cmdlet will take care of automatically relocating all the the logical files in the backup, unless such logical file is specified with the RelocateFile . The server DefaultFile and DefaultLog are used to relocate the files.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are be stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to a tape device.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size, in bytes, for the backup. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the total number of I/O buffers to be used for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClearSuspectPageTable</maml:name> <maml:description> <maml:para>Indicates that the suspect page table is deleted after the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies the database files targeted by the restore operation. This is only used when the RestoreAction parameter is set to Files. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the restore operation. This is only used when the RestoreAction parameter is set to File. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FileNumber</maml:name> <maml:description> <maml:para>Specifies the index number that is used to identify the targeted backup set on the backup medium.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepReplication</maml:name> <maml:description> <maml:para>Indicates that the replication configuration is preserved. If not set, the replication configuration is ignored by the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the SQL Server instance. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name that identifies a media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the database is restored into the restoring state. A roll back operation does not occur and additional backups can be restored.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the restore is completed. If not set, the tape is rewound after the operation is completed. This does not apply to disk restores.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Offset</maml:name> <maml:description> <maml:para>Specifies the page addresses to be restored. This is only used when RestoreAction is set to OnlinePage.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Partial</maml:name> <maml:description> <maml:para>Indicates that the restore operation is a partial restore.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs the Smo.Backup object used to perform the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RelocateFile</maml:name> <maml:description> <maml:para>Specifies a list of Smo.Relocate file objects. Each object consists of a logical backup file name and a physical file system location. The restore moves the restored database into the specified physical location on the target server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RelocateFile[]</command:parameterValue> <dev:type> <maml:name>RelocateFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReplaceDatabase</maml:name> <maml:description> <maml:para>Indicates that a new image of the database is created. This overwrites any existing database with the same name. If not set, the restore operation will fail when a database with that name already exists on the server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet resumes a partially completed restore operation. If not set, the cmdlet restarts an interrupted restore operation at the beginning of the backup set.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestoreAction</maml:name> <maml:description> <maml:para>Specifies the type of restore operation that is performed. Valid values are:</maml:para> <maml:para>- Database. The database is restored. </maml:para> <maml:para>- Files. One or more data files are restored. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- OnlinePage. A data page is restored online so that the database remains available to users.</maml:para> <maml:para>- OnlineFiles. Data files are restored online so that the database remains available to users. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- Log. The translaction log is restored.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Database</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Files</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlinePage</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnlineFiles</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Log</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">RestoreActionType</command:parameterValue> <dev:type> <maml:name>RestoreActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestrictedUser</maml:name> <maml:description> <maml:para>Indicates that access to the restored database is restricted to the db_owner fixed database role, and the dbcreator and sysadmin fixed server roles.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the restore operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StandbyFile</maml:name> <maml:description> <maml:para>Specifies the name of an undo file that is used as part of the imaging strategy for a SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with the mark name specified by the StopAtMarkName parameter to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction at which to stop the recovery operation. This is used with StopAtMarkAfterDate to determine the stopping point of the recovery operation. The recoverd data includes the transaction that contains the mark. If the StopAtMarkAfterDate value is not set, recovery stops at the first mark with the specified name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with StopBeforeMarkName to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction before which to stop the recovery operation. This is used with StopBeforeMarkAfterDate to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ToPointInTime</maml:name> <maml:description> <maml:para>Specifies the endpoint for database log restoration. This only applies when RestoreAction is set to Log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation is completed. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk backups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutoRelocateFile</maml:name> <maml:description> <maml:para>When this switch is specified, the cmdlet will take care of automatically relocating all the the logical files in the backup, unless such logical file is specified with the RelocateFile . The server DefaultFile and DefaultLog are used to relocate the files.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupDevice</maml:name> <maml:description> <maml:para>Specifies the devices where the backups are be stored. This parameter cannot be used with the BackupFile parameter. Use this parameter if you are backing up to a tape device.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupDeviceItem[]</command:parameterValue> <dev:type> <maml:name>BackupDeviceItem[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>BackupFile</maml:name> <maml:description> <maml:para>Specifies the location or locations where the backup files are stored. This parameter is optional. If not specified, the default backup location of the server is searched for the name `<database name>.trn` for log restores, or `<database name>.bak` for all other types of restores. This parameter cannot be used with the BackupDevice parameter. If you are backing up to the Windows Azure Blob Storage service (URL), either this parameter or the BackupDevice parameter must be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BlockSize</maml:name> <maml:description> <maml:para>Specifies the physical block size, in bytes, for the backup. The supported sizes are 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536 (64 KB) bytes. The default is 65536 for tape devices and 512 for all other devices.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BufferCount</maml:name> <maml:description> <maml:para>Specifies the total number of I/O buffers to be used for the backup operation. You can specify any positive integer. If there is insufficient virtual address space in the Sqlservr.exe process for the buffers, you will receive an out of memory error.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Checksum</maml:name> <maml:description> <maml:para>Indicates that a checksum value is calculated during the restore operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ClearSuspectPageTable</maml:name> <maml:description> <maml:para>Indicates that the suspect page table is deleted after the restore operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a timeout failure. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not timeout.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ContinueAfterError</maml:name> <maml:description> <maml:para>Indicates that the operation continues when a checksum error occurs. If not set, the operation will fail after a checksum error.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object that contains the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>Specifies the name of the database to restore. This cannot be used with the DatabaseObject parameter. When this parameter is used, the Path , InputObject , or ServerInstance parameters must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFile</maml:name> <maml:description> <maml:para>Specifies the database files targeted by the restore operation. This is only used when the RestoreAction parameter is set to Files. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseFileGroup</maml:name> <maml:description> <maml:para>Specifies the database file groups targeted by the restore operation. This is only used when the RestoreAction parameter is set to File. When the RestoreAction parameter is set to Files, either the DatabaseFileGroups or DatabaseFiles parameter must also be specified.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>DatabaseObject</maml:name> <maml:description> <maml:para>Specifies a database object for the restore operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FileNumber</maml:name> <maml:description> <maml:para>Specifies the index number that is used to identify the targeted backup set on the backup medium.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the SQL Server instance where the restore occurs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepReplication</maml:name> <maml:description> <maml:para>Indicates that the replication configuration is preserved. If not set, the replication configuration is ignored by the restore operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxTransferSize</maml:name> <maml:description> <maml:para>Specifies the maximum number of bytes to be transferred between the backup media and the SQL Server instance. The possible values are multiples of 65536 bytes (64 KB), up to 4194304 bytes (4 MB).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MediaName</maml:name> <maml:description> <maml:para>Specifies the name that identifies a media set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRecovery</maml:name> <maml:description> <maml:para>Indicates that the database is restored into the restoring state. A roll back operation does not occur and additional backups can be restored.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRewind</maml:name> <maml:description> <maml:para>Indicates that a tape drive is left open at the ending position when the restore is completed. If not set, the tape is rewound after the operation is completed. This does not apply to disk restores.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Offset</maml:name> <maml:description> <maml:para>Specifies the page addresses to be restored. This is only used when RestoreAction is set to OnlinePage.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int64[]</command:parameterValue> <dev:type> <maml:name>Int64[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Partial</maml:name> <maml:description> <maml:para>Indicates that the restore operation is a partial restore.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>PassThru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs the Smo.Backup object used to perform the restore operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server instance on which to execute the restore operation. This parameter is optional. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RelocateFile</maml:name> <maml:description> <maml:para>Specifies a list of Smo.Relocate file objects. Each object consists of a logical backup file name and a physical file system location. The restore moves the restored database into the specified physical location on the target server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RelocateFile[]</command:parameterValue> <dev:type> <maml:name>RelocateFile[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReplaceDatabase</maml:name> <maml:description> <maml:para>Indicates that a new image of the database is created. This overwrites any existing database with the same name. If not set, the restore operation will fail when a database with that name already exists on the server.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Restart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet resumes a partially completed restore operation. If not set, the cmdlet restarts an interrupted restore operation at the beginning of the backup set.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestoreAction</maml:name> <maml:description> <maml:para>Specifies the type of restore operation that is performed. Valid values are:</maml:para> <maml:para>- Database. The database is restored. </maml:para> <maml:para>- Files. One or more data files are restored. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- OnlinePage. A data page is restored online so that the database remains available to users.</maml:para> <maml:para>- OnlineFiles. Data files are restored online so that the database remains available to users. The DatabaseFile or DatabaseFileGroup parameter must be specified.</maml:para> <maml:para>- Log. The translaction log is restored.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">RestoreActionType</command:parameterValue> <dev:type> <maml:name>RestoreActionType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RestrictedUser</maml:name> <maml:description> <maml:para>Indicates that access to the restored database is restricted to the db_owner fixed database role, and the dbcreator and sysadmin fixed server roles.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the restore operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of a SQL Server instance. This server instance becomes the target of the restore operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies an SQL Server credential object that stores authentication information. If you are backing up to Blob storage service, you must specify this parameter. The authentication information stored includes the Storage account name and the associated access key values. Do not specify this parameter for disk or tape.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StandbyFile</maml:name> <maml:description> <maml:para>Specifies the name of an undo file that is used as part of the imaging strategy for a SQL Server instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with the mark name specified by the StopAtMarkName parameter to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopAtMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction at which to stop the recovery operation. This is used with StopAtMarkAfterDate to determine the stopping point of the recovery operation. The recoverd data includes the transaction that contains the mark. If the StopAtMarkAfterDate value is not set, recovery stops at the first mark with the specified name.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkAfterDate</maml:name> <maml:description> <maml:para>Specifies the date to be used with StopBeforeMarkName to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>StopBeforeMarkName</maml:name> <maml:description> <maml:para>Specifies the marked transaction before which to stop the recovery operation. This is used with StopBeforeMarkAfterDate to determine the stopping point of the recovery operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ToPointInTime</maml:name> <maml:description> <maml:para>Specifies the endpoint for database log restoration. This only applies when RestoreAction is set to Log.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UnloadTapeAfter</maml:name> <maml:description> <maml:para>Indicates that the tape device is rewound and unloaded when the operation is completed. If not set, no attempt is made to rewind and unload the tape medium. This does not apply to disk backups.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para>Specifies an SMO.Server object that describes the SQL Server instance on which the restore operation occurs.</maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Restore a database from a backup file on a network share</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.bak"</dev:code> <dev:remarks> <maml:para>This command restores the full database `MainDB` from the file `\mainserver\databasebackup\MainDB.bak` to the server instance `Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 2: Restore a database transaction log --------</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.trn" -RestoreAction Log</dev:code> <dev:remarks> <maml:para>This command restores the transaction log for the database `MainDB` from the file `\mainserver\databasebackup\MainDB.trn` to the server instance `Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 3: Restore a database and prompt for a password ---</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.bak" -Credential (Get-Credential "sa")</dev:code> <dev:remarks> <maml:para>This command restores the full database `MainDB` from the file `\mainserver\databasebackup\MainDB.bak` to the server instance `Computer\Instance`, using the `sa` SQL login. This command will prompt you for a password to complete the authentication.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Restore a transaction log with the NORECOVERY option</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.trn" -RestoreAction Log -NoRecovery</dev:code> <dev:remarks> <maml:para>This command restores the transaction log of the database `MainDB` with the `NORECOVERY` option from the file `\mainserver\databasebackup\MainDB.trn` to the server instance `Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Restore transaction log records up to a point in time</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.trn" -RestoreAction Log -ToPointInTime "Sep 21, 2017 11:11 PM"</dev:code> <dev:remarks> <maml:para>This command restores the transaction log of the database `MainDB` up to the date passed to the ToPointInTime parameter, Sep 21, 2017 11:11 PM.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 6: Restore a database and relocate the data and log files</maml:title> <dev:code>PS C:\> $RelocateData = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("MainDB_Data", "c:\MySQLServer\MainDB.mdf") PS C:\> $RelocateLog = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("MainDB_Log", "c:\MySQLServer\MainDB.ldf") PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "\\mainserver\databasebackup\MainDB.trn" -RelocateFile @($RelocateData,$RelocateLog)</dev:code> <dev:remarks> <maml:para>This example restores the full database `MainDB` to the server instance `Computer\Instance`, and relocates the data and log files. For each file that is moved, the example constructs an instance of the Microsoft.SqlServer.Management.Smo.RelocateFile class. Each constructor takes two arguments, the logical name of the file and the physical location where the file will be placed on the target server. The RelocateFile objects are passed to the RelocateFile parameter of the Restore-SqlDatabase cmdlet.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----------- Example 7: Restore a database from tape -----------</maml:title> <dev:code>PS C:\> $TapeDevice = New-Object Microsoft.Sqlserver.Management.Smo.BackupDeviceItem("\\.\tape0", "Tape") PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupDevice $TapeDevice</dev:code> <dev:remarks> <maml:para>This example restores the database `MainDB` from the tape device named `\.\tape0` to the server instance `Computer\Instance`. To represent this device, the example constructs an instance of the Microsoft.Sqlserver.Management.Smo.BackupDeviceItem class. The constructor takes two arguments, the name of the backup device and the type of the backup device. This BackupDeviceItem object is then passed to the BackupDevice parameter of the Restore-SqlDatabase cmdlet.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 8: Restore a database from the Azure Blob Storage service</maml:title> <dev:code>PS C:\> Restore-SqlDatabase -ServerInstance "Computer\Instance" -Database "MainDB" -BackupFile "https://mystorageaccountname.blob.core.windows.net/container/MyDB.bak" -SqlCredential "mySqlCredential"</dev:code> <dev:remarks> <maml:para>This command restores the full database `MainDB` from the file on the Windows Azure Blob Storage service to the server instance `Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 9: Backup a database on SQL2016 and restore on SQL2017 using -AutoRelocateFile</maml:title> <dev:code>PS C:\> Get-SqlDatabase -ServerInstance MYSERVER\SQL2016 -Database AdventureWorks | Backup-SqlDatabase -BackupFile 'C:\BAK2\AdventureWorks.bak' PS C:\> $restore = Restore-SqlDatabase -ServerInstance MYSERVER\SQL2017 -Database AdventureWorks2016 -BackupFile 'C:\BAK2\AdventureWorks.bak' -AutoRelocateFile -PassThru PS C:\> $db.RelocateFiles LogicalFileName PhysicalFileName --------------- ---------------- AdventureWorks_Data C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\DATA\AdventureWorks_Data.mdf AdventureWorks_Log C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\DATA\AdventureWorks_Log.ldf # You can see that the original PhysicalFileNames were indeed differet by running the followiong query: PS C:\> Invoke-Sqlcmd -ServerInstance MYSERVER\SQL2016 -Query "RESTORE FILELISTONLY FROM DISK = N'C:\BAK2\AdventureWorks.bak' WITH NOUNLOAD" | Select -Property LogicalName,PhysicalName LogicalName PhysicalName ----------- ------------ AdventureWorks_Data C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\DATA\AdventureWorks_Data.mdf AdventureWorks_Log C:\Program Files\Microsoft SQL Server\MSSQL13.SQL2016\MSSQL\DATA\AdventureWorks_Log.ldf</dev:code> <dev:remarks> <maml:para>The first command takes a backup of database AdventureWorks on SQL2016 instance running on machine MYSERVER . The backup is saved under C:\BAK2 .</maml:para> <maml:para>The same backup file is used in the second cmdlet to restore the database on a SQL2017 instance running on the same machine ( MYSERVER ). Notice that without the -AutoRelocate switch, the cmdlet would have failed because physical files where different, as shown in the two tables above (furthermore, most likely the files would have been in use by SQL2016 and possibly not accessible by SQL2017). The -AutoRelocate allowed the user to avoid having to explicit use the -RelocationFile , the argument to which is quite tedious to build.</maml:para> <maml:para></maml:para> <maml:para></maml:para> <maml:para>Note: there is an assumption that both the SQL2016 instance and SQL2017 instance have access to the C:\BAK2 folder.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/restore-sqldatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Backup-SqlDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Resume-SqlAvailabilityDatabase</command:name> <command:verb>Resume</command:verb> <command:noun>SqlAvailabilityDatabase</command:noun> <maml:description> <maml:para>Resumes data movement on an availability database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Resume-SqlAvailabilityDatabase cmdlet resumes data movement on an availability database. If you resume synchronization for a primary database, data movement resumes on the corresponding secondary databases. If you resume a particular secondary database, only that database is affected.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Resume-SqlAvailabilityDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet resumes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Resume-SqlAvailabilityDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet resumes. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet resumes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet resumes. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityDatabase[]</maml:name> </dev:type> <maml:description> <maml:para>You can pass an availability database to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------- Example 1: Resume synchronization for a database -------</maml:title> <dev:code>PS C:\> Resume-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16"</dev:code> <dev:remarks> <maml:para>This command resumes data synchronization for the availability database named `Database16` in the availability group named `MainAG`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 2: Resume synchronization for all databases -----</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases" | Resume-SqlAvailabilityDatabase</dev:code> <dev:remarks> <maml:para>This command gets all the availability databases that belong to `MainAG`, and then passes them to the current cmdlet by using the pipeline operator. The current cmdlet resumes synchronization for each availability database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------- Example 3: Create a script to resume a database -------</maml:title> <dev:code>PS C:\> Resume-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that resumes database synchronization for the availability database named `Database16` in the availability group named `MainAG`. The command does not perform this action.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/resume-sqlavailabilitydatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Suspend-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Revoke-SqlAvailabilityGroupCreateAnyDatabase</command:name> <command:verb>Revoke</command:verb> <command:noun>SqlAvailabilityGroupCreateAnyDatabase</command:noun> <maml:description> <maml:para>Revokes the `CREATE ANY DATABASE` permission on an Always On Availability Group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>Revokes the `CREATE ANY DATABASE` permission on an Always On Availability Group.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Revoke-SqlAvailabilityGroupCreateAnyDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the target Availability Group object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Revoke-SqlAvailabilityGroupCreateAnyDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Availability Group on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the target Availability Group object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the Availability Group on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: How to revoke the privilege ------------</maml:title> <dev:code>PS C:\> Revoke-SqlAvailabilityGroupCreateAnyDatabase -Path 'SQLSERVER:\SQL\MYSERVER\MYINSTANCE\AvailabilityGroupS\AG1'</dev:code> <dev:remarks> <maml:para>This example shows how to use the cmdlet to revoke CREATE ANY DATABASE permission for the Availability Group `AG1` on SQL Server `MYSERVER` (instance name `MYINSTANCE`)</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/revoke-sqlavailabilitygroupcreateanydatabase</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Save-SqlMigrationReport</command:name> <command:verb>Save</command:verb> <command:noun>SqlMigrationReport</command:noun> <maml:description> <maml:para>Generates In-Memory OLTP Migration Checklist</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Save-SqlMigrationReport generates an In-Memory OLTP Migration Checklist.</maml:para> <maml:para>This informs you about which tables in your database will benefit if ported to use In-Memory OLTP. After you identify a table that you would like to port to use In-Memory OLTP, you can use the memory optimization advisor in SQL Server Management Studio to help you migrate the disk-based table to a memory-optimized table. </maml:para> <maml:para>`Note: This cmdlet is only available for PowerShell 5 (v21). It is not longer available in v22+ of the SQLServer module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Save-SqlMigrationReport</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>The name of the databased for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>A path to a folder where the report files will be saved to. Report files will be organized under a folder with the same name as the the value of the Database parameter nested under either a `Stored Procedure` or `Tables` folder, depending on the type of the object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The object (either a Database, a Table, or a Stored Procedure SMO object) on which to generate the report.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlSmoObject</command:parameterValue> <dev:type> <maml:name>SqlSmoObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MigrationType</maml:name> <maml:description> <maml:para>The type of the migration. Currently, only `OLTP` is supported.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">OLTP</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">MigrationType</command:parameterValue> <dev:type> <maml:name>MigrationType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Object</maml:name> <maml:description> <maml:para>The name of the object (Table or Stored Procedure) for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Password</maml:name> <maml:description> <maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in the Username parameter. Passwords are case-sensitive. When possible, use Windows Authentication. Do not use a blank password, when possible use a strong password.</maml:para> <maml:para>If you specify the Password parameter followed by your password, the password is visible to anyone who can see your monitor.</maml:para> <maml:para>If you code Password followed by your password in a .ps1 script, anyone reading the script file will see your password.</maml:para> <maml:para>Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Schema</maml:name> <maml:description> <maml:para>The schema of the object (Table or Stored Procedure) for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Server</maml:name> <maml:description> <maml:para>The name of server to connect to (either MYCOMPUTER or MYCOMPUTER\MYINSTANCE).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Username</maml:name> <maml:description> <maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine.</maml:para> <maml:para>The password must be specified through the Password parameter.</maml:para> <maml:para>If Username and Password are not specified, this cmdlet attempts a Windows Authentication connection using the Windows account running the Windows PowerShell session. When possible, use Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Database</maml:name> <maml:description> <maml:para>The name of the databased for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FolderPath</maml:name> <maml:description> <maml:para>A path to a folder where the report files will be saved to. Report files will be organized under a folder with the same name as the the value of the Database parameter nested under either a `Stored Procedure` or `Tables` folder, depending on the type of the object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>The object (either a Database, a Table, or a Stored Procedure SMO object) on which to generate the report.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlSmoObject</command:parameterValue> <dev:type> <maml:name>SqlSmoObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MigrationType</maml:name> <maml:description> <maml:para>The type of the migration. Currently, only `OLTP` is supported.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">MigrationType</command:parameterValue> <dev:type> <maml:name>MigrationType</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Object</maml:name> <maml:description> <maml:para>The name of the object (Table or Stored Procedure) for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Password</maml:name> <maml:description> <maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in the Username parameter. Passwords are case-sensitive. When possible, use Windows Authentication. Do not use a blank password, when possible use a strong password.</maml:para> <maml:para>If you specify the Password parameter followed by your password, the password is visible to anyone who can see your monitor.</maml:para> <maml:para>If you code Password followed by your password in a .ps1 script, anyone reading the script file will see your password.</maml:para> <maml:para>Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Schema</maml:name> <maml:description> <maml:para>The schema of the object (Table or Stored Procedure) for which the report is going to be generated.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Server</maml:name> <maml:description> <maml:para>The name of server to connect to (either MYCOMPUTER or MYCOMPUTER\MYINSTANCE).</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Username</maml:name> <maml:description> <maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine.</maml:para> <maml:para>The password must be specified through the Password parameter.</maml:para> <maml:para>If Username and Password are not specified, this cmdlet attempts a Windows Authentication connection using the Windows account running the Windows PowerShell session. When possible, use Windows Authentication.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes /> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-------------------------- Example 1 --------------------------</maml:title> <dev:code>PS C:\> Save-SqlMigrationReport -Server 'MySQLServer' -Database 'MyDB' -FolderPath 'C:\MigrationReports'</dev:code> <dev:remarks> <maml:para>This command will generate a report for all tables and stored procedures in database `MyDb` on server `MySQLServer`. Report file (.html format) will be created for each database object and saved under `C:\MigrationReports\MyDB` either under `Stored Procedure` or `Tables`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 2 --------------------------</maml:title> <dev:code>PS C:\> $db = Get-Item 'SQLSERVER:\SQL\MySQLServer\DEFAULT\Databases\MyDB' PS C:\> Save-SqlMigrationReport -FolderPath 'C:\MigrationReports' -InputObject $db</dev:code> <dev:remarks> <maml:para>This command will generate the same report as Example 1; the InputObject is passed explicitly and encapsulate both the information about the server and the database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------------------- Example 3 --------------------------</maml:title> <dev:code>PS C:\> CD 'SQLSERVER:\SQL\MySQLServer\DEFAULT\Databases\MyDB' PS SQLSERVER:\SQL\MySQLServer\DEFAULT\Databases\MyDB> Save-SqlMigrationReport -FolderPath 'C:\MigrationReports'</dev:code> <dev:remarks> <maml:para>This command will generate the same report as Example 1 and 2. Note that the InputObject is inferred from the context, i.e. the current working directory.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/save-sqlmigrationreport</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlAuthenticationMode</command:name> <command:verb>Set</command:verb> <command:noun>SqlAuthenticationMode</command:noun> <maml:description> <maml:para>Configures the authentication mode of the target instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlAuthenticationMode cmdlet configures the authentication mode of the target instance of SQL Server.</maml:para> <maml:para>SQL ServerCloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation:</maml:para> <maml:para>- Specify the instance Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlAuthenticationMode</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Mode</maml:name> <maml:description> <maml:para>Specifies the authentication mode that will be configured on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Normal</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Integrated</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Mixed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ServerLoginMode</command:parameterValue> <dev:type> <maml:name>ServerLoginMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the administrator credentials that is created in the target instance of SQL Server if Mixed mode authentication is enabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object, as an array, of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAuthenticationMode</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Mode</maml:name> <maml:description> <maml:para>Specifies the authentication mode that will be configured on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Normal</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Integrated</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Mixed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ServerLoginMode</command:parameterValue> <dev:type> <maml:name>ServerLoginMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the administrator credentials that is created in the target instance of SQL Server if Mixed mode authentication is enabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as an array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAuthenticationMode</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Mode</maml:name> <maml:description> <maml:para>Specifies the authentication mode that will be configured on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Normal</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Integrated</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Mixed</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">ServerLoginMode</command:parameterValue> <dev:type> <maml:name>ServerLoginMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the administrator credentials that is created in the target instance of SQL Server if Mixed mode authentication is enabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object, as an array, of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter should be used when the ports of the target computer are not directly accessible but are exposed through endpoints, which means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Mode</maml:name> <maml:description> <maml:para>Specifies the authentication mode that will be configured on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ServerLoginMode</command:parameterValue> <dev:type> <maml:name>ServerLoginMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as an array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet defaults to the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the administrator credentials that is created in the target instance of SQL Server if Mixed mode authentication is enabled.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Configure the SQL Server authentication mode ---</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance; PS SQLSERVER:\SQL\Computer\Instance> Set-SqlAuthenticationMode -Credential $Credential -Mode Integrated -ForceServiceRestart -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Configure the SQL Server authentication mode on all SQL Server instances</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer005" | Set-SqlAuthenticationMode -Credential $Credential -Mode Mixed -SqlCredential $sqlCredential -NoServiceRestart -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server on the computer named `Computer005` and configures the authentication mode to `Mixed`, with the provided SQL credentials for each one of them. The SQL Server service is not restarted automatically. The self-signed certificate of the target machine is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlauthenticationmode</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlAvailabilityGroup</command:name> <command:verb>Set</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Sets settings on an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlAvailabilityGroup cmdlet modifies settings on an existing availability group in Always On Availability Groups. You can modify the automated backup preference, the failure condition level, and the health check timeout. You must run this cmdlet on the server instance that hosts the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Primary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SecondaryOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Secondary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, wich includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">OnServerDown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnServerUnresponsive</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnCriticalServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnModerateServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnAnyQualifiedFailureCondition</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On Availability Groups declares an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAvailabilityGroup</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability database that cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Primary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SecondaryOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Secondary</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, wich includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">OnServerDown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnServerUnresponsive</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnCriticalServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnModerateServerErrors</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">OnAnyQualifiedFailureCondition</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On Availability Groups declares an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomatedBackupPreference</maml:name> <maml:description> <maml:para>Specifies the automated backup preference for the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- Primary. Specifies that the backups always occur on the primary replica. This option supports the use of features not available when backup runs on a secondary replica, such as differential backups. - SecondaryOnly. Specifies that backups are never performed on primary replicas. If the primary replica is the only replica online, the backup does not occur. - Secondary. Specifies that backups occur on secondary replicas, unless the primary replica is the only replica online. Then the backup occurs on the primary replica. - None. Specifies that the primary or secondary status is not taken into account when deciding which replica performs backups. Instead, backup priority and online status determine which replica performs backups.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupAutomatedBackupPreference</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupAutomatedBackupPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseHealthTrigger</maml:name> <maml:description> <maml:para>Specifies whether to trigger an automatic failover of the availability group if any user database replica within an availability group encounters a database failure condition.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailureConditionLevel</maml:name> <maml:description> <maml:para>Specifies the automatic failover behavior of the availability group. The acceptable values for this parameter are:</maml:para> <maml:para>- OnServerDown. Failover or restart if the SQL Server service stops.</maml:para> <maml:para>- OnServerUnresponsive. Failover or restart if any condition of lower value is satisfied, plus when the SQL Server</maml:para> <maml:para> service is connected to the cluster and the HealthCheckTimeout threshold is exceeded, or if the availability replica currently in primary role is in a failed state. - OnCriticalServerError. Failover or restart if any condition of lower value is satisfied, plus when an internal critical server error occurs, which include out of memory condition, serious write-access violation, or too much dumping. - OnModerateServerError. Failover or restart if any condition of lower value is satisfied, plus if a moderate Server error occurs, wich includes persistent out of memory condition. - OnAnyQualifiedFailureConditions. Failover or restart if any condition of lower value is satisfied, plus if a qualifying failure condition occurs, which includes engine worker thread exhaustion and unsolvable deadlock detected.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupFailureConditionLevel</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupFailureConditionLevel</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HealthCheckTimeout</maml:name> <maml:description> <maml:para>Specifies the length of time, in milliseconds, after which Always On Availability Groups declares an unresponsive server to be unhealthy.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability database that cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RequiredSynchronizedSecondariesToCommit</maml:name> <maml:description> <maml:para>The number of synchronous commit secondaries that must be available to be able to commit on the primary.</maml:para> <maml:para>If a `SYNCHRONOUS_COMMIT` secondary is disconnected from the primary for some time, the primary demotes it to `ASYNCHRONOUS_COMMIT` to avoid blocking commits. If the primary then becomes unavailable and the user wishes to fail over to one of these secondaries, they may incur data loss. By setting RequiredSynchronizedSecondariesToCommit to some number, the user can prevent the data loss since the primary will start blocking commits if too many secondaries are demoted to `ASYNCHRONOUS_COMMIT`.</maml:para> <maml:para>The default value of this setting is 0, which means the primary will never block commits. This is identical to the behavior before SQL Server 2017.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>0</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Change the health check timeout period ------</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MAinAG" -HealthCheckTimeout 120000</dev:code> <dev:remarks> <maml:para>This command changes the health check timeout property on the availability group named `MainAG` to `120` seconds, or two minutes. If automatic failover is enabled, after this length of time, Always On Availability Groups initiates an automatic failover will be initiated.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 2: Change automated backup preference --------</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -AutomatedBackupPreference SecondaryOnly</dev:code> <dev:remarks> <maml:para>This command changes the automated backup preference on the availability group named `MainAG` to be `SecondaryOnly`. Automated backups of databases in this availability group do not occur on the primary replica. Instead, automated backups occur on the secondary replica that has the highest backup priority.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 3: Change the failure condition level --------</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG" -FailureConditionLevel OnServerDown</dev:code> <dev:remarks> <maml:para>This command changes the failure condition level on the availability group named `MainAG` to be `OnServerDown`. If the server instance that hosts the primary replica goes offline and if automatic failover is enabled, Always On Availability Groups starts an automatic failover.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Change the number of `SYNCHRONOUS_COMMIT` secondaries that must be available for transactions to commit on the primary</maml:title> <dev:code># Get server and AG PS C:\> CD 'SQLSERVER:\SQL\some-hostname\Default' PS SQLSERVER:\SQL\some-hostname\Default> $server = Get-Item $PWD PS SQLSERVER:\SQL\some-hostname\Default> $ag = $server.AvailabilityGroups[0] # Alter AG with RequiredCopiesToCommit = 4 PS SQLSERVER:\SQL\some-hostname\Default> $ag | Set-SqlAvailabilityGroup -RequiredSynchronizedSecondariesToCommit 4 Note: an exception will be thrown if the -RequiredSynchronizedSecondariesToCommit parameter is used when the target server version is SQL Server 2016 or lower.</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Join-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Switch-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlAvailabilityGroupListener</command:name> <command:verb>Set</command:verb> <command:noun>SqlAvailabilityGroupListener</command:noun> <maml:description> <maml:para>Sets the port setting on an availability group listener.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlAvailabilityGroupListener cmdlet modifies the port setting on an existing availability group listener. Run this cmdlet on the server instance that hosts the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlAvailabilityGroupListener</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupListener</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupListener</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAvailabilityGroupListener</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group listener that this cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroupListener</command:parameterValue> <dev:type> <maml:name>AvailabilityGroupListener</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group listener that this cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port on which the listener listens for connections. The default port is TCP port 1433.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroupListener</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: Modify a listener for an availability group ----</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityGroupListener -Port 1535 -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener"</dev:code> <dev:remarks> <maml:para>This command sets the port number for the availability group listener named `MainListener` to be `1535`. This port is used to listen for connections to the listener.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 2: Create a script that modifies a listener -----</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityGroupListener -Port 1535 -Script -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener"</dev:code> <dev:remarks> <maml:para>This command generates the Transact-SQL script that sets the port number for the availability group listener named `MainListener` to `1535`. This command does not make that change.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlavailabilitygrouplistener</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityGroupListenerStaticIp</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroupListener</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlAvailabilityReplica</command:name> <command:verb>Set</command:verb> <command:noun>SqlAvailabilityReplica</command:noun> <maml:description> <maml:para>Sets the settings on an availability replica.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlAvailabilityReplica cmdlet sets or modifies a variety of properties for an availability replica. Run this cmdlet on the server instance that hosts the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which the replica belongs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AsynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ConfigurationOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> <maml:para>A value of zero (0) indicates that the replica is not a candidate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadWriteConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections.</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowNoConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadIntentConnectionsOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form: `TCP://system-address:port`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read-only connections, as in the following example: `TCP://DBSERVER8.manufacturing.Contoso.com:7024`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAvailabilityReplica</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AsynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SynchronousCommit</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">ConfigurationOnly</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> <maml:para>A value of zero (0) indicates that the replica is not a candidate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadWriteConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections.</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">AllowNoConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowReadIntentConnectionsOnly</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AllowAllConnections</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form: `TCP://system-address:port`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">External</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Unknown</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read-only connections, as in the following example: `TCP://DBSERVER8.manufacturing.Contoso.com:7024`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Automatic</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Manual</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AvailabilityMode</maml:name> <maml:description> <maml:para>Specifies the replica availability mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaAvailabilityMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaAvailabilityMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupPriority</maml:name> <maml:description> <maml:para>Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup.</maml:para> <maml:para>A value of zero (0) indicates that the replica is not a candidate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInPrimaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the primary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowReadWriteConnections. Allows read/write connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInPrimaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInPrimaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionModeInSecondaryRole</maml:name> <maml:description> <maml:para>Specifies how the availability replica handles connections when in the secondary role. The acceptable values for this parameter are:</maml:para> <maml:para>- AllowNoConnections. Disallows connections.</maml:para> <maml:para>- AllowReadIntentConnectionsOnly. Allows only read-intent connections.</maml:para> <maml:para>- AllowAllConnections. Allows all connections.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaConnectionModeInSecondaryRole</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaConnectionModeInSecondaryRole</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EndpointUrl</maml:name> <maml:description> <maml:para>Specifies the URL of the database mirroring endpoint. This URL is a TCP address in the following form: `TCP://system-address:port`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>FailoverMode</maml:name> <maml:description> <maml:para>Specifies the failover mode.</maml:para> <maml:para>You can specify a value of `$Null`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaFailoverMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaFailoverMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, to which the replica belongs.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LoadBalancedReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies the load-balanced read-only routing list.</maml:para> <maml:para>The routing list is a list of load-balanced sets, which in turn are lists of replicas.</maml:para> <maml:para>For example, passing a value like</maml:para> <maml:para></maml:para> <maml:para>@('Server1','Server2'),@('Server3'),@('Server4')</maml:para> <maml:para>means what we are passing 3 load-balanced sets: 1 with 2 replicas (Server1 and Server2) and 2 with just one (Server3 and Server4, respectively).</maml:para> <maml:para>At runtime, SQL Server will look sequentially at all the load-balanced sets until finds one such that at least on replica in it is available and use it for load-balancing.</maml:para> <maml:para>So, in the example above, if both Server1 and Server2 are not available, but Server3 is, SQL Server will pick Server3.</maml:para> <maml:para>> This cmdlet only sets the read-only routing list and does not check on the availablility of the specified replicas.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[][]</command:parameterValue> <dev:type> <maml:name>String[][]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadonlyRoutingConnectionUrl</maml:name> <maml:description> <maml:para>Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read-only connections, as in the following example: `TCP://DBSERVER8.manufacturing.Contoso.com:7024`</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ReadOnlyRoutingList</maml:name> <maml:description> <maml:para>Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SeedingMode</maml:name> <maml:description> <maml:para>Specifies how the secondary replica will be initially seeded. Allowed values: - Automatic. Enables direct seeding. This method will seed the secondary replica over the network. This method does not require you to backup and restore a copy of the primary database on the replica. - Manual. Specifies manual seeding. This method requires you to create a backup of the database on the primary replica and manually restore that backup on the secondary replica.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplicaSeedingMode</command:parameterValue> <dev:type> <maml:name>AvailabilityReplicaSeedingMode</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SessionTimeout</maml:name> <maml:description> <maml:para>Specifies the amount of time, in seconds, to wait for a response between the primary replica and this replica before the connection fails.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityReplica</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Modify a replica availability mode and automatic failover</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityReplica -AvailabilityMode "SynchronousCommit" -FailoverMode Automatic -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityReplicas\Replica02"</dev:code> <dev:remarks> <maml:para>This command modifies the replica named `Replica02` in the availability group named `MainAG` to use `synchronous-commit` availability mode and to support `automatic failover`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title> Example 2: Modify a replica to support forced manual failover </maml:title> <dev:code>PS C:\> Set-SqlAvailabilityReplica -AvailabilityMode AsynchronousCommit -FailoverMode Manual -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityReplicas\Replica02"</dev:code> <dev:remarks> <maml:para>This command modifies the replica named `Replica02` in the availability group named `MainAG` to use `asynchronous-commit` availability mode and to support only `forced manual failover`, which could incur data loss.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>---- Example 3: Allow all connections in the secondary role ----</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityReplica -ConnectionModeInSecondaryRole AllowAllConnections -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityReplicas\Replica02"</dev:code> <dev:remarks> <maml:para>This command modifies the replica `Replica02` in the availability group `MainAG` to allow all connections in the secondary role. This lets you offload read-only data processing workloads to secondary replicas.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Configure a primary replica and secondary replica for readonly routing</maml:title> <dev:code>PS C:\> Set-Location "SQLSERVER:\SQL\PrimaryServer\default\AvailabilityGroups\MainAG" PS C:\> $PrimaryReplica = Get-Item "AvailabilityReplicas\PrimaryServer" PS C:\> $SecondaryReplica = Get-Item "AvailabilityReplicas\SecondaryServer" PS C:\> Set-SqlAvailabilityReplica -ReadOnlyRoutingConnectionUrl "TCP://PrimaryServer.domain.com:5022" -InputObject $PrimaryReplica PS C:\> Set-SqlAvailabilityReplica -ReadOnlyRoutingConnectionUrl "TCP://SecondaryServer.domain.com:5022" -InputObject $SecondaryReplica PS C:\> Set-SqlAvailabilityReplica -ReadOnlyRoutingList "SecondaryServer","PrimaryServer" -InputObject $PrimaryReplica</dev:code> <dev:remarks> <maml:para>The first command changes location to a location in the SQLSERVER: provider.</maml:para> <maml:para>The fourth command assigns a read-only routing URL to the primary replica. Then it sets the read-only routing list on the primary replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------------- Example 5: Modify backup priority --------------</maml:title> <dev:code>PS C:\> Set-SqlAvailabilityReplica -BackupPriority 60 -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAG\AvailabilityReplicas\Replica02"</dev:code> <dev:remarks> <maml:para>This command sets the backup priority of the availability replica `Replica02` to `60`. This priority is used by the server instance that hosts the primary replica to decide which replica should service an automated backup request on a database in the availability group. The replica that has the highest priority is chosen.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlavailabilityreplica</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlAvailabilityReplicaRoleToSecondary</command:name> <command:verb>Set</command:verb> <command:noun>SqlAvailabilityReplicaRoleToSecondary</command:noun> <maml:description> <maml:para>Sets the Availability Group replica role to secondary.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>On the SQL Server that hosts the primary replica for the primary availability group, sets the replica role to `SECONDARY`.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlAvailabilityReplicaRoleToSecondary</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlAvailabilityReplicaRoleToSecondary</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the Availability Group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the availability group, as an AvailabilityGroup object, that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the Availability Group to which the replica belongs. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>EXAMPLE 1: Shows how to set an availability group primary replica to SECONDARY role</maml:title> <dev:code>PS C:\> CD 'SQLSERVER:\SQL\MYSERVER\MYINSTANCE\AvailabilityGroups\AG1' PS SQLSERVER:\SQL\MYSERVER\MYINSTANCE\AvailabilityGroups\AG1> Set-SqlAvailabilityReplicaRoleToSecondary</dev:code> <dev:remarks> <maml:para>This examples show how to set the primary replica of availability group `AG1` on server `MYSERVER` (instance = `MYINSTANCE`) to `SECONDARY` role. The name of the availability is inferred from the context, i.e. the current location.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlavailabilityreplicaroletosecondary</maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlColumnEncryption</command:name> <command:verb>Set</command:verb> <command:noun>SqlColumnEncryption</command:noun> <maml:description> <maml:para>Encrypts, decrypts, or re-encrypts specified columns in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlColumnEncryption cmdlet encrypts, decrypts, or re-encrypts specified database columns using the Always Encrypted feature.</maml:para> <maml:para>The cmdlet accepts an array of SqlColumnEncryptionSettings objects, each of which specifies the target encryption configuration for one column in the database.</maml:para> <maml:para>The cmdlet will encrypt, decrypt, or re-encrypt each specified column, depending on what the current encryption configuration of the column is and the specified target encryption settings.</maml:para> <maml:para>The cmdlet communicates with key stores that hold columns master keys. If any column master key protecting the columns to be encrypted, decrypted, or re-encrypted, is stored in Azure, you need to specify a valid authentication token for a key vault or a managed HSM holding the key. Alternatively, you can authenticate to Azure with Add-SqlAzureAuthenticationContext before calling this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlColumnEncryption</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowVerboseLogging</maml:name> <maml:description> <maml:para>If set, the cmdlet will add verbose messages to the log file (if the 'LogFileDirectory' parameter is set) and retain the dacpac files used by the underlying libraries for performing the operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnEncryptionSettings</maml:name> <maml:description> <maml:para>Specifies an array of SqlColumnEncryptionSettings objects, each of which specifies the target encryption configuration for one column in the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnEncryptionSettings[]</command:parameterValue> <dev:type> <maml:name>SqlColumnEncryptionSettings[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AttestationProtocol"> <maml:name>EnclaveAttestationProtocol</maml:name> <maml:description> <maml:para>Specifies the an enclave's attestation protocol for Always Encrypted with secure enclaves. This parameter is required for the cmdlet to perform cryptographic operations in-place - inside a server-side secure enclave - to void the expense of downloading and uploading the data. Note that in-place encryption has other pre-requisites: your database must have an enclave configured and you need to use enclave-enabled cryptographic keys.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">NotSpecified</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AAS</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">HGS</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SqlConnectionAttestationProtocol</command:parameterValue> <dev:type> <maml:name>SqlConnectionAttestationProtocol</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnclaveAttestationURL</maml:name> <maml:description> <maml:para>Specifies an enclave attestation URL for in-place encryption when using Always Encrypted with secure enclaves. Required if EnclaveAttestationProtocol is set to `AAS` or `HGS`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepCheckForeignKeyConstraints</maml:name> <maml:description> <maml:para>If set, check semantics (CHECK or NOCHECK) of foreign key constraints are preserved.</maml:para> <maml:para>Otherwise, if not set, and if UseOnlineApproach is not set, foreign key constraints are always recreated with the NOCHECK option to minimize the impact on applications.</maml:para> <maml:para>KeepCheckForeignKeyConstraints is valid only when UseOnlineApproach is set.</maml:para> <maml:para>> With the offline approach, the semantics of foreign key constraints is always preserved.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in key vaults in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LockTimeoutInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds) the cmdlet will wait for database locks that are needed to begin the last catch-up iteration. A value of -1 (default) indicates no timeout period (that is, wait forever). A value of 0 means to not wait at all. When a wait for a lock exceeds the time-out value, an error is returned. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>-1</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogFileDirectory</maml:name> <maml:description> <maml:para>If set, the cmdlet will create a log file in the specified directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in managed HSMs in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDivergingIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of consecutive catch-up iterations, where the number of processed rows increases. When this limit is reached, the cmdlet assumes that it will not be able to catch up with the changes made in the source table, and it aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set. Must be less than the value of MaxIterations .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>5</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDowntimeInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds), during which the source table will not be available for reads and writes. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>1800</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterationDurationInDays</maml:name> <maml:description> <maml:para>Specifies the maximum time (in days) of seeding or a single catch-up iteration. If seeding or any catch-up iteration takes more than the specified value, the cmdlet aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>3</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of iterations in the catch-up phase. When this limit is reached, the cmdlet aborts the operation and recreates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>100</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UseOnlineApproach</maml:name> <maml:description> <maml:para>If set, the cmdlet will use the online approach, to ensure the database is available to other applications for both reads and writes for most of the duration of the operation.</maml:para> <maml:para>Otherwise, the cmdlet will lock the impacted tables, making them unavailable for updates for the entire operation. The tables will be available for reads.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlColumnEncryption</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowVerboseLogging</maml:name> <maml:description> <maml:para>If set, the cmdlet will add verbose messages to the log file (if the 'LogFileDirectory' parameter is set) and retain the dacpac files used by the underlying libraries for performing the operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnEncryptionSettings</maml:name> <maml:description> <maml:para>Specifies an array of SqlColumnEncryptionSettings objects, each of which specifies the target encryption configuration for one column in the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnEncryptionSettings[]</command:parameterValue> <dev:type> <maml:name>SqlColumnEncryptionSettings[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AttestationProtocol"> <maml:name>EnclaveAttestationProtocol</maml:name> <maml:description> <maml:para>Specifies the an enclave's attestation protocol for Always Encrypted with secure enclaves. This parameter is required for the cmdlet to perform cryptographic operations in-place - inside a server-side secure enclave - to void the expense of downloading and uploading the data. Note that in-place encryption has other pre-requisites: your database must have an enclave configured and you need to use enclave-enabled cryptographic keys.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">NotSpecified</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AAS</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">HGS</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SqlConnectionAttestationProtocol</command:parameterValue> <dev:type> <maml:name>SqlConnectionAttestationProtocol</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnclaveAttestationURL</maml:name> <maml:description> <maml:para>Specifies an enclave attestation URL for in-place encryption when using Always Encrypted with secure enclaves. Required if EnclaveAttestationProtocol is set to `AAS` or `HGS`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepCheckForeignKeyConstraints</maml:name> <maml:description> <maml:para>If set, check semantics (CHECK or NOCHECK) of foreign key constraints are preserved.</maml:para> <maml:para>Otherwise, if not set, and if UseOnlineApproach is not set, foreign key constraints are always recreated with the NOCHECK option to minimize the impact on applications.</maml:para> <maml:para>KeepCheckForeignKeyConstraints is valid only when UseOnlineApproach is set.</maml:para> <maml:para>> With the offline approach, the semantics of foreign key constraints is always preserved.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in key vaults in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LockTimeoutInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds) the cmdlet will wait for database locks that are needed to begin the last catch-up iteration. A value of -1 (default) indicates no timeout period (that is, wait forever). A value of 0 means to not wait at all. When a wait for a lock exceeds the time-out value, an error is returned. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>-1</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogFileDirectory</maml:name> <maml:description> <maml:para>If set, the cmdlet will create a log file in the specified directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in managed HSMs in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDivergingIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of consecutive catch-up iterations, where the number of processed rows increases. When this limit is reached, the cmdlet assumes that it will not be able to catch up with the changes made in the source table, and it aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set. Must be less than the value of MaxIterations .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>5</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDowntimeInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds), during which the source table will not be available for reads and writes. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>1800</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterationDurationInDays</maml:name> <maml:description> <maml:para>Specifies the maximum time (in days) of seeding or a single catch-up iteration. If seeding or any catch-up iteration takes more than the specified value, the cmdlet aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>3</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of iterations in the catch-up phase. When this limit is reached, the cmdlet aborts the operation and recreates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>100</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UseOnlineApproach</maml:name> <maml:description> <maml:para>If set, the cmdlet will use the online approach, to ensure the database is available to other applications for both reads and writes for most of the duration of the operation.</maml:para> <maml:para>Otherwise, the cmdlet will lock the impacted tables, making them unavailable for updates for the entire operation. The tables will be available for reads.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowVerboseLogging</maml:name> <maml:description> <maml:para>If set, the cmdlet will add verbose messages to the log file (if the 'LogFileDirectory' parameter is set) and retain the dacpac files used by the underlying libraries for performing the operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ColumnEncryptionSettings</maml:name> <maml:description> <maml:para>Specifies an array of SqlColumnEncryptionSettings objects, each of which specifies the target encryption configuration for one column in the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlColumnEncryptionSettings[]</command:parameterValue> <dev:type> <maml:name>SqlColumnEncryptionSettings[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="AttestationProtocol"> <maml:name>EnclaveAttestationProtocol</maml:name> <maml:description> <maml:para>Specifies the an enclave's attestation protocol for Always Encrypted with secure enclaves. This parameter is required for the cmdlet to perform cryptographic operations in-place - inside a server-side secure enclave - to void the expense of downloading and uploading the data. Note that in-place encryption has other pre-requisites: your database must have an enclave configured and you need to use enclave-enabled cryptographic keys.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SqlConnectionAttestationProtocol</command:parameterValue> <dev:type> <maml:name>SqlConnectionAttestationProtocol</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EnclaveAttestationURL</maml:name> <maml:description> <maml:para>Specifies an enclave attestation URL for in-place encryption when using Always Encrypted with secure enclaves. Required if EnclaveAttestationProtocol is set to `AAS` or `HGS`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the SQL database object, for which this cmdlet runs the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeepCheckForeignKeyConstraints</maml:name> <maml:description> <maml:para>If set, check semantics (CHECK or NOCHECK) of foreign key constraints are preserved.</maml:para> <maml:para>Otherwise, if not set, and if UseOnlineApproach is not set, foreign key constraints are always recreated with the NOCHECK option to minimize the impact on applications.</maml:para> <maml:para>KeepCheckForeignKeyConstraints is valid only when UseOnlineApproach is set.</maml:para> <maml:para>> With the offline approach, the semantics of foreign key constraints is always preserved.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>KeyVaultAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for key vaults in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in key vaults in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LockTimeoutInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds) the cmdlet will wait for database locks that are needed to begin the last catch-up iteration. A value of -1 (default) indicates no timeout period (that is, wait forever). A value of 0 means to not wait at all. When a wait for a lock exceeds the time-out value, an error is returned. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>-1</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>LogFileDirectory</maml:name> <maml:description> <maml:para>If set, the cmdlet will create a log file in the specified directory.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagedHsmAccessToken</maml:name> <maml:description> <maml:para>Specifies an access token for managed HSMs in Azure Key Vault. Use this parameter if any of the column master keys protecting the columns to be encrypted, decrypted, or re-encrypted, are stored in managed HSMs in Azure Key Vault.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDivergingIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of consecutive catch-up iterations, where the number of processed rows increases. When this limit is reached, the cmdlet assumes that it will not be able to catch up with the changes made in the source table, and it aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set. Must be less than the value of MaxIterations .</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>5</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxDowntimeInSeconds</maml:name> <maml:description> <maml:para>Specifies the maximum time (in seconds), during which the source table will not be available for reads and writes. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>1800</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterationDurationInDays</maml:name> <maml:description> <maml:para>Specifies the maximum time (in days) of seeding or a single catch-up iteration. If seeding or any catch-up iteration takes more than the specified value, the cmdlet aborts the operation and re-creates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>3</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxIterations</maml:name> <maml:description> <maml:para>Specifies the maximum number of iterations in the catch-up phase. When this limit is reached, the cmdlet aborts the operation and recreates the original state of the database. Valid only if UseOnlineApproach is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>100</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL database, for which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>UseOnlineApproach</maml:name> <maml:description> <maml:para>If set, the cmdlet will use the online approach, to ensure the database is available to other applications for both reads and writes for most of the duration of the operation.</maml:para> <maml:para>Otherwise, the cmdlet will lock the impacted tables, making them unavailable for updates for the entire operation. The tables will be available for reads.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Apply the specified target encryption settings to three database columns.</maml:title> <dev:code>$ces1 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.Id' -EncryptionType 'Deterministic' -EncryptionKey 'MyCek' $ces2 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.LastName' -EncryptionType 'Randomized' -EncryptionKey 'MyCek' $ces3 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.FirstName' -EncryptionType 'Plaintext' Set-SqlColumnEncryption -ColumnEncryptionSettings $ces1,$ces2,$ces3 -LogFileDirectory .</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Apply the specified target encryption settings to the three database columns (column master key is stored in Azure Key Vault.)</maml:title> <dev:code># Connect to Azure account. Import-Module Az.Accounts -MinimumVersion 2.2.0 Connect-AzAccount # Obtain an access token for key vaults. $keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token $ces1 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.Id' -EncryptionType 'Deterministic' -EncryptionKey 'MyCek' $ces2 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.LastName' -EncryptionType 'Randomized' -EncryptionKey 'MyCek' $ces3 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.FirstName' -EncryptionType 'Plaintext' # Pass the token to the cmdlet. It will use the token to communicate with Azure Key Vault to obtain the plaintext value of the column encryption key. Set-SqlColumnEncryption -ColumnEncryptionSettings $ces1,$ces2,$ces3 -LogFileDirectory . -KeyVaultAccessToken $keyVaultAccessToken</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Apply the specified target encryption settings to three database columns using the online approach.</maml:title> <dev:code>$ces1 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.Id' -EncryptionType 'Deterministic' -EncryptionKey 'MyCek' $ces2 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.LastName' -EncryptionType 'Randomized' -EncryptionKey 'MyCek' $ces3 = New-SqlColumnEncryptionSettings -ColumnName 'dbo.Student.FirstName' -EncryptionType 'Plaintext' Set-SqlColumnEncryption -ColumnEncryptionSettings $ces1,$ces2,$ces3 -UseOnlineApproach -MaxDowntimeInSeconds 30 -LogFileDirectory .</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Apply target encryption settings to multiple columns using in-place encryption.</maml:title> <dev:code>$ces1 = New-SqlColumnEncryptionSettings -ColumnName dbo.Student.Id -EncryptionType 'Randomized' -EncryptionKey 'CEK1' $ces2 = New-SqlColumnEncryptionSettings -ColumnName dbo.Student.LastName -EncryptionType 'Randomized' -EncryptionKey 'CEK1' $ces3 = New-SqlColumnEncryptionSettings -ColumnName dbo.Student.FirstName -EncryptionType 'Randomized' -EncryptionKey 'CEK1' Set-SqlColumnEncryption -ColumnEncryptionSettings $ces1,$ces2,$ces3 -LogFileDirectory . -EnclaveAttestationProtocol 'AAS' -EnclaveAttestationURL 'https://enclavedemoattest.weu.attest.azure.net'</dev:code> <dev:remarks> <maml:para>This example applies the target encryption settings to the database columns using in-place encryption, provided all prerequisites for in-place encryption are met, that is, the database has an enclave enabled and the keys used in cryptographic operations, which the cmdlet triggers, are enclave-enabled.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlcolumnencryption</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlCredential</command:name> <command:verb>Set</command:verb> <command:noun>SqlCredential</command:noun> <maml:description> <maml:para>Sets the properties for the SQL Credential object.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlCredential cmdlet sets the Identity and password properties for a SQL Credential object using this cmdlet. This cmdlet supports the two following modes of operation:</maml:para> <maml:para>- Specify the path or location of the credential including the credential name that uses the Path parameter. </maml:para> <maml:para>- Pass a Smo.Credential object to the object that uses the InputObject parameter.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlCredential</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an input Credential object. To get this object, use the Get-SqlCredential cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Credential</command:parameterValue> <dev:type> <maml:name>Credential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the user or account name for the resource SQL Server needs to authenticate to. For Windows Azure storage service, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service, this is the access key value for the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlCredential</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the credential on which this cmdlet performs this operation. For instance, `SQLSERVER:\SQL\Computer\Instance\Credentials\Credential`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the user or account name for the resource SQL Server needs to authenticate to. For Windows Azure storage service, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service, this is the access key value for the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Identity</maml:name> <maml:description> <maml:para>Specifies the user or account name for the resource SQL Server needs to authenticate to. For Windows Azure storage service, this is the name of the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an input Credential object. To get this object, use the Get-SqlCredential cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Credential</command:parameterValue> <dev:type> <maml:name>Credential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the credential on which this cmdlet performs this operation. For instance, `SQLSERVER:\SQL\Computer\Instance\Credentials\Credential`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="3" aliases="none"> <maml:name>Secret</maml:name> <maml:description> <maml:para>Specifies the password for the user or account. For Windows Azure storage service, this is the access key value for the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SecureString</command:parameterValue> <dev:type> <maml:name>SecureString</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Credential</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---- Example 1: Set the identity of a SQL credential object ----</maml:title> <dev:code>PS C:\> Set-SqlCredential -Path SQLSERVER:\SQL\Computer\Instance\Credentials\MySqlCredential -Identity "MyStorageAccount"</dev:code> <dev:remarks> <maml:para>This command sets the identity of `MySqlCredential` to `MyStorageAccount` by specifying the path of the SQL Credential.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Set the identity of a SQL credential object using the pipeline</maml:title> <dev:code>PS C:\> $Cred = Get-SqlCredential -Name "MySqlCredential" PS C:\> $Cred | Set-SqlCredential -Identity "MyStorageAccount"</dev:code> <dev:remarks> <maml:para>The first command gets the credential object from the Get-Credential cmdlet and stores the result in the variable named `$Cred`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Set the identity of a SQL credential object prompting the user</maml:title> <dev:code>PS C:\> $Secret = Read-Host "Please enter the storage account access key" PS C:\> Set-SqlCredential -Identity "MyStorageAccount" -Secret $Secret</dev:code> <dev:remarks> <maml:para>The first command prompts for the storage access key information and stores the result in the variable named `$Secret`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlcredential</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlCredential</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlErrorLog</command:name> <command:verb>Set</command:verb> <command:noun>SqlErrorLog</command:noun> <maml:description> <maml:para>Sets or resets the maximum number of error log files before they are recycled.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlErrorLog cmdlet sets or resets the maximum number of error log files before they are recycled.</maml:para> <maml:para>This cmdlet supports the following modes of operation to set logs:</maml:para> <maml:para>- Pass the instance of the SQL Server. </maml:para> <maml:para>- Specify the Path parameter of the SQL Server instance.</maml:para> <maml:para>- Invoke the cmdlet in a valid context.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlErrorLog</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format `MyComputer\MyInstanceName`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLogSizeKb</maml:name> <maml:description> <maml:para>Specifies the size limit of the SQL instance error log file in kilo bytes.</maml:para> <maml:para>Valid range is 0 to Int32.MaxValue.</maml:para> <maml:para>If the user does not specify this parameter then the ErrorLogSizeKb remains unchanged. The default value for the SQL instance is 0.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxLogCount</maml:name> <maml:description> <maml:para>Specifies the maximum number of error log files. If the value is not specified, the cmdlet resets the value to the default.</maml:para> <maml:para>The allowed range of values are between 6 and 99.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">UInt16</command:parameterValue> <dev:type> <maml:name>UInt16</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlErrorLog</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLogSizeKb</maml:name> <maml:description> <maml:para>Specifies the size limit of the SQL instance error log file in kilo bytes.</maml:para> <maml:para>Valid range is 0 to Int32.MaxValue.</maml:para> <maml:para>If the user does not specify this parameter then the ErrorLogSizeKb remains unchanged. The default value for the SQL instance is 0.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxLogCount</maml:name> <maml:description> <maml:para>Specifies the maximum number of error log files. If the value is not specified, the cmdlet resets the value to the default.</maml:para> <maml:para>The allowed range of values are between 6 and 99.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">UInt16</command:parameterValue> <dev:type> <maml:name>UInt16</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlErrorLog</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLogSizeKb</maml:name> <maml:description> <maml:para>Specifies the size limit of the SQL instance error log file in kilo bytes.</maml:para> <maml:para>Valid range is 0 to Int32.MaxValue.</maml:para> <maml:para>If the user does not specify this parameter then the ErrorLogSizeKb remains unchanged. The default value for the SQL instance is 0.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxLogCount</maml:name> <maml:description> <maml:para>Specifies the maximum number of error log files. If the value is not specified, the cmdlet resets the value to the default.</maml:para> <maml:para>The allowed range of values are between 6 and 99.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">UInt16</command:parameterValue> <dev:type> <maml:name>UInt16</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer value between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object used to specify the credentials for a SQL Server login that has permission to perform this operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ErrorLogSizeKb</maml:name> <maml:description> <maml:para>Specifies the size limit of the SQL instance error log file in kilo bytes.</maml:para> <maml:para>Valid range is 0 to Int32.MaxValue.</maml:para> <maml:para>If the user does not specify this parameter then the ErrorLogSizeKb remains unchanged. The default value for the SQL instance is 0.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the server object of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server</command:parameterValue> <dev:type> <maml:name>Server</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MaxLogCount</maml:name> <maml:description> <maml:para>Specifies the maximum number of error log files. If the value is not specified, the cmdlet resets the value to the default.</maml:para> <maml:para>The allowed range of values are between 6 and 99.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">UInt16</command:parameterValue> <dev:type> <maml:name>UInt16</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server. For default instances, only specify the computer name: MyComputer. For named instances, use the format `MyComputer\MyInstanceName`.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para>If the value on the server is already set to the value specified, this cmdlet does not do anything.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------- Example 1: Set the maximum number or error logs -------</maml:title> <dev:code>PS C:\> Set-SqlErrorLog -ServerInstance "MyServer\MyInstance" -MaxLogCount 11 | Out-Null</dev:code> <dev:remarks> <maml:para>This command sets the maximum number of error log files to `11`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Return the TSQL script code to set the maximum number or error logs</maml:title> <dev:code>PS C:\> Set-SqlErrorLog -ServerInstance "MyServer\MyInstance" -MaxLogCount 11 -Script USE [master] GO EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, 11 GO</dev:code> <dev:remarks> <maml:para>This command returns the T-SQL script code, as a string array, that is needed to set the maximum number of error log files to `11`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlerrorlog</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlErrorLog</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlHADREndpoint</command:name> <command:verb>Set</command:verb> <command:noun>SqlHADREndpoint</command:noun> <maml:description> <maml:para>Sets the properties of a database mirroring endpoint.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlHADREndpoint cmdlet changes the properties of a database mirroring endpoint.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlHADREndpoint</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the endpoint that to modify. This must be a database mirroring endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Endpoint</command:parameterValue> <dev:type> <maml:name>Endpoint</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint. If the specified option calls for a certificate, the Certificate parameter must be set unless a certificate is already associated with the endpoint.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Ntlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Kerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Negotiate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NtlmCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">KerberosCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NegotiateCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNtlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateKerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNegotiate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the specified certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the endpoint encryption setting.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Supported</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Required</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using `RC4` or `RC4_128` when the database is in compatibility level `90` or `100`, but this is not recommended. For improved security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AesRC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4Aes</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address on which the endpoint will listen.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the owner of the endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port number used by the endpoint to listen for connections.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>State</maml:name> <maml:description> <maml:para>Specifies the state of the endpoint.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Started</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Stopped</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointState</command:parameterValue> <dev:type> <maml:name>EndpointState</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlHADREndpoint</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the database mirroring endpoint. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint. If the specified option calls for a certificate, the Certificate parameter must be set unless a certificate is already associated with the endpoint.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Ntlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Kerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Negotiate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Certificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NtlmCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">KerberosCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">NegotiateCertificate</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNtlm</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateKerberos</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">CertificateNegotiate</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the specified certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the endpoint encryption setting.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Supported</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Required</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using `RC4` or `RC4_128` when the database is in compatibility level `90` or `100`, but this is not recommended. For improved security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Aes</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">AesRC4</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">RC4Aes</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address on which the endpoint will listen.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the owner of the endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port number used by the endpoint to listen for connections.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the task.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>State</maml:name> <maml:description> <maml:para>Specifies the state of the endpoint.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Started</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Stopped</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Disabled</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">EndpointState</command:parameterValue> <dev:type> <maml:name>EndpointState</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AuthenticationOrder</maml:name> <maml:description> <maml:para>Specifies the order and type of authentication that is used by the endpoint. If the specified option calls for a certificate, the Certificate parameter must be set unless a certificate is already associated with the endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointAuthenticationOrder</command:parameterValue> <dev:type> <maml:name>EndpointAuthenticationOrder</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Certificate</maml:name> <maml:description> <maml:para>Specifies the name of the certificate the endpoint will use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the specified certificate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encryption</maml:name> <maml:description> <maml:para>Specifies the endpoint encryption setting.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointEncryption</command:parameterValue> <dev:type> <maml:name>EndpointEncryption</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionAlgorithm</maml:name> <maml:description> <maml:para>Specifies the form of encryption used by the endpoint.</maml:para> <maml:para>NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using `RC4` or `RC4_128` when the database is in compatibility level `90` or `100`, but this is not recommended. For improved security, use a newer algorithm such as one of the `AES` algorithms instead.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointEncryptionAlgorithm</command:parameterValue> <dev:type> <maml:name>EndpointEncryptionAlgorithm</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the endpoint that to modify. This must be a database mirroring endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Endpoint</command:parameterValue> <dev:type> <maml:name>Endpoint</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IpAddress</maml:name> <maml:description> <maml:para>Specifies the IP address on which the endpoint will listen.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">IPAddress</command:parameterValue> <dev:type> <maml:name>IPAddress</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Owner</maml:name> <maml:description> <maml:para>Specifies the owner of the endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the database mirroring endpoint. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the TCP port number used by the endpoint to listen for connections.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet outputs a Transact-SQL script that performs the task.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>State</maml:name> <maml:description> <maml:para>Specifies the state of the endpoint.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">EndpointState</command:parameterValue> <dev:type> <maml:name>EndpointState</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Endpoint</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>SMO.Endpoint</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Set the port number of a database mirroring endpoint</maml:title> <dev:code>PS C:\> Set-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance\Endpoints\MainDbmEndpoint" -Port 5050</dev:code> <dev:remarks> <maml:para>This command sets the port number of the database mirroring endpoint named `MainDbmEndpoint` to `5050` on the server instance named `Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 2: Start a database mirroring endpoint --------</maml:title> <dev:code>PS C:\> Set-SqlHADREndpoint -Path "SQLSERVER:\Sql\Computer\Instance\Endpoints\MainDbmEndpoint" -State Started</dev:code> <dev:remarks> <maml:para>This command starts the database mirroring endpoint named `MainDbmEndpoint` on the server instance `Computer\Instance`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlhadrendpoint</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlHADREndpoint</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlNetworkConfiguration</command:name> <command:verb>Set</command:verb> <command:noun>SqlNetworkConfiguration</command:noun> <maml:description> <maml:para>Sets the network configuration of the target instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlNetworkConfiguration cmdlet sets the network configuration of the target instance of SQL Server.</maml:para> <maml:para>SQL Server Cloud Adapter must be running and accessible on the machine that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation:</maml:para> <maml:para>- Specify the instance of the Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlNetworkConfiguration</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Protocol</maml:name> <maml:description> <maml:para>Specifies the network protocol that we want to configure on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TCP</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">Protocols</command:parameterValue> <dev:type> <maml:name>Protocols</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port to accept TCP connections. To configure dynamic ports, this parameter should be set to zero.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disable</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables the specified network protocol on the target instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlNetworkConfiguration</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Protocol</maml:name> <maml:description> <maml:para>Specifies the network protocol that we want to configure on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TCP</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">Protocols</command:parameterValue> <dev:type> <maml:name>Protocols</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port to accept TCP connections. To configure dynamic ports, this parameter should be set to zero.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disable</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables the specified network protocol on the target instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path, as an array, to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlNetworkConfiguration</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Protocol</maml:name> <maml:description> <maml:para>Specifies the network protocol that we want to configure on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">TCP</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">Protocols</command:parameterValue> <dev:type> <maml:name>Protocols</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port to accept TCP connections. To configure dynamic ports, this parameter should be set to zero.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disable</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables the specified network protocol on the target instance of SQL Server.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance, as an array, of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Disable</maml:name> <maml:description> <maml:para>Indicates that this cmdlet disables the specified network protocol on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ForceServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet forces the SQL Server service to restart, if necessary, without prompting the user.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoServiceRestart</maml:name> <maml:description> <maml:para>Indicates that this cmdlet prevents a restart of the SQL Server service without prompting the user.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path, as an array, to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="2" aliases="none"> <maml:name>Port</maml:name> <maml:description> <maml:para>Specifies the port to accept TCP connections. To configure dynamic ports, this parameter should be set to zero.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Protocol</maml:name> <maml:description> <maml:para>Specifies the network protocol that we want to configure on the target instance of SQL Server.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Protocols</command:parameterValue> <dev:type> <maml:name>Protocols</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance, as an array, of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Set the network configuration of the target SQL Server</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Set-SqlNetworkConfiguration -Credential $credential -Protocol TCP -Port 1433 -NoServiceRestart -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>The first command changes the directory to `SQLSERVER:\SQL\Computer\Instance`. The second command sets the network configuration to accept `TCP` connections at port `1433` for the server instance named `Computer\Instance`. The current working directory is used to determine the server instance where the operation occurs. The SQL Server service is not restarted automatically. The self-signed certificate of the target machine is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Set the network configuration of the target SQL Server using the pipeline</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer006" | Set-SqlNetworkConfiguration -Credential $Credential -Protocol TCP -Disable -NoServiceRestart -AcceptSelfSignedCertificate;</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server on the computer named `Computer006` and disables `TCP` connections for each one of them. The SQL Server service is not restarted automatically. The self-signed certificate of the target machine is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlnetworkconfiguration</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQLServer_Cmdlets</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlSensitivityClassification</command:name> <command:verb>Set</command:verb> <command:noun>SqlSensitivityClassification</command:noun> <maml:description> <maml:para>Set the information type and/or sensitivity label and information type of columns in the database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlSensitivityClassification cmdlet sets the information type and/or Sensitivity label of columns in the database.</maml:para> <maml:para>The information type and sensitivity label and information type of columns also be set using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms)release 17.5 and above.</maml:para> <maml:para>The information type and sensitivity label and information type of columns can be viewed using SQL Server Management Studio (SSMS) (/sql/ssms/sql-server-management-studio-ssms) release 17.5 and above, the [Extended Properties catalog view](/sql/relational-databases/security/sql-data-discovery-and-classification#subheading-3), or the Get-SqlSensitivityClassification cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Networking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Contact Info</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credentials</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credit Card</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Banking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Financial</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Other</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Name</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">National ID</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SSN</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Health</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Date Of Birth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Public</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">General</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential - GDPR</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential - GDPR</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Critical</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Networking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Contact Info</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credentials</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credit Card</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Banking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Financial</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Other</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Name</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">National ID</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SSN</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Health</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Date Of Birth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Public</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">General</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential - GDPR</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential - GDPR</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Critical</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies either the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Networking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Contact Info</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credentials</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credit Card</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Banking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Financial</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Other</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Name</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">National ID</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SSN</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Health</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Date Of Birth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Public</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">General</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential - GDPR</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential - GDPR</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Critical</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Networking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Contact Info</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credentials</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credit Card</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Banking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Financial</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Other</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Name</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">National ID</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SSN</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Health</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Date Of Birth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Public</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">General</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential - GDPR</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential - GDPR</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Critical</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlSensitivityClassification</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Networking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Contact Info</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credentials</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Credit Card</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Banking</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Financial</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Other</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Name</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">National ID</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">SSN</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Health</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Date Of Birth</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Public</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">General</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Confidential - GDPR</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Highly Confidential - GDPR</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">None</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Low</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Medium</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">High</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Critical</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="Column"> <maml:name>ColumnName</maml:name> <maml:description> <maml:para>Name(s) of columns for which information type and sensitivity label is set.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionString</maml:name> <maml:description> <maml:para>Specifies a connection string to connect to the database. If this parameter is present, other connection parameters will be ignored</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a credential used to connect to the database.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of a database. This cmdlet connects to this database in the instance that is specified in the ServerInstance parameter.</maml:para> <maml:para>If the DatabaseName parameter is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, this cmdlet connects to the database that is specified in the path.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>InformationType</maml:name> <maml:description> <maml:para>A name that describes the information type that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies a SQL Server Management Object (SMO) that represent the database that this cmdlet uses.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Database</command:parameterValue> <dev:type> <maml:name>Database</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityLabel</maml:name> <maml:description> <maml:para>A name that describes the sensitivity of the data that is stored in the column(s). You must provide a value for SensitivityLabel, InformationType, or both. Possible values are limited and cannot be extended.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none"> <maml:name>SensitivityRank</maml:name> <maml:description> <maml:para>An identifier based on a predefinied set of values which define sensitivity rank. May be used by other services like Advanced Threat Protection to detect anomalies based on their rank</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SensitivityRank</command:parameterValue> <dev:type> <maml:name>SensitivityRank</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies either the name of the server instance (a string) or SQL Server Management Objects (SMO) object that specifies the name of an instance of the Database Engine. For default instances, only specify the computer name: MyComputer. For named instances, use the format ComputerName\InstanceName.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning that this cmdlet has used in the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Database</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name>System.Object</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>Example 1: Set information type and sensitivity label on a single column using Windows authentication</maml:title> <dev:code>PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -ColumnName "Sales.Customers.first_name" -InformationType "Name" -SensitivityLabel "Confidential - GDPR" -SensitivityRank "Low" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.first_name Name Confidential - GDPR Low</dev:code> <dev:remarks> <maml:para>Set the information type and sensitivity label of column `Sales.Customers.first_name` to `Name` and `Confidential - GDPR` respectively. The values for information type and sensitivity label are limited to the default values provided below, and can be obtained by using the Tab key.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Set the information type of a single column using Windows authentication</maml:title> <dev:code>PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -ColumnName "Sales.Customers.first_name" -InformationType "Personal" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.first_name Personal</dev:code> <dev:remarks> <maml:para>Set the information type of column `Sales.Customers.first_name` to `Personal`. The sensitivity label will be unset if it was previously set.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Set the sensitivity label of a single column using connection parameters</maml:title> <dev:code>PS C:\> Set-SqlSensitivityClassification -ServerInstance "MyComputer\MainInstance" -Database "myDatabase" -Credential (Get-Credential "sa") -ColumnName "Sales.Customers.ip_address" -SensitivityLabel "Confidential" Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.ip_address Confidential</dev:code> <dev:remarks> <maml:para>Set the sensitivity label of column `Sales.Customers.ip_address` to `Confidential` using the SQL Server login. The information type for this column remains unset. This command prompts you for a password to complete the authentication.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Set the information type and classification label of multiple columns using current path context</maml:title> <dev:code>PS C:\> $columns = @("Sales.Customers.first_name" , "Sales.Customers.last_name") PS C:\> Set-Location "SQLSERVER:\SQL\MyComputer\MainInstance\Databases\MyDatabase" PS SQLSERVER:\SQL\MyComputer\MainInstance> Set-SqlSensitivityClassification -ColumnName $columns -InformationType "Name" -SensitivityLabel "Confidential - GDPR" -SensitivityRank "Critical" WARNING: Using provider context. Server = MyComputer, Database = MyDatabase. Column InformationType SensitivityLabel SensitivityRank ------ --------------- ---------------- --------------- Sales.Customers.first_name Name Confidential - GDPR Critical Sales.Customers.last_name Name Confidential - GDPR Critical</dev:code> <dev:remarks> <maml:para>Set the information type and sensitivity label of column `Sales.Customers.first_name` and `Sales.Customers.last_name` by providing array of column names as argument to the cmdlet. All columns will receive the same information type and sensitivity label. Database connection information is taken from the context that is created by `Set-Location`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlsensitivityclassification</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>SQL Data Discovery and Classification</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Set-SqlSmartAdmin</command:name> <command:verb>Set</command:verb> <command:noun>SqlSmartAdmin</command:noun> <maml:description> <maml:para>Configures or modifies backup retention and storage settings.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Set-SqlSmartAdmin cmdlet configures or modifies the BackupEnabled , BackupRetentionPeriodinDays , MasterSwitch , and SqlCredential parameter settings. This cmdlet can be run for only instance level configurations and not for a specific database.</maml:para> <maml:para>This cmdlet supports the following modes of operation to return the object:</maml:para> <maml:para>- Pass a Smo.Server object to the InputObject parameter, either directly or through the pipeline. </maml:para> <maml:para>- Pass the path of the instance of SQL Server to the Path parameter</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Set-SqlSmartAdmin</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Smo Smart Admin object. You can use the Get-SqlSmartAdmin cmdlet to get this object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SmartAdmin</command:parameterValue> <dev:type> <maml:name>SmartAdmin</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupEnabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet enables SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupRetentionPeriodInDays</maml:name> <maml:description> <maml:para>Specifies the number of days the backup files should be retained. This determines the timeframe of the recoverability for the databases. For instance, if you set the value for 30 days, you can recover a database to a point in time in the last 30 days.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MasterSwitch</maml:name> <maml:description> <maml:para>Indicates that this cmdlet pauses or restarts all services under Smart Admin including SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the SqlCredential object that is used to authenticate to the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Set-SqlSmartAdmin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server. If you do not specify a value for this parameter, the cmdlet uses the current working directory. This is useful when you create scripts to manage multiple instances.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupEnabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet enables SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupRetentionPeriodInDays</maml:name> <maml:description> <maml:para>Specifies the number of days the backup files should be retained. This determines the timeframe of the recoverability for the databases. For instance, if you set the value for 30 days, you can recover a database to a point in time in the last 30 days.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MasterSwitch</maml:name> <maml:description> <maml:para>Indicates that this cmdlet pauses or restarts all services under Smart Admin including SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the SqlCredential object that is used to authenticate to the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupEnabled</maml:name> <maml:description> <maml:para>Indicates that this cmdlet enables SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>BackupRetentionPeriodInDays</maml:name> <maml:description> <maml:para>Specifies the number of days the backup files should be retained. This determines the timeframe of the recoverability for the databases. For instance, if you set the value for 30 days, you can recover a database to a point in time in the last 30 days.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that this cmdlet modifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>EncryptionOption</maml:name> <maml:description> <maml:para>Specifies the encryption options.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">BackupEncryptionOptions</command:parameterValue> <dev:type> <maml:name>BackupEncryptionOptions</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies the Smo Smart Admin object. You can use the Get-SqlSmartAdmin cmdlet to get this object.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SmartAdmin</command:parameterValue> <dev:type> <maml:name>SmartAdmin</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>MasterSwitch</maml:name> <maml:description> <maml:para>Indicates that this cmdlet pauses or restarts all services under Smart Admin including SQL Server Managed Backup to Windows Azure.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Boolean</command:parameterValue> <dev:type> <maml:name>Boolean</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server. If you do not specify a value for this parameter, the cmdlet uses the current working directory. This is useful when you create scripts to manage multiple instances.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SqlCredential</maml:name> <maml:description> <maml:para>Specifies the SqlCredential object that is used to authenticate to the Windows Azure storage account.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.SmartAdmin</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Configure backup retention and storage settings --</maml:title> <dev:code>PS C:\> $EncryptionOption = New-SqlBackupEncryptionOption -EncryptionAlgorithm Aes128 -EncryptorType ServerCertificate -EncryptorName "MyBackupCert"</dev:code> <dev:remarks> <maml:para>This command configures backup retention for storage settings that uses the encryptor named `MyBackupCert` and stores the result in the variable named `$EncryptionOption`.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/set-sqlsmartadmin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Start-SqlInstance</command:name> <command:verb>Start</command:verb> <command:noun>SqlInstance</command:noun> <maml:description> <maml:para>Starts the specified instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Start-SqlInstance cmdlet starts the specified instance of SQL Server.</maml:para> <maml:para>SQL Server Cloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation: - Specify the instance to the Windows PowerShell path. </maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Start-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Start-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as a string array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Start-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as a string array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target sever. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies, as a string array, the name of an instance of SQL Server that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------------ Example 1: Start a SQL Server instance ------------</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Start-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>The first command changes directory to the path `SQLSERVER:\SQL\Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Start all instances of SQL Server on the target computer</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer004" | Start-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command gets all instances of SQL Server on the computer named `Computer004` and then starts all the instances. The self-signed certificate of the target machine is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/start-sqlinstance</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Stop-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Stop-SqlInstance</command:name> <command:verb>Stop</command:verb> <command:noun>SqlInstance</command:noun> <maml:description> <maml:para>Stops the specified instance of SQL Server.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Stop-SqlInstance cmdlet stops the specified instance of SQL Server.</maml:para> <maml:para>SQL Server Cloud Adapter must be running and accessible on the computer that hosts the instance of SQL Server.</maml:para> <maml:para>This cmdlet supports the following modes of operation:</maml:para> <maml:para>- Specify the instance Windows PowerShell path.</maml:para> <maml:para>- Specify the server object.</maml:para> <maml:para>- Specify the ServerInstance object of the target instance of SQL Server.</maml:para> <maml:para></maml:para> <maml:para>`Note: This cmdlet ceased to work a long time ago. It's been removed in version 22 of the module.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Stop-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as a string array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Stop-SqlInstance</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as a string array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AutomaticallyAcceptUntrustedCertificates</maml:name> <maml:description> <maml:para>Indicates that this cmdlet automatically accepts untrusted certificates.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a user account with Windows Administrator credentials on the target computer.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of server objects of the target instance.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Server[]</command:parameterValue> <dev:type> <maml:name>Server[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ManagementPublicPort</maml:name> <maml:description> <maml:para>Specifies the public management port on the target computer. This parameter is used when the ports of the target computer are not directly accessible but are exposed through endpoints. This means that this cmdlet needs to connect to a different port.</maml:para> <maml:para>SQL Server Cloud Adapter must be accessible by this port.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to the instance of SQL Server, as a string array, on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>RetryTimeout</maml:name> <maml:description> <maml:para>Specifies the time period to retry the command on the target server. After the timeout expires, no retry will be attempted.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName, ByValue)" position="named" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server, as a string array, that becomes the target of the operation.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Server[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---------- Example 1: Stop an instance of SQL Server ----------</maml:title> <dev:code>PS C:\> CD SQLSERVER:\SQL\Computer\Instance PS SQLSERVER:\SQL\Computer\Instance> Stop-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>The first command changes the working directory to `SQLSERVER:\SQL\Computer\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Stop all instances of SQL Server on the specified computer</maml:title> <dev:code>PS C:\> Get-SqlInstance -Credential $Credential -MachineName "Computer006" | Stop-SqlInstance -Credential $Credential -AcceptSelfSignedCertificate</dev:code> <dev:remarks> <maml:para>This command retrieves all instances of SQL Server on the machine named `Computer006` and stops all the instances. The self-signed certificate of the target computer is automatically accepted without prompting the user.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/stop-sqlinstance</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Start-SqlInstance</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Suspend-SqlAvailabilityDatabase</command:name> <command:verb>Suspend</command:verb> <command:noun>SqlAvailabilityDatabase</command:noun> <maml:description> <maml:para>Suspends data movement on an availability database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Suspend-SqlAvailabilityDatabase cmdlet suspends data movement on an availability database. This cmdlet suspends a database on the replica that is hosted by the current server instance. If you suspend a secondary database, this cmdlet sets its state to `SUSPENDED`. It falls behind the corresponding primary database. If you suspend a primary database, data movement stops on every secondary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Suspend-SqlAvailabilityDatabase</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet suspends.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Suspend-SqlAvailabilityDatabase</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet suspends. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability database, as an AvailabilityDatabase object, that this cmdlet suspends.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityDatabase[]</command:parameterValue> <dev:type> <maml:name>AvailabilityDatabase[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of an availability database that cmdlet suspends. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityDatabase[]</maml:name> </dev:type> <maml:description> <maml:para>You can pass an availability database to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para>The instance on which you run this command must be enabled for high availability.</maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>------ Example 1: Suspend synchronization for a database ------</maml:title> <dev:code>PS C:\> Suspend-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16"</dev:code> <dev:remarks> <maml:para>This command suspends data synchronization for the availability database `Database16` in the availability group named MainAG on the server instance named `Server\Instance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 2: Suspend synchronization for all databases -----</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases" | Suspend-SqlAvailabilityDatabase</dev:code> <dev:remarks> <maml:para>This command gets all the availability databases that belong to `MainAG`, and then passes them to the current cmdlet by using the pipeline operator. The current cmdlet suspends each availability database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>------- Example 3: Create a script to suspend a database -------</maml:title> <dev:code>PS C:\> Suspend-SqlAvailabilityDatabase -Path "SQLSERVER:\Sql\Server\Instance\AvailabilityGroups\MainAG\AvailabilityDatabases\Database16" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that suspends the availability database named `Database16` in the availability group named `MainAG`. The command does not perform this action.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/suspend-sqlavailabilitydatabase</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Resume-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Switch-SqlAvailabilityGroup</command:name> <command:verb>Switch</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Starts a failover of an availability group to a secondary replica.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Switch-SqlAvailabilityGroup cmdlet starts a failover of an availability group to a specified secondary replica. Run this cmdlet on the target secondary replica. After the failover, the secondary replica becomes the primary replica.</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Switch-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group that this cmdlet fails over.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowDataLoss</maml:name> <maml:description> <maml:para>Indicates that this cmdlet starts a forced failover to the target secondary replica. Data loss is possible. Unless you specify the Force or Script parameter, the cmdlet prompts you for confirmation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This cmdlet prompts you for confirmation only if you specify the AllowDataLoss parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Switch-SqlAvailabilityGroup</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet fails over. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowDataLoss</maml:name> <maml:description> <maml:para>Indicates that this cmdlet starts a forced failover to the target secondary replica. Data loss is possible. Unless you specify the Force or Script parameter, the cmdlet prompts you for confirmation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This cmdlet prompts you for confirmation only if you specify the AllowDataLoss parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowDataLoss</maml:name> <maml:description> <maml:para>Indicates that this cmdlet starts a forced failover to the target secondary replica. Data loss is possible. Unless you specify the Force or Script parameter, the cmdlet prompts you for confirmation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Forces the command to run without asking for user confirmation. This cmdlet prompts you for confirmation only if you specify the AllowDataLoss parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies availability group that this cmdlet fails over.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet fails over. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Script</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para>You can pass an availability group to this cmdlet.</maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>---------- Example 1: Fail over an availability group ----------</maml:title> <dev:code>PS C:\> Switch-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\SecondaryServer\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command performs a manual failover of the availability group `MainAG` to the server instance named `SecondaryServer\InstanceName`. This command does not allow data loss. Run this command on the server instance that hosts the secondary replica to which to fail over.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>----- Example 2: Force an availability group to fail over -----</maml:title> <dev:code>PS C:\> Switch-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\SecondaryServer\InstanceName\AvailabilityGroups\MainAG" -AllowDataLoss</dev:code> <dev:remarks> <maml:para>This command performs a manual failover of the availability group `MainAG` to the server instance named `SecondaryServer\InstanceName`. The command specifies the AllowDataLoss parameter. Therefore, the failover has the potential of data loss, and the command prompts you for confirmation. Specify the Force parameter to skip the confirmation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title> Example 3: Create a script to fail over an availability group </maml:title> <dev:code>PS C:\> Switch-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\SecondaryServer\InstanceName\AvailabilityGroups\MainAG" -Script</dev:code> <dev:remarks> <maml:para>This command creates a Transact-SQL script that performs a manual failover of the availability group `MainAG` to the server instance named `SecondaryServer\InstanceName`. The script does not allow data loss. The command does not cause failover.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/switch-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Join-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Test-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Test-SqlAvailabilityGroup</command:name> <command:verb>Test</command:verb> <command:noun>SqlAvailabilityGroup</command:noun> <maml:description> <maml:para>Evaluates the health of an availability group.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Test-SqlAvailabilityGroup cmdlet evaluates the health of an availability group. This cmdlet evaluates SQL Server policy-based management policies. To run this cmdlet, you must have `CONNECT`, `VIEW SERVER STATE`, and `VIEW ANY DEFINITION` user rights.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-SqlAvailabilityGroup</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability group, as AvailabilityGroup objects. This cmdlet evaluates the health of the availability groups that this parameter specifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet tests user policies found in the policy categories of Always On Availability Groups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that will not refresh the objects specified by the Path or InputObject parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays the result of each policy evaluation that it performs. The cmdlet returns one object per policy evaluation. Each policy object includes the results of evaluation. This information includes whether the policy passed or not, the policy name, and policy category.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-SqlAvailabilityGroup</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet evaluates. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet tests user policies found in the policy categories of Always On Availability Groups.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that will not refresh the objects specified by the Path or InputObject parameter.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays the result of each policy evaluation that it performs. The cmdlet returns one object per policy evaluation. Each policy object includes the results of evaluation. This information includes whether the policy passed or not, the policy name, and policy category.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet tests user policies found in the policy categories of Always On Availability Groups.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability group, as AvailabilityGroup objects. This cmdlet evaluates the health of the availability groups that this parameter specifies.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityGroup[]</command:parameterValue> <dev:type> <maml:name>AvailabilityGroup[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that will not refresh the objects specified by the Path or InputObject parameter.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the availability group that this cmdlet evaluates. If you do not specify this parameter, this cmdlet uses current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet displays the result of each policy evaluation that it performs. The cmdlet returns one object per policy evaluation. Each policy object includes the results of evaluation. This information includes whether the policy passed or not, the policy name, and policy category.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Evaluate the health of an availability group ---</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups\MainAG"</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability group named `MainAG`. The command returns a summary.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--- Example 2: Evaluate the health of all availability group ---</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups" | Test-SqlAvailabilityGroup</dev:code> <dev:remarks> <maml:para>This command gets all availability groups that have availability replicas in the specified location in the SQLSERVER: provider. The command passes them to the current cmdlet by using the pipeline operator. That cmdlet evaluates the health of each availability group.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Display results for each policy of an availability group</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups\MainAG" -ShowPolicyDetails</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability group named `MainAG`. This command specifies the ShowPolicyDetails parameter. Therefore, it displays the evaluation results for each policy-based management policy that ran.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Display results for userdefined policies of an availability group</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityGroup -Path "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups\MainAG" -AllowUserPolicies</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability group named `MainAG`. The command includes user-defined policies in this evaluation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 5: Get groups that have an error state --------</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Server\InstanceName\AvailabilityGroups" | Test-SqlAvailabilityGroup | Where-Object { $_.HealthState -eq "Error" }</dev:code> <dev:remarks> <maml:para>This command gets all availability groups that have availability replicas in the specified location in the SQLSERVER: provider. The command passes them to the current cmdlet by using the pipeline operator. That cmdlet evaluates the health of each availability group. The command passes those results to the Where-Object cmdlet, which returns results based on the HealthState property.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/test-sqlavailabilitygroup</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Join-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Switch-SqlAvailabilityGroup</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Test-SqlAvailabilityReplica</command:name> <command:verb>Test</command:verb> <command:noun>SqlAvailabilityReplica</command:noun> <maml:description> <maml:para>Evaluates the health of availability replicas.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Test-SqlAvailabilityReplica cmdlet assesses the health of availability replicas by evaluating SQL Server policy based management (PBM) policies. You must have `CONNECT`, `VIEW SERVER STATE`, and `VIEW ANY DEFINITION` permissions to execute this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-SqlAvailabilityReplica</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability replicas to evaluate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that the result of each policy evaluation performed by this cmdlet is shown. The cmdlet outputs one object per policy evaluation. This object contains fields that describe the results of the evaluation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-SqlAvailabilityReplica</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to one or more availability replicas. This parameter is optional. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that the result of each policy evaluation performed by this cmdlet is shown. The cmdlet outputs one object per policy evaluation. This object contains fields that describe the results of the evaluation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability replicas to evaluate.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">AvailabilityReplica[]</command:parameterValue> <dev:type> <maml:name>AvailabilityReplica[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to one or more availability replicas. This parameter is optional. If not specified, the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that the result of each policy evaluation performed by this cmdlet is shown. The cmdlet outputs one object per policy evaluation. This object contains fields that describe the results of the evaluation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.AvailabilityReplica[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Evaluate the health of an availability replica --</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityReplica -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\AvailabilityReplicas\MainReplica"</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability replica named `MainReplica` in the `MainAg` availability group and outputs a brief summary.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Evaluate the health of all availability replicas in an availability group</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\AvailabilityReplicas" | Test-SqlAvailabilityReplica</dev:code> <dev:remarks> <maml:para>This command evaluates the health of all availability replicas in the availability group named `MainAg` and outputs a brief summary for each replica.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Evaluate the health of an availability replica for each PBM policy</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityReplica -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\AvailabilityReplicas\MainReplica" -ShowPolicyDetails</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability replica named `MainReplica` in the `MainAg` availability group and outputs the evaluation results for each PBM policy that was executed.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Evaluate the health of an availability replica and include userdefined policies</maml:title> <dev:code>PS C:\> Test-SqlAvailabilityReplica -Path "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\AvailabilityReplicas\MainReplica" -AllowUserPolicies</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability replica named `MainReplica` in the `MainAg` availability group. User-defined policies are included in this evaluation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Show all availability replicas that are in an error state</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\AvailabilityReplicas" | Test-SqlAvailabilityReplica | Where-Object { $_.HealthState -eq "Error" }</dev:code> <dev:remarks> <maml:para>This command shows all availability replicas with a health state of `Error` in the `MainAg` availability group.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/test-sqlavailabilityreplica</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>New-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlAvailabilityReplica</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Test-SqlDatabaseReplicaState</command:name> <command:verb>Test</command:verb> <command:noun>SqlDatabaseReplicaState</command:noun> <maml:description> <maml:para>Evaluates the health of an availability database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Test-SqlDatabaseReplicaState cmdlet assesses the health of an availability database on all joined availability replicas by evaluating SQL Server policy based management (PBM) policies. You must have `CONNECT`, `VIEW SERVER STATE`, and `VIEW ANY DEFINITION` permissions to execute this cmdlet.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-SqlDatabaseReplicaState</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability database state objects. This cmdlet computes the health of these availability databases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DatabaseReplicaState[]</command:parameterValue> <dev:type> <maml:name>DatabaseReplicaState[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of each policy evaluation performed. The cmdlet outputs one object per policy evaluation and the results of evaluation are available in the fields of the object.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-SqlDatabaseReplicaState</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to one or more database replica cluster states of the availability database. This is an optional parameter. If not specified, the value of the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of each policy evaluation performed. The cmdlet outputs one object per policy evaluation and the results of evaluation are available in the fields of the object.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Always On policy categories.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of availability database state objects. This cmdlet computes the health of these availability databases.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">DatabaseReplicaState[]</command:parameterValue> <dev:type> <maml:name>DatabaseReplicaState[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the objects specified by the Path or InputObject parameters.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path to one or more database replica cluster states of the availability database. This is an optional parameter. If not specified, the value of the current working location is used.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of each policy evaluation performed. The cmdlet outputs one object per policy evaluation and the results of evaluation are available in the fields of the object.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.DatabaseReplicaState[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>-- Example 1: Evaluate the health of an availability database --</maml:title> <dev:code>PS C:\> $Path = "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\DatabaseReplicaStates\MainReplica.MainDatabase" PS C:\> Test-SqlDatabaseReplicaState -Path $Path</dev:code> <dev:remarks> <maml:para>This command evaluates the health of the availability database named `MainDatabase` on the availability replica `MainReplica` in the availability group `MainAg` and outputs a brief summary.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Evaluate the health of all availability databases in an availability group</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\DatabaseReplicaStates" | Test-SqlDatabaseReplicaState</dev:code> <dev:remarks> <maml:para>This command evaluates the health of all availability databases in the `MainAg` availability group and outputs a brief summary for each database.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 3: Evaluate the health of all availability databases in an availability group showing PBM evaluation results</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\DatabaseReplicaStates" | Test-SqlDatabaseReplicaState -ShowPolicyDetails</dev:code> <dev:remarks> <maml:para>This command evaluates the health of all availability databases in the `MainAg` availability group and outputs the evaluation results for each PBM policy that was executed.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Evaluate the health of all availability databases in an availability group and include userdefined policies</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\DatabaseReplicaStates" | Test-SqlDatabaseReplicaState -AllowUserPolicies</dev:code> <dev:remarks> <maml:para>This command evaluates the health of all availability databases in the `MainAg` availability group. User-defined policies are included in this evaluation.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Show all availability databases in an error health state</maml:title> <dev:code>PS C:\> Get-ChildItem "SQLSERVER:\Sql\Computer\Instance\AvailabilityGroups\MainAg\DatabaseReplicaStates" | Test-SqlDatabaseReplicaState | Where-Object { $_.HealthState -eq "Error" }</dev:code> <dev:remarks> <maml:para>This command shows all availability databases with a health state of `Error` in the `MainAg` availability group.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/test-sqldatabasereplicastate</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Add-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Remove-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Resume-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Suspend-SqlAvailabilityDatabase</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Test-SqlSmartAdmin</command:name> <command:verb>Test</command:verb> <command:noun>SqlSmartAdmin</command:noun> <maml:description> <maml:para>Tests the health of Smart Admin by evaluating SQL Server policy based management (PBM) policies.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Test-SqlSmartAdmin cmdlet tests the health of Smart Admin for the SQL Server instance by evaluating SQL Server policy based management (PBM) policies.</maml:para> <maml:para>This cmdlet supports the following modes of operation to return the object:</maml:para> <maml:para>- Pass the path of the instance of SQL Server to the Path parameter. - Pass a Smo.Server object to the InputObject parameter, either directly or through the pipeline.</maml:para> <maml:para>> `Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.`</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Test-SqlSmartAdmin</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SmartAdmin objects. To get this object, use the Get-SqlSmartAdmin cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SmartAdmin[]</command:parameterValue> <dev:type> <maml:name>SmartAdmin[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Smart Admin warning and error policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the object specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of the policy. The cmdlet outputs one object per policy assessment. The output includes the results of the assessment: such as, the name of the policy, category, and health.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Test-SqlSmartAdmin</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server instance, as a string array. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Smart Admin warning and error policy categories.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the object specified by the Path or InputObject parameters.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of the policy. The cmdlet outputs one object per policy assessment. The output includes the results of the assessment: such as, the name of the policy, category, and health.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AllowUserPolicies</maml:name> <maml:description> <maml:para>Indicates that this cmdlet runs user policies found in the Smart Admin warning and error policy categories.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SmartAdmin objects. To get this object, use the Get-SqlSmartAdmin cmdlet.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">SmartAdmin[]</command:parameterValue> <dev:type> <maml:name>SmartAdmin[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>NoRefresh</maml:name> <maml:description> <maml:para>Indicates that this cmdlet will not manually refresh the object specified by the Path or InputObject parameters.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the path of the SQL Server instance, as a string array. If you do not specify a value for this parameter, the cmdlet uses the current working location.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ShowPolicyDetails</maml:name> <maml:description> <maml:para>Indicates that this cmdlet shows the result of the policy. The cmdlet outputs one object per policy assessment. The output includes the results of the assessment: such as, the name of the policy, category, and health.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="cf"> <maml:name>Confirm</maml:name> <maml:description> <maml:para>Prompts you for confirmation before running the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="wi"> <maml:name>WhatIf</maml:name> <maml:description> <maml:para>Shows what would happen if the cmdlet runs. The cmdlet is not run.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.SmartAdmin[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues> <command:returnValue> <dev:type> <maml:name> </maml:name> </dev:type> <maml:description> <maml:para>This cmdlet outputs the results from the evaluation of the policies.</maml:para> </maml:description> </command:returnValue> </command:returnValues> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Test the status of the SQL Server Smart Admin ---</maml:title> <dev:code>PS C:\> cd SQLSERVER:\SQL\Computer\MyInstance PS SQLSERVER:\SQL\Computer\MyInstance> Get-SqlSmartAdmin | Test-SqlSmartAdmin</dev:code> <dev:remarks> <maml:para>The first command changes directory to the SQL instance `Computer\MyInstance`.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 2: Evaluate the test results of the SQL Server Smart Admin</maml:title> <dev:code>PS C:\> cd SQLSERVER:\SQL\Computer\MyInstance PS SQLSERVER:\SQL\Computer\MyInstance> $PolicyResults = Get-SqlSmartAdmin | Test-SqlSmartAdmin PS SQLSERVER:\SQL\Computer\MyInstance> $PolicyResults.PolicyEvaluationDetails | select Name, Category, Result, Expression</dev:code> <dev:remarks> <maml:para>The first command changes directory to the SQL instance Computer\MyInstance.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-- Example 3: Output the status of the SQL Server Smart Admin --</maml:title> <dev:code>PS C:\> PS SQLSERVER:\SQL\COMPUTER\DEFAULT> (Get-SqlSmartAdmin).EnumHealthStatus() number_of_storage_connectivity_errors: 0 number_of_sql_errors: 2 number_of_invalid_credential_errors: 0 number_of_other_errors : 0 number_of_corrupted_or_deleted_backups: 0 number_of_backup_loops: 2 number_of_retention_loops: 2</dev:code> <dev:remarks> <maml:para>This command outputs the status of the local SQL Server Smart Admin.</maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/test-sqlsmartadmin</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Get-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Set-SqlSmartAdmin</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp"> <command:details> <command:name>Write-SqlTableData</command:name> <command:verb>Write</command:verb> <command:noun>SqlTableData</command:noun> <maml:description> <maml:para>Writes data to a table of a SQL database.</maml:para> </maml:description> </command:details> <maml:description> <maml:para>The Write-SqlTableData cmdlet inserts data into a table of a SQL database. This cmdlet accepts the following input types the follow output formats:</maml:para> <maml:para>- System.Data.DataSet</maml:para> <maml:para>- System.Data.DataTable</maml:para> <maml:para>- System.Data.DateRow objects</maml:para> <maml:para>- Collection of objects</maml:para> <maml:para></maml:para> <maml:para>If you provide a DataSet , only the first table in the dataset is written to the database.</maml:para> <maml:para>You can use this cmdlet with the Windows PowerShell SQL provider.</maml:para> <maml:para>This cmdlet can infer information such as server, database, schema, and table from its current path.</maml:para> <maml:para>This cmdlet expects the table to exist. By default, the cmdlet appends data to that table.</maml:para> <maml:para>If you specify the Force parameter, the cmdlet generate missing objects, which include the database, the table schema, and the table itself. This usage enables quick transfer of data into a database. The cmdlet infers the schema of the table from the data. The result may not be optimal. For example, strings are mapped to NVARCHAR(MAX).</maml:para> </maml:description> <command:syntax> <command:syntaxItem> <maml:name>Write-SqlTableData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectToDatabase</maml:name> <maml:description> <maml:para>When establishing the connection, force the cmdlet to use the passed in database (`-DatabaseName`) as the initial catalog. This parameter may be useful to allow low-privileged users to connect to an existing database for the write operation. Do not use when the database needs to be created.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the table.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates missing SQL Server objects. These include the database, schema, and table. You must have appropriate credentials to create these objects.</maml:para> <maml:para>If you do not specify this parameter for missing objects, the cmdlet returns an error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and TableName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputData</maml:name> <maml:description> <maml:para>Specifies the data to write to the database.</maml:para> <maml:para>Typical input data is a System.Data.DataTable , but you can specify System.Data.DataSet or System.Data.DateRow * objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Passthru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns an SMO.Table object. This object represents the table that includes the added data. You can operate on the table after the write operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TableName</maml:name> <maml:description> <maml:para>Specifies the name of the table from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the TableName parameter anyway.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Specifies a time-out value, in seconds, for the write operation. If you do not specify a value, the cmdlet uses a default value (typically, 30s). In order to avoid a timeout, pass 0. The timeout must be an integer value between 0 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Write-SqlTableData</maml:name> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the table to which this cmdlet writes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Table[]</command:parameterValue> <dev:type> <maml:name>Table[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates missing SQL Server objects. These include the database, schema, and table. You must have appropriate credentials to create these objects.</maml:para> <maml:para>If you do not specify this parameter for missing objects, the cmdlet returns an error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputData</maml:name> <maml:description> <maml:para>Specifies the data to write to the database.</maml:para> <maml:para>Typical input data is a System.Data.DataTable , but you can specify System.Data.DataSet or System.Data.DateRow * objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Passthru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns an SMO.Table object. This object represents the table that includes the added data. You can operate on the table after the write operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Specifies a time-out value, in seconds, for the write operation. If you do not specify a value, the cmdlet uses a default value (typically, 30s). In order to avoid a timeout, pass 0. The timeout must be an integer value between 0 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> <command:syntaxItem> <maml:name>Write-SqlTableData</maml:name> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the full path in the context of the SQL Provider of the table where this cmdlet writes data.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValueGroup> <command:parameterValue required="false" command:variableLength="false">Mandatory</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Optional</command:parameterValue> <command:parameterValue required="false" command:variableLength="false">Strict</command:parameterValue> </command:parameterValueGroup> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates missing SQL Server objects. These include the database, schema, and table. You must have appropriate credentials to create these objects.</maml:para> <maml:para>If you do not specify this parameter for missing objects, the cmdlet returns an error.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputData</maml:name> <maml:description> <maml:para>Specifies the data to write to the database.</maml:para> <maml:para>Typical input data is a System.Data.DataTable , but you can specify System.Data.DataSet or System.Data.DateRow * objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Passthru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns an SMO.Table object. This object represents the table that includes the added data. You can operate on the table after the write operation.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Specifies a time-out value, in seconds, for the write operation. If you do not specify a value, the cmdlet uses a default value (typically, 30s). In order to avoid a timeout, pass 0. The timeout must be an integer value between 0 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:syntaxItem> </command:syntax> <command:parameters> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>AccessToken</maml:name> <maml:description> <maml:para>The access token used to authenticate to SQL Server, as an alternative to user/password or Windows Authentication.</maml:para> <maml:para>This can be used, for example, to connect to `SQL Azure DB` and `SQL Azure Managed Instance` using a `Service Principal` or a `Managed Identity`.</maml:para> <maml:para>The parameter to use can be either a string representing the token or a `PSAccessToken` object as returned by running `Get-AzAccessToken -ResourceUrl https://database.windows.net`.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectionTimeout</maml:name> <maml:description> <maml:para>Specifies the number of seconds to wait for a server connection before a time-out failure. The time-out value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>ConnectToDatabase</maml:name> <maml:description> <maml:para>When establishing the connection, force the cmdlet to use the passed in database (`-DatabaseName`) as the initial catalog. This parameter may be useful to allow low-privileged users to connect to an existing database for the write operation. Do not use when the database needs to be created.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Credential</maml:name> <maml:description> <maml:para>Specifies a PSCredential object for the connection to SQL Server. To obtain a credential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSCredential</command:parameterValue> <dev:type> <maml:name>PSCredential</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>DatabaseName</maml:name> <maml:description> <maml:para>Specifies the name of the database that contains the table.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Encrypt</maml:name> <maml:description> <maml:para>The encryption type to use when connecting to SQL Server.</maml:para> <maml:para>This value maps to the `Encrypt` property `SqlConnectionEncryptOption` on the SqlConnection object of the Microsoft.Data.SqlClient driver.</maml:para> <maml:para>In v22 of the module, the default is `Optional` (for compatibility with v21). In v23+ of the module, the default value will be 'Mandatory', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Force</maml:name> <maml:description> <maml:para>Indicates that this cmdlet creates missing SQL Server objects. These include the database, schema, and table. You must have appropriate credentials to create these objects.</maml:para> <maml:para>If you do not specify this parameter for missing objects, the cmdlet returns an error.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>HostNameInCertificate</maml:name> <maml:description> <maml:para>The host name to be used in validating the SQL Server TLS/SSL certificate. You must pass this parameter if your SQL Server instance is enabled for Force Encryption and you want to connect to an instance using hostname/shortname. If this parameter is omitted then passing the Fully Qualified Domain Name (FQDN) to -ServerInstance is necessary to connect to a SQL Server instance enabled for Force Encryption. </maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>IgnoreProviderContext</maml:name> <maml:description> <maml:para>Indicates that this cmdlet does not use the current context to override the values of the ServerInstance , DatabaseName , SchemaName , and TableName parameters. If you do not specify this parameter, the cmdlet ignores the values of these parameters, if possible, in favor of the context in which you run the cmdlet.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none"> <maml:name>InputData</maml:name> <maml:description> <maml:para>Specifies the data to write to the database.</maml:para> <maml:para>Typical input data is a System.Data.DataTable , but you can specify System.Data.DataSet or System.Data.DateRow * objects.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue> <dev:type> <maml:name>PSObject</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>InputObject</maml:name> <maml:description> <maml:para>Specifies an array of SQL Server Management Objects (SMO) objects that represent the table to which this cmdlet writes.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Table[]</command:parameterValue> <dev:type> <maml:name>Table[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Passthru</maml:name> <maml:description> <maml:para>Indicates that this cmdlet returns an SMO.Table object. This object represents the table that includes the added data. You can operate on the table after the write operation.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none"> <maml:name>Path</maml:name> <maml:description> <maml:para>Specifies the full path in the context of the SQL Provider of the table where this cmdlet writes data.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="proga"> <maml:name>ProgressAction</maml:name> <maml:description> <maml:para>Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">ActionPreference</command:parameterValue> <dev:type> <maml:name>ActionPreference</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SchemaName</maml:name> <maml:description> <maml:para>Specifies the name of the schema for the table.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the SchemaName parameter anyway.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="1" aliases="none"> <maml:name>ServerInstance</maml:name> <maml:description> <maml:para>Specifies the name of an instance of SQL Server. For the default instance, specify the computer name. For named instances, use the format `ComputerName\InstanceName`.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the ServerInstance parameter anyway.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String[]</command:parameterValue> <dev:type> <maml:name>String[]</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>SuppressProviderContextWarning</maml:name> <maml:description> <maml:para>Indicates that this cmdlet suppresses the warning message that states that the cmdlet uses the provider context.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TableName</maml:name> <maml:description> <maml:para>Specifies the name of the table from which this cmdlet reads.</maml:para> <maml:para>If you run this cmdlet in the context of a database or a child item of a database, the cmdlet ignores this parameter value. Specify the IgnoreProviderContext parameter for the cmdlet to use the value of the TableName parameter anyway.</maml:para> <maml:para>The cmdlet supports quoting the value. You do not have to quote or escape special characters.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">String</command:parameterValue> <dev:type> <maml:name>String</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>Timeout</maml:name> <maml:description> <maml:para>Specifies a time-out value, in seconds, for the write operation. If you do not specify a value, the cmdlet uses a default value (typically, 30s). In order to avoid a timeout, pass 0. The timeout must be an integer value between 0 and 65535.</maml:para> </maml:description> <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue> <dev:type> <maml:name>Int32</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>None</dev:defaultValue> </command:parameter> <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none"> <maml:name>TrustServerCertificate</maml:name> <maml:description> <maml:para>Indicates whether the channel will be encrypted while bypassing walking the certificate chain to validate trust.</maml:para> <maml:para>In v22 of the module, the default is `$true` (for compatibility with v21). In v23+ of the module, the default value will be '$false', which may create a breaking change for existing scripts.</maml:para> <maml:para>> This parameter is new in v22 of the module.</maml:para> </maml:description> <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue> <dev:type> <maml:name>SwitchParameter</maml:name> <maml:uri /> </dev:type> <dev:defaultValue>False</dev:defaultValue> </command:parameter> </command:parameters> <command:inputTypes> <command:inputType> <dev:type> <maml:name>System.Management.Automation.PSObject</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>System.String[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> <command:inputType> <dev:type> <maml:name>Microsoft.SqlServer.Management.Smo.Table[]</maml:name> </dev:type> <maml:description> <maml:para></maml:para> </maml:description> </command:inputType> </command:inputTypes> <command:returnValues /> <maml:alertSet> <maml:alert> <maml:para></maml:para> </maml:alert> </maml:alertSet> <command:examples> <command:example> <maml:title>--- Example 1: Write information about processes to a table ---</maml:title> <dev:code>PS C:\> (Get-Process | Select-Object -Property Id,ProcessName,StartTime,UserProcessorTime,WorkingSet,Description) | Write-SqlTableData -ServerInstance "MyServer\MyInstance" -DatabaseName "MyDatabase" -SchemaName "dbo" -TableName "TaskManagerDump" -Force</dev:code> <dev:remarks> <maml:para>This example gets information about processes that run on a system and writes it to a table.</maml:para> <maml:para>The current cmdlet writes the data to `MyDatabase.dbo.TaskManagerDump` on `MyServer\MyInstance`. Because you specify the Force parameter, if the database, schema, and table do not exist, this cmdlet creates them.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>--------------- Example 2: Write data to a table ---------------</maml:title> <dev:code>PS C:\> cd SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase\Tables PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase\Tables> $Table = Write-SqlTableData -TableName "KeyValuePairs" -SchemaName "dbo" -InputData @{ cca=10; cac='Hello'; aac=1.2 } -PassThru PS SQLSERVER:\SQL\MyServer\MyInstance\Databases\MyDatabase\Tables> Read-SqlTableData -InputObject $Table WARNING: Using provider context. Server = MyServer\MyInstance, Database = [MyDatabase]. Key Value --- ----- aac 1.2 cac Hello cca 10</dev:code> <dev:remarks> <maml:para>The first command changes the location to be a location in the SQLSERVER provider. The command prompt reflects the new location. For more information, type Get-Help about_Providers.</maml:para> <maml:para>The final command displays the contents of the `$Table` variable by using the Read-SqlTableData cmdlet.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>-------- Example 3: Import data from a file to a table --------</maml:title> <dev:code>PS C:\> ,(Import-Csv -Path ".\a.csv" -Header "Id","Name","Amount") | Write-SqlTableData -ServerInstance "MyServer\MyInstance" -DatabaseName "MyDatabase" -SchemaName "dbo" -TableName "CSVTable" -Force PS C:\> Read-SqlTableData -ServerInstance "MyServer\MyInstance" -DatabaseName "MyDatabase" -SchemaName "dbo" -TableName "CSVTable" Id Name Amount -- ---- ------ 10 AAAA -1.2 11 BBBB 1.2 12 CCCC -1.0 The first command imports the contents of a file by using the Import-Csv cmdlet. The file contains the following content: 10,AAAA,-1.2 11,BBBB,1.2 12,CCCC,-1.0</dev:code> <dev:remarks> <maml:para>This example runs completely from the file prompt. It cannot use context information. Therefore, you must specify all relevant parameters.</maml:para> <maml:para>Note the use of the "," in front of the line: this is to force PowerShell to pass the entire content of the file directly to the Write-SqlTableData cmdlet, which in turn can do a bulk-insert (which is way more performant than a row by row insert)</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 4: Retrieve data from one instance and push to table of a database on another instance</maml:title> <dev:code>PS C:\> (Invoke-Sqlcmd -query "SELECT @@SERVERNAME AS 'ServerName', DB_NAME(dbid) AS 'Database', name, CONVERT(BIGINT, size) * 8 AS 'size_in_kb', filename FROM master..sysaltfiles" ` -ServerInstance MyServer\MyInstance -database master -OutputAs DataTables) | Write-SqlTableData -ServerInstance MyServer\MyOtherInstance -Database ServerStats -SchemaName dbo -TableName DatabasesSizes -Force</dev:code> <dev:remarks> <maml:para>This example gets information about database files sizes from one instance using the Invoke-SqlCmd cmdlet, and inserts the resulting rows into a database on a different instance of SQL Server. Note that while this example moves data between instances of SQL Server on the same machine, the instances could be on two completely different servers.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 5: Write data to an existing table of an Azure SQL Database (or any database using SQL Auth)</maml:title> <dev:code>Import-Module SqlServer # Set your connection string to Azure SQL DB. # If your server is not in Azure, just tweak the 'Data Source' field to point to your server. # Warning: putting clear text passwords in your scripts is highly discoraged, so instead # of using "User ID" and "Password" in the connection string, we prompt for the credentials. $cred = Get-Credential -Message "Enter your SQL Auth credentials" $cred.Password.MakeReadOnly() # Get access to the SMO Server object. $srv = Get-SqlInstance -ServerInstance "<your_server_name>.database.windows.net" -Credential $cred # Get access to table 'MyTable1' on database 'MyDB'. # Note: both objects are assumed to exists already. $db = $srv.Databases["MyDB"] $table = $db.Tables["MyTable1"] # Write the first 4 integers into the table. # Note: 'MyTable1' has a column 'Col1' of type 'int' Write-SqlTableData -InputData (1..4) -InputObject $table # Now, we read the data back to verify all went ok. Read-SqlTableData -InputObject $table # Output: # # Col1 # ---- # 1 # 2 # 3 # 4</dev:code> <dev:remarks> <maml:para>This example shows you how to use the Write-SqlTableData cmdlet with SQL Authentication. Most of the code is just ADO.Net and SMO boilerplate required to create the necessary object (the `SMO Table` object that represent the target table) needed which is passed to the cmdlet via the `-InputOject` parameter.</maml:para> </dev:remarks> </command:example> <command:example> <maml:title>Example 6: Write (and read) data to an existing table of an Azure SQL Database using the managed identity of an Azure VM.</maml:title> <dev:code>Import-Module Az.Accounts,SQLServer # Change these 3 variables to match your configuration. # The example assumes you have a SQL Azure DB with the AdventureWorksLT sample DB on server sql-240627023957. $Server = 'sql-240627023957.database.windows.net' $Database = 'AdventureWorksLT' # Connect to Azure using the system managed identify of the Azure VM this script is running on... Add-AzAccount -Identity # ... and fetch an access token to get to the DB. $AccessToken = (Get-AzAccessToken -ResourceUrl 'https://database.windows.net').Token # The assumption here is that the Microsoft Entra Admin on the server granted access # to the managed identity of the VM by running something like: # CREATE USER [<Name of the VM>] FROM EXTERNAL PROVIDER # ALTER ROLE db_owner ADD MEMBER [<Name of the VM>] # on the database ($Database). # Insert a new record into the SalesLT.ProductDescription table # Note that we are using -ConnectToDatabase to connect directly to the database, since it is unlikely for the # managed identity of the VM to have access to anything but such database. Write-SqlTableData -ServerInstance $Server -Database $Database -AccessToken $AccessToken -SchemaName SalesLT -TableName ProductDescription -InputData @{ Description = 'Hello SQLServer' } -ConnectToDatabase # Confirm that the new record was successfully added # Note that -ConnectToDatabase it not necessary in this case, as the connection if done directly to the database. Read-SqlTableData -ServerInstance $Server -Database $Database -AccessToken $AccessToken -SchemaName SalesLT -TableName ProductDescription -OrderBy ModifiedDate -TopN 1 -ColumnOrderType DESC # Output: # # ProductDescriptionID Description rowguid ModifiedDate # -------------------- ----------- ------- ------------ # 2011 Hello SQLServer f5f43821-aacd-4748-9d14-4a525c6a036b 6/30/2024 10:19:26 AM #</dev:code> <dev:remarks> <maml:para></maml:para> </dev:remarks> </command:example> </command:examples> <command:relatedLinks> <maml:navigationLink> <maml:linkText>Online Version:</maml:linkText> <maml:uri>https://learn.microsoft.com/powershell/module/sqlserver/write-sqltabledata</maml:uri> </maml:navigationLink> <maml:navigationLink> <maml:linkText>Read-SqlTableData</maml:linkText> <maml:uri></maml:uri> </maml:navigationLink> </command:relatedLinks> </command:command> </helpItems> |