powershelldba.de
REF: PSDB-CMD-2026 SCOPE: sqmSQLTool core STATUS: 151 COMMANDS DOCUMENTED
Command reference

Every sqmSQLTool command, in one place.

151 PowerShell commands across 17 categories — each with parameters, usage notes, and runnable examples.

Live examples

See the HTML reports in action

Generated against a lab SQL Server instance seeded with the AdventureWorks sample database — read-only, no production or customer data. Each page below is the exact HTML output the corresponding command produces.

AlwaysOn 20

CommandDescriptionSince
Add-sqmDatabaseToAGAdds one or more databases to an Always On availability group (AutoSeed).v1.4.7.0
Compare-sqmAlwaysOnLoginsCompares the logins of all replicas in an AlwaysOn Availability Group.v1.4.7.0
Compare-sqmAlwaysOnRolesCompares server-role membership (sysadmin, dbcreator, ...) for every login across all replicas of an AlwaysOn Availability Group.v1.9.0.0
Complete-sqmListenerMigrationCompletes listener migration after cluster team recreates the listener resource.v1.4.6.0
Export-sqmAlwaysOnConfigurationExports the complete AlwaysOn AG configuration for one or more SQL Server instances.v1.4.3.0
Get-sqmAlwaysOnFailoverHistoryRetrieves AlwaysOn failover events from the Windows Event Log.v1.4.7.0
Get-sqmAlwaysOnHealthReportCreates a detailed health report for all Always On availability groups on an instance.v1.4.7.0
Invoke-sqmAlwaysOnSetupEnd-to-end CLI AlwaysOn setup: reads the WSFC, creates the Availability Group and synchronises logins.v1.5.2.0
Invoke-sqmFailoverPerforms a controlled AlwaysOn AG failover with pre- and post-checks.v1.0.0.0
Invoke-sqmServiceBrokerAlwaysOnEnables Service Broker on all nodes of an AlwaysOn Availability Group with automatic failover orchestration.v1.5.2.0
Invoke-sqmSqlAlwaysOnAutoseedingEnables Automatic Seeding on all replicas of an Always On Availability Group.v1.0.0.0
Move-sqmAlwaysOnListenerMigrates an AG Listener from one Availability Group to another.v1.4.7.0
New-sqmAlwaysOnRepairJobCreates a SQL Server Agent job that runs Repair-Job.ps1 (AutoRepair).v1.0.0.0
New-sqmAutoLoginSyncJobCreates a SQL Agent job that runs Sync-Job.ps1 (AutoSync).v1.4.7.0
New-sqmAvailabilityGroupCreates an AlwaysOn Availability Group on an existing Windows Server Failover Cluster (WSFC).v1.5.2.0
Prepare-sqmListenerForMigrationPrepares an AG listener for cluster-level migration without downtime.v1.4.6.0
Remove-sqmDatabaseFromAGRemoves one or more databases from their Always On Availability Group.v1.0.0.0
Repair-sqmAlwaysOnDatabasesChecks all AlwaysOn databases for problems and repairs them (Remove -> Cleanup -> Add).v1.0.0.0
Sync-sqmAgNodeSynchronizes SQL Server objects from the primary replica to all secondary replicas of an Availability Group.v1.0.0.0
Sync-sqmLoginsToAlwaysOnSynchronizes logins from the primary replica to all secondary replicas in an AlwaysOn Availability Group.v1.4.7.0

Distributed AG 5

CommandDescriptionSince
Add-sqmDatabaseToDistributedAgAdds a database to a Distributed AlwaysOn Availability Group.v1.4.4.0
Get-sqmDistributedAgHealthCreates a detailed health report for Distributed AlwaysOn Availability Groups.v1.4.4.0
Invoke-sqmDistributedFailoverInitiates failover of a Distributed AlwaysOn AG.v1.4.4.0
New-sqmDistributedAvailabilityGroupCreates a new Distributed AlwaysOn Availability Group.v1.4.5.0
Test-sqmDistributedAgReadinessTests Distributed AlwaysOn AG readiness for failover.v1.4.4.0

Service Broker 2

CommandDescriptionSince
Enable-sqmServiceBrokerEnables Service Broker on a specified database and creates SSB endpoint.v1.5.1.0
Get-sqmServiceBrokerHealthCreates a health report for SQL Server Service Broker configuration and status.v1.5.1.0

