Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Export-DbaLinkedServer on GitHub.
Want to see the Bill Of Health for this command? Check out Export-DbaLinkedServer.
Exports linked servers INCLUDING PASSWORDS, unless specified otherwise, to sql file.
Exports linked servers INCLUDING PASSWORDS, unless specified otherwise, to sql file.
Requires remote Windows access if exporting the password.
Export-DbaLinkedServer
[-SqlInstance] <DbaInstanceParameter[]>
[[-LinkedServer] <String[]>]
[[-SqlCredential] <PSCredential>]
[[-Credential] <PSCredential>]
[[-Path] <String>]
[[-FilePath] <String>]
[-ExcludePassword]
[-Append]
[[-InputObject] <LinkedServer[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Export-DbaLinkedServer -SqlInstance sql2017 -Path C:\temp\ls.sql
Exports the linked servers, including passwords, from sql2017 to the file C:\temp\ls.sql
PS C:\> Export-DbaLinkedServer -SqlInstance sql2017 -Path C:\temp\ls.sql -ExcludePassword
Exports the linked servers, without passwords, from sql2017 to the file C:\temp\ls.sql
Source SQL Server. You must have sysadmin access and server version must be SQL Server version 2005 or higher.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The linked server(s) to export. If unspecified, all linked servers will be processed.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target OS using alternative linked servers. Accepts credential objects (Get-Credential)
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies the directory where the file or files will be exported.
Alias | |
Required | False |
Pipeline | false |
Default Value | (Get-DbatoolsConfigValue -FullName 'Path.DbatoolsExport') |
Specifies the full file path of the output file.
Alias | OutFile,FileName |
Required | False |
Pipeline | false |
Default Value |
Exports the linked server without any sensitive information.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Append to Path
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Allow credentials to be piped in from Get-DbaLinkedServer
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |