Thor Logo dbatools

LinkedServer

Copy-DbaLinkedServer

Chrissy LeMaire (@cl), netnerds.net

Copy-DbaLinkedServer View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Migrates linked servers and their authentication credentials from one SQL Server instance to another Description Migrates SQL Server linked servers including all authentication credentials and connection settings from a source instance to one or more destination instances. The function preserves usernames and passwords by using password decryption techniques, eliminating the need to manually recreate linked server configurations and re-enter sensitive credentials.

Read more

Export-DbaLinkedServer

Chrissy LeMaire (@cl), netnerds.net

Export-DbaLinkedServer View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Generates T-SQL scripts to recreate linked server configurations with their login credentials. Description Creates executable T-SQL scripts from existing linked server definitions, including remote login mappings and passwords. Perfect for migrating linked servers between environments, creating disaster recovery scripts, or documenting your linked server landscape. When passwords are included, the function accesses the local registry to decrypt stored credentials, so the generated scripts contain actual working passwords rather than placeholder values.

Read more

Get-DbaLinkedServer

Stephen Bennett, sqlnotesfromtheunderground.wordpress.com

Get-DbaLinkedServer View Source Stephen Bennett, sqlnotesfromtheunderground.wordpress.com Windows, Linux, macOS Synopsis Retrieves linked server configurations and connection details from SQL Server instances. Description Pulls complete linked server information from one or more SQL Server instances, including remote server names, authentication methods, and security settings. This helps DBAs audit cross-server connections for compliance reporting, troubleshoot connectivity issues, and document distributed database architectures. Returns details about the remote server, product type, impersonation settings, and login mappings for each configured linked server.

Read more

Get-DbaLinkedServerLogin

Adam Lancaster, github.com/lancasteradam

Get-DbaLinkedServerLogin View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Retrieves linked server login mappings and authentication configurations from SQL Server instances. Description Retrieves the login mappings configured for linked servers, showing how local SQL Server logins are mapped to remote server credentials. This function returns details about each login mapping including the local login name, remote user account, and whether impersonation is enabled. Use this to audit linked server security configurations, troubleshoot authentication issues between servers, or document cross-server login relationships for compliance purposes.

Read more

New-DbaLinkedServer

Adam Lancaster, github.com/lancasteradam

New-DbaLinkedServer View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Creates a new linked server connection to remote SQL Server instances or heterogeneous data sources. Description Creates a new linked server on a SQL Server instance, allowing you to query remote databases and heterogeneous data sources as if they were local tables. This replaces the need to manually configure linked servers through SSMS or T-SQL scripts, while providing consistent security context management for unmapped logins.

Read more

New-DbaLinkedServerLogin

Adam Lancaster, github.com/lancasteradam

New-DbaLinkedServerLogin View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Creates authentication mappings between local and remote logins for linked server connections. Description Creates linked server login mappings that define how local SQL Server logins authenticate to remote servers during distributed queries. You can either map specific local logins to remote credentials or configure impersonation where local logins use their own credentials. This eliminates the need to hardcode passwords in applications that query across linked servers and provides centralized authentication management for cross-server operations.

Read more

Remove-DbaLinkedServer

Adam Lancaster, github.com/lancasteradam

Remove-DbaLinkedServer View Source Adam Lancaster, github.com/lancasteradam Windows, Linux, macOS Synopsis Removes linked servers from SQL Server instances. Description Removes one or more linked servers from target SQL Server instances. This function drops the linked server objects from the system catalog, effectively severing the connection between the local and remote servers. When using the -Force parameter, it also removes any associated linked server logins before dropping the linked server itself. This is useful for decommissioning legacy connections, cleaning up unused linked servers during server migrations, or removing connections for security compliance requirements.

Read more

Test-DbaLinkedServerConnection

Thomas LaRock, thomaslarock.com

Test-DbaLinkedServerConnection View Source Thomas LaRock, thomaslarock.com Windows, Linux, macOS Synopsis Tests connectivity to all linked servers on specified SQL Server instances Description Validates that linked servers are properly configured and accessible by attempting to establish connections to each one. This function iterates through all linked servers on the target instances and uses SQL Server’s built-in TestConnection() method to verify connectivity. Returns detailed results including success/failure status and specific error messages for troubleshooting connection issues.

Read more