Backup & Restore 14

CommandDescriptionSince
Get-sqmServersFromOURetrieves all computer objects from a specific AD OU and outputs them as pipeline-friendly objects.v1.7.3.0
Invoke-sqmLogShrinkShrinks the transaction log file (LDF) of one or more databases.v1.0.0.0
Invoke-sqmRestoreDatabaseRestores a database from a backup file, with support for single-server and AlwaysOn environments.v1.0.0.0
Invoke-sqmRestoreTestPerforms an auditable restore test: restores a database under a test name and documents success, data volume, throughput and duration as TXT and HTML report.v1.9.23.0
Invoke-sqmUserDatabaseBackupBacks up user databases on a SQL Server instance.v1.0.0.0
New-sqmBackupMaintenanceJobCreates a SQL Agent job with two steps that implement the full dynamic backup maintenance workflow.v1.0.0.0
New-sqmOlaSysDbBackupJobCreates a SQL Agent job for the daily full backup of SQL Server system databases via Ola Hallengren's DatabaseBackup.v1.0.0.0
New-sqmOlaUsrDbBackupJobCreates SQL Agent jobs for FULL, DIFF, and/or LOG backups of user databases via Ola Hallengren's DatabaseBackup.v1.0.0.0
New-sqmRestoreTestJobCreates a scheduled SQL Server Agent job that runs Invoke-sqmRestoreTest and produces the recurring restore-test evidence.v1.9.23.0
Register-sqmBackupExcludeTriggerRegisters or removes the DDL trigger that automatically keeps master.dbo.sqm_BackupExclude up to date on CREATE_DATABASE and DROP_DATABASE.v1.7.2.0
Set-sqmBackupExcludePermissionGrants SELECT, INSERT, and UPDATE permissions on master.dbo.sqm_BackupExclude to a login.v1.0.0.0
Show-sqmBackupExcludeFormA WinForms dialog for managing the backup exclude table (master.dbo.sqm_BackupExclude).v1.7.2.0
Sync-sqmBackupExcludeTableCreates and synchronises the backup exclude table in the master database.v1.0.0.0
Test-sqmBackupIntegrityVerifies one or more backup files using RESTORE VERIFYONLY.v1.0.0.0

Security 14

CommandDescriptionSince
Enable-sqmMonitoringAccessSets up a monitoring account on all SQL Server instances of a computer.v1.4.7.0
Find-sqmADUserSearches Active Directory for user accounts matching a SamAccountName wildcard pattern.v1.9.9.0
Get-sqmADAccountStatusChecks the status of an Active Directory user account.v1.0.0.0
Get-sqmADGroupMembersLists all members of an Active Directory group.v1.4.2.0
Get-sqmADGroupMembersRecursiveLists all members of an Active Directory group with controlled recursion depth.v1.5.1.0
Get-sqmADMemberGroupsFinds all Active Directory groups that contain a specified user, group, or computer.v1.5.1.0
Get-sqmLoginSettingsShows all logins with their default database and language setting.v1.4.7.0
Get-sqmSysadminAccountsRetrieves all logins with sysadmin rights on a SQL Server instance.v1.0.0.0
Grant-sqmTemporarySysadminGrants an AD login temporary sysadmin rights for X days and automatically revokes them afterward via a self-deleting SQL Agent job - failover-robust across all replicas for AlwaysOn.v1.8.1.0
Invoke-sqmLoginAuditComprehensive audit of all SQL Server logins on one or more instances.v1.0.0.0
Invoke-sqmSaObfuscationObfuscates the SA account on a SQL Server instance by renaming it, disabling it, and setting a random password.v1.0.0.0
Invoke-sqmTempSysadminActionPerforms the actual sysadmin grant or revoke on ONE instance - optionally creates a missing AD login, removes it again on revoke, and optionally deletes the calling SQL Agent job after success (self-deleting job).v1.8.1.0
Remove-sqmAdOrphanLoginRemoves Windows logins whose Active Directory account no longer exists (AD orphans).v1.4.7.0
Set-sqmDatabaseOwnerSets the owner of one or more databases to a uniform login.v1.0.0.0

Diagnostics & Health 18

