Get-sqmLinkedServerUsage
Database
sqmSQLTool v1.8.2+ · Query
sys.sql_modules and job definitions via msdb.dbo.sysjobsteps.
Useful for impact analysis before removing or renaming linked servers.
Execution Flow
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SqlInstance | string | Optional | $env:COMPUTERNAME | Target SQL Server instance. |
| -SqlCredential | PSCredential | Optional | — | Credentials for the connection. |
| -LinkedServer | string | Optional | * = all | Linked server name or wildcard pattern. |
| -IncludeJobs | switch | Optional | $false | Also search SQL Agent job steps. |
| -EnableException | switch | Optional | $false | Re-throw exceptions instead of warning. |
Examples
Find all objects using a specific linked server
Get-sqmLinkedServerUsage -SqlInstance "SQL01" -LinkedServer "PROD_SRV"
Find all linked server usage including jobs
Get-sqmLinkedServerUsage -SqlInstance "SQL01" -IncludeJobs