CommandDescriptionSince
Copy-sqmNTFSPermissionsCopies NTFS permissions (ACLs) from a source path to a destination path.v1.0.0.0
Get-sqmAgentJobScheduleReportGenerates a comprehensive SQL Agent Job Schedule Report.v1.5.1.0
Get-sqmConnectionStatsAnalyzes active SQL Server connections and connection statistics.v1.0.0.0
Get-sqmDatabaseHealthAggregated health report for all databases on an instance.v1.0.0.0
Get-sqmDiskInfoByDriveLetterReturns disk information for a given drive letter.v1.2.0.0
Get-sqmDiskPartitionMapShows the mapping of physical disks to logical drive letters.v1.7.2.0
Get-sqmDiskSpaceReportDetermines free disk space on all SQL-relevant volumes and estimates time to exhaustion based on a self-collected size history.v1.0.0.0
Get-sqmOperationStatusDisplays progress and estimated remaining time for active backup, restore and AutoSeed operations.v1.0.0.0
Get-sqmOrphanedFilesFinds MDF/LDF/NDF database files that are not assigned to any database.v1.0.0.0
Get-sqmSpnReportChecks the registered SPNs for SQL Server instances (default and named instances).v1.0.0.0
Get-sqmSQLInstanceCheckChecks a SQL Server instance against best practices.v1.0.0.0
Get-sqmTempDbRecommendationAnalyzes the TempDB configuration and provides optimization recommendations.v1.0.0.0
Invoke-sqmPatchAnalysisCompares the installed SQL Server version with known CU/SP builds.v1.0.0.0
Invoke-sqmSetupReportProfessional SQL Server Setup Report with critical issues, security, and database overview.v1.3.0.0
New-sqmAgentProxyCreates a SQL Server credential and a SQL Agent proxy, and links the two together.v1.3.0.0
New-sqmSetupReportBuilds a self-contained animated HTML replay from a setup event JSON-Lines file.v1.5.2.0
Test-sqmCostThresholdChecks whether cost threshold for parallelism is at or above the recommended value.v1.3.0.0
Test-sqmTempDbFileCountChecks whether the number of TempDB data files matches the recommended CPU count.v1.3.0.0

Performance 13

CommandDescriptionSince
Get-sqmAutoGrowthReportCreates an AutoGrowth configuration report for all database files on a SQL Server instance.v1.0.0.0
Get-sqmBlockingReportRetrieves current blocking chains on a SQL Server instance.v1.0.0.0
Get-sqmDeadlockReportReads and analyzes deadlock events from the System Health Extended Event session.v1.0.0.0
Get-sqmIndexFragmentationAnalyzes index fragmentation in one or more databases.v1.0.0.0
Get-sqmLongRunningQueriesIdentifies long-running queries on a SQL Server instance.v1.0.0.0
Get-sqmMissingIndexesRetrieves missing index recommendations from the SQL Server DMV cache.v1.0.0.0
Get-sqmPerfCountersReads SQL Server performance counters from sys.dm_os_performance_counters.v1.0.0.0
Get-sqmServerUtilizationCollects SQL Server CPU and memory utilization trends over time.v1.7.8.0
Get-sqmWaitStatisticsReads and analyzes SQL Server wait statistics from sys.dm_os_wait_stats.v1.0.0.0
Invoke-sqmExtendedEventsManages Extended Events sessions for performance analysis on SQL Server.v1.0.0.0
Invoke-sqmPerfBaselineCreates, compares or lists performance baselines (wait stats + perf counters).v1.0.0.0
Invoke-sqmQueryStoreConfigures the Query Store, reads from it, detects issues and saves reports.v1.0.0.0
Invoke-sqmUpdateStatisticsUpdates statistics in one or more databases.v1.0.0.0

Maintenance 4

CommandDescriptionSince
Invoke-sqmFormatDrive64kChecks an NTFS drive for 64 KB allocation unit size and formats it with 65536 byte cluster size if needed.v1.0.0.0
Invoke-sqmNtfsSetupGrants the SQL Server service accounts NTFS permissions on the instance's data, log, TempDB and backup directories (with an ACL backup beforehand).v1.5.2.0
Test-sqmOlaInstallationChecks whether Ola Hallengren's Maintenance Solution is installed on a SQL Server instance.v1.0.0.0
Test-sqmSQLFirewallTests whether the firewall and network allow a TCP connection to SQL Server.v1.0.0.0

SQL Configuration 12

CommandDescriptionSince
Compare-sqmServerConfigurationVergleicht Konfiguration, Logins und migrationsrelevante Objekte zwischen zwei SQL-Server-Instanzen.v1.0.0.0
Get-sqmServerSettingReads one or all server properties from a SQL Server instance.v1.0.0.0
Invoke-sqmCollationChangeAutomatically changes the server collation of a SQL Server instance.v1.0.0.0
Invoke-sqmSetDatabaseRecoveryModeChanges the recovery mode of one or more user databases.v1.0.0.0
Invoke-sqmSsisConfigurationConfigures SQL Server Integration Services (SSIS) fully automatically. Supports standalone and AlwaysOn AG environments, local and remote.v1.0.0.0
Set-sqmMaxDopSets MAXDOP (max degree of parallelism) to the recommended (or an explicit) value, and optionally the matching "cost threshold for parallelism".v1.5.2.0
Set-sqmMaxMemorySets SQL Server "max server memory (MB)" to the recommended (or an explicit) value.v1.5.2.0
Set-sqmSqlPolicyStateEnables or disables a single Policy-Based Management policy on a SQL Server instance.v1.0.0.0
Set-sqmSsrsConfigurationConfigures SQL Server Reporting Services (SSRS) fully automatically. Supports local and remote installation as well as AlwaysOn environments.v1.0.0.0
Set-sqmTcpPortConfigures the TCP port of a SQL Server instance via the registry.v1.3.0.0
Test-sqmMaxDopChecks whether MAXDOP (max degree of parallelism) is configured correctly.v1.3.0.0
Test-sqmMaxMemoryChecks whether SQL Server max server memory is configured correctly.v1.3.0.0

sqmTool Config 3

CommandDescriptionSince
Get-sqmConfigReturns the current module configuration.v1.0.0.0
Invoke-sqmMonitoringKeyGets or sets monitoring registry values for the sqmSQLTool on one or more computers.v1.0.0.0
Set-sqmConfigSets one or more configuration values for the MSSQLTools module.v1.0.0.0

Inventory & Search 6

CommandDescriptionSince
Export-sqmDatabaseDocumentationCreates structured HTML and CSV documentation for all databases on a SQL Server instance.v1.0.0.0
Export-sqmServerConfigurationExports all SQL Server configuration settings to a JSON snapshot file.v1.4.3.0
Find-sqmDatabaseObjectSearches all (or selected) databases on an instance for an object name.v1.0.0.0
Get-sqmLinkedServerUsageAnalyzes which database objects (procedures, functions, views, triggers, SQL Agent jobs) access linked servers.v1.0.0.0
Invoke-sqmConfigRollbackRestores SQL Server configuration from a previously exported snapshot.v1.4.3.0
Invoke-sqmInstanceInventoryCreates a complete inventory of a SQL Server instance as a structured report (TXT + CSV).v1.0.0.0

Cluster & Services 4

CommandDescriptionSince
Get-sqmClusterInfoRetrieves information about a Windows Failover Cluster: cluster name, nodes and roles including IP addresses.v1.0.0.0
Get-sqmHpuAllowGroupSearches for the HPU allow group in Active Directory based on configurable domain/group mappings.v1.0.0.0
Test-sqmSsasDirectoryPermissionsChecks and corrects NTFS permissions for SSAS directories (Data, Log, Temp, Backup).v1.0.0.0
Test-sqmSSISPackageCompatibilityValidates SSIS package compatibility for SQL Server upgrades (2016 - 2025).v1.4.3.0

TLS & Certificates 8

CommandDescriptionSince
Get-sqmCertificateReportCreates a comprehensive report on SQL Server certificates and their expiration dates.v1.0.0.0
Get-sqmTlsStatusAudits TLS/SSL configuration and certificate status for all SQL Server instances on one or more computers.v1.2.0.0
Install-sqmCertificateInstalls a certificate (self-signed or CA-signed) in SQL Server and automatically binds it to the configured purpose.v1.0.0.0
Install-sqmCertificateToStoreInstalls a certificate file into the Windows certificate store - locally or on multiple remote computers.v1.2.0.0
New-sqmCertificateRequestCreates a CSR (Certificate Signing Request) and an order data sheet for a CA-signed certificate based on an existing SQL Server certificate.v1.0.0.0
New-sqmSqlCertificateCreates a new self-signed SQL Server certificate as a renewal of an existing one.v1.0.0.0
Set-sqmSqlTlsCertificateBinds a Windows certificate from the Machine store to SQL Server as the TLS certificate.v1.2.0.0
Set-sqmSsrsHttpsCertificateBinds a Windows certificate to SSRS or Power BI Report Server for HTTPS access.v1.2.0.0

TSM / IBM Spectrum 3

CommandDescriptionSince
Get-sqmTsmConfigurationReads the IBM TSM / Spectrum Protect client configuration (dsm.opt) and returns server, user and password settings.v1.0.0.0
Invoke-sqmTsmConfigurationConfigures the IBM Spectrum Protect (TSM) client options file dsm.opt for use with SQL Server backup directories.v1.0.0.0
Test-sqmTsmConnectionTests the connection to an IBM Spectrum Protect (TSM) server using dsmadmc.v1.0.0.0

Driver Install/Uninstall 7

CommandDescriptionSince
Install-sqmDb2DriverInstalls the IBM DB2 ODBC/CLI driver.v1.3.0.0
Install-sqmJdbcDriverInstalls the Microsoft JDBC Driver for SQL Server.v1.3.0.0
Install-sqmOdbcDriverInstalls the Microsoft ODBC Driver for SQL Server.v1.3.0.0
Test-sqmDriverInstalledChecks whether a JDBC, ODBC, or DB2 driver is installed on the system.v1.3.0.0
Uninstall-sqmDb2DriverUninstalls the IBM DB2 ODBC/CLI driver.v1.3.0.0
Uninstall-sqmJdbcDriverUninstalls the Microsoft JDBC Driver for SQL Server.v1.3.0.0
Uninstall-sqmOdbcDriverUninstalls the Microsoft ODBC Driver for SQL Server.v1.3.0.0

Deployment 3

CommandDescriptionSince
Install-sqmSsrsReportServerInstalls SQL Server Reporting Services 2022 from a network share and automatically configures the instance afterwards.v1.0.0.0
Invoke-sqmDeployScriptsExecutes numbered SQL scripts from a directory sequentially against a SQL Server database.v1.2.0.0
Invoke-sqmSignModuleSigns all PowerShell script files in a module directory using Set-AuthenticodeSignature.v1.2.0.0

Other 15

CommandDescriptionSince
Copy-sqmLoginsCopies logins from a source SQL Server instance to a target instance.v1.0.0.0
Copy-sqmToCentralPathCopies one or more files to the configured CentralPath.v1.0.0.0
Get-sqmAgentJobHistoryDisplays the execution history of SQL Agent jobs.v1.0.0.0
Get-sqmDiskBlockSizeChecks the NTFS block size (cluster size) of drives against 64KB.v1.3.0.0
Get-sqmServerHardwareReportCreates an HTML hardware configuration report for one or more servers.v1.4.0.0
Install-sqmAdModuleEnsures that the ActiveDirectory PowerShell module (RSAT) is installed.v1.0.0.0
Install-sqmOlaMaintenanceSolutionInstalls or updates Ola Hallengren's Maintenance Solution on a SQL Server instance.v1.0.0.0
install-sqmolammaintenance solution
Invoke-sqmSplunkConfigurationConfigures the Splunk Universal Forwarder on SQL Server hosts.v1.0.0.0
New-sqmOlaMaintenanceJobsCreates three SQL Agent jobs for Ola Hallengren's Maintenance Solution: IndexOptimize (user DBs) and IntegrityCheck (user and system DBs).v1.0.0.0
New-sqmRandomSaPasswordGenerates a random, policy-compliant SA password.v1.3.0.0
repair-sqmalwaysondbases
Show-sqmToolGuiLaunches a small graphical interface (WinForms) for all sqmSQLTool functions.v1.5.2.0
Test-sqmSqlInstanceInstalledChecks whether a SQL Server instance is installed on the local system.v1.3.0.0
Write-sqmSetupEventAppends a single structured setup event as one JSON line (JSON-Lines) to a file.v1.5.2.0