132 PowerShell commands across 17 categories — each with parameters, usage notes, and runnable examples.
| Command | Description |
|---|---|
Add-sqmDatabaseToAG | Adds one or more databases to an Always On availability group (AutoSeed). |
Compare-sqmAlwaysOnLogins | Vergleicht die Logins aller Replicas einer AlwaysOn Availability Group. |
Complete-sqmListenerMigration | Completes listener migration after cluster team recreates the listener resource. |
Export-sqmAlwaysOnConfiguration | Exports the complete AlwaysOn AG configuration for one or more SQL Server instances. |
Get-sqmAlwaysOnFailoverHistory | Ermittelt AlwaysOn-Failover-Ereignisse aus dem Windows Event Log. |
Get-sqmAlwaysOnHealthReport | Creates a detailed health report for all Always On availability groups on an instance. |
Invoke-sqmAlwaysOnSetup | End-to-end CLI AlwaysOn setup: reads the WSFC, creates the Availability Group and synchronises logins. |
Invoke-sqmFailover | Performs a controlled AlwaysOn AG failover with pre- and post-checks. |
Invoke-sqmServiceBrokerAlwaysOn | Enables Service Broker on all nodes of an AlwaysOn Availability Group with automatic failover orchestration. |
Invoke-sqmSqlAlwaysOnAutoseeding | Enables Automatic Seeding on all replicas of an Always On Availability Group. |
Move-sqmAlwaysOnListener | Migrates an AG Listener from one Availability Group to another. |
New-sqmAlwaysOnRepairJob | Creates a SQL Server Agent job that runs Repair-Job.ps1 (AutoRepair). |
New-sqmAutoLoginSyncJob | Creates a SQL Agent job that runs Sync-Job.ps1 (AutoSync). |
New-sqmAvailabilityGroup | Creates an AlwaysOn Availability Group on an existing Windows Server Failover Cluster (WSFC). |
Prepare-sqmListenerForMigration | Prepares an AG listener for cluster-level migration without downtime. |
Remove-sqmDatabaseFromAG | Removes one or more databases from their Always On Availability Group. |
Repair-sqmAlwaysOnDatabases | Checks all AlwaysOn databases for problems and repairs them (Remove -> Cleanup -> Add). |
Sync-sqmAgNode | Synchronizes SQL Server objects from the primary replica to all secondary replicas of an Availability Group. |
Sync-sqmLoginsToAlwaysOn | Synchronizes logins from the primary replica to all secondary replicas in an AlwaysOn Availability Group. |
| Command | Description |
|---|---|
Add-sqmDatabaseToDistributedAg | Adds a database to a Distributed AlwaysOn Availability Group. |
Get-sqmDistributedAgHealth | Creates a detailed health report for Distributed AlwaysOn Availability Groups. |
Invoke-sqmDistributedFailover | Initiates failover of a Distributed AlwaysOn AG. |
New-sqmDistributedAvailabilityGroup | Creates a new Distributed AlwaysOn Availability Group. |
| Command | Description |
|---|---|
Enable-sqmServiceBroker | Enables Service Broker on a specified database and creates SSB endpoint. |
Get-sqmServiceBrokerHealth | Creates a health report for SQL Server Service Broker configuration and status. |
| Command | Description |
|---|---|
Get-sqmServersFromOU | Ermittelt alle Computer-Objekte aus einer bestimmten AD-OU und gibt sie als pipefaehige Objekte aus. |
Invoke-sqmLogShrink | Shrinks the transaction log file (LDF) of one or more databases. |
Invoke-sqmRestoreDatabase | Restores a database from a backup file, with support for single-server and AlwaysOn environments. |
Invoke-sqmUserDatabaseBackup | Backs up user databases on a SQL Server instance. |
New-sqmBackupMaintenanceJob | Creates a SQL Agent job with two steps that implement the full dynamic backup maintenance workflow. |
New-sqmOlaSysDbBackupJob | Creates a SQL Agent job for the daily full backup of SQL Server system databases via Ola Hallengren's DatabaseBackup. |
New-sqmOlaUsrDbBackupJob | Creates SQL Agent jobs for FULL, DIFF, and/or LOG backups of user databases via Ola Hallengren's DatabaseBackup. |
Register-sqmBackupExcludeTrigger | Registriert oder entfernt den DDL-Trigger, der master.dbo.sqm_BackupExclude automatisch bei CREATE_DATABASE und DROP_DATABASE aktuell haelt. |
Set-sqmBackupExcludePermission | Grants SELECT, INSERT, and UPDATE permissions on master.dbo.sqm_BackupExclude to a login. |
Show-sqmBackupExcludeForm | WinForms-Dialog zur Verwaltung der Backup-Ausschlusstabelle (master.dbo.sqm_BackupExclude). |
Sync-sqmBackupExcludeTable | Creates and synchronises the backup exclude table in the master database. |
Test-sqmBackupIntegrity | Verifies one or more backup files using RESTORE VERIFYONLY. |
| Command | Description |
|---|---|
Enable-sqmMonitoringAccess | Richtet einen Monitoring-Account auf allen SQL Server-Instanzen eines Computers ein. |
Get-sqmADAccountStatus | Checks the status of an Active Directory user account. |
Get-sqmADGroupMembers | Lists all members of an Active Directory group. |
Get-sqmADGroupMembersRecursive | Lists all members of an Active Directory group with controlled recursion depth. |
Get-sqmADMemberGroups | Finds all Active Directory groups that contain a specified user, group, or computer. |
Get-sqmLoginSettings | Zeigt alle Logins mit Default-Datenbank und Spracheinstellung. |
Get-sqmSysadminAccounts | Retrieves all logins with sysadmin rights on a SQL Server instance. |
Grant-sqmTemporarySysadmin | Vergibt einem AD-Login temporaer sysadmin-Rechte fuer X Tage und entzieht sie danach automatisch ueber einen selbstloeschenden SQL-Agent-Job - bei AlwaysOn failover-robust auf allen Replicas. |
Invoke-sqmLoginAudit | Comprehensive audit of all SQL Server logins on one or more instances. |
Invoke-sqmSaObfuscation | Obfuscates the SA account on a SQL Server instance by renaming it, disabling it, and setting a random password. |
Invoke-sqmTempSysadminAction | Fuehrt die eigentliche sysadmin-Vergabe bzw. -Entziehung auf EINER Instanz aus, legt dabei optional einen fehlenden AD-Login an, entfernt ihn beim Entzug wieder und loescht optional den aufrufenden SQL-Agent-Job nach Erfolg (selbstloeschender Job). |
Remove-sqmAdOrphanLogin | Removes Windows logins whose Active Directory account no longer exists (AD orphans). |
Set-sqmDatabaseOwner | Sets the owner of one or more databases to a uniform login. |
| Command | Description |
|---|---|
Copy-sqmNTFSPermissions | Copies NTFS permissions (ACLs) from a source path to a destination path. |
Get-sqmAgentJobScheduleReport | Generates a comprehensive SQL Agent Job Schedule Report. |
Get-sqmConnectionStats | Analyzes active SQL Server connections and connection statistics. |
Get-sqmDatabaseHealth | Aggregated health report for all databases on an instance. |
Get-sqmDiskInfoByDriveLetter | Returns disk information for a given drive letter. |
Get-sqmDiskPartitionMap | Zeigt die Zuordnung physischer Datentraeger zu logischen Laufwerksbuchstaben. |
Get-sqmDiskSpaceReport | Determines free disk space on all SQL-relevant volumes and estimates time to exhaustion based on a self-collected size history. |
Get-sqmOperationStatus | Displays progress and estimated remaining time for active backup, restore and AutoSeed operations. |
Get-sqmOrphanedFiles | Finds MDF/LDF/NDF database files that are not assigned to any database. |
Get-sqmSpnReport | Checks the registered SPNs for SQL Server instances (default and named instances). |
Get-sqmSQLInstanceCheck | Checks a SQL Server instance against best practices. |
Get-sqmTempDbRecommendation | Analyzes the TempDB configuration and provides optimization recommendations. |
Invoke-sqmPatchAnalysis | Compares the installed SQL Server version with known CU/SP builds. |
Invoke-sqmSetupReport | Professional SQL Server Setup Report with critical issues, security, and database overview. |
New-sqmAgentProxy | Erstellt einen SQL Server Credential und einen SQL Agent Proxy und verbindet beide. |
New-sqmSetupReport | Builds a self-contained animated HTML replay from a setup event JSON-Lines file. |
| Command | Description |
|---|---|
Get-sqmAutoGrowthReport | Creates an AutoGrowth configuration report for all database files on a SQL Server instance. |
Get-sqmBlockingReport | Retrieves current blocking chains on a SQL Server instance. |
Get-sqmDeadlockReport | Reads and analyzes deadlock events from the System Health Extended Event session. |
Get-sqmIndexFragmentation | Analyzes index fragmentation in one or more databases. |
Get-sqmLongRunningQueries | Identifies long-running queries on a SQL Server instance. |
Get-sqmMissingIndexes | Retrieves missing index recommendations from the SQL Server DMV cache. |
Get-sqmPerfCounters | Reads SQL Server performance counters from sys.dm_os_performance_counters. |
Get-sqmServerUtilization | Collects SQL Server CPU and memory utilization trends over time. |
Get-sqmWaitStatistics | Reads and analyzes SQL Server wait statistics from sys.dm_os_wait_stats. |
Invoke-sqmExtendedEvents | Manages Extended Events sessions for performance analysis on SQL Server. |
Invoke-sqmPerfBaseline | Creates, compares or lists performance baselines (wait stats + perf counters). |
Invoke-sqmQueryStore | Configures the Query Store, reads from it, detects issues and saves reports. |
Invoke-sqmUpdateStatistics | Updates statistics in one or more databases. |
| Command | Description |
|---|---|
Invoke-sqmFormatDrive64k | Checks an NTFS drive for 64 KB allocation unit size and formats it with 65536 byte cluster size if needed. |
Invoke-sqmNtfsSetup | Grants the SQL Server service accounts NTFS permissions on the instance's data, log, TempDB and backup directories (with an ACL backup beforehand). |
| Command | Description |
|---|---|
Compare-sqmServerConfiguration | Compares important configuration settings between two SQL Server instances. |
Get-sqmServerSetting | Reads one or all server properties from a SQL Server instance. |
Invoke-sqmCollationChange | Automatically changes the server collation of a SQL Server instance. |
Invoke-sqmSetDatabaseRecoveryMode | Changes the recovery mode of one or more user databases. |
Invoke-sqmSsisConfiguration | Configures SQL Server Integration Services (SSIS) fully automatically. Supports standalone and AlwaysOn AG environments, local and remote. |
Set-sqmMaxDop | Sets MAXDOP (max degree of parallelism) to the recommended (or an explicit) value, and optionally the matching "cost threshold for parallelism". |
Set-sqmMaxMemory | Sets SQL Server "max server memory (MB)" to the recommended (or an explicit) value. |
Set-sqmSqlPolicyState | Enables or disables a single Policy-Based Management policy on a SQL Server instance. |
Set-sqmSsrsConfiguration | Configures SQL Server Reporting Services (SSRS) fully automatically. Supports local and remote installation as well as AlwaysOn environments. |
Set-sqmTcpPort | Konfiguriert den TCP-Port einer SQL Server-Instanz ueber die Registry. |
| Command | Description |
|---|---|
Get-sqmConfig | Returns the current module configuration. |
Invoke-sqmMonitoringKey | Gets or sets monitoring registry values for the sqmSQLTool on one or more computers. |
Set-sqmConfig | Sets one or more configuration values for the MSSQLTools module. |
| Command | Description |
|---|---|
Export-sqmDatabaseDocumentation | Creates structured HTML and CSV documentation for all databases on a SQL Server instance. |
Export-sqmServerConfiguration | Exports all SQL Server configuration settings to a JSON snapshot file. |
Find-sqmDatabaseObject | Searches all (or selected) databases on an instance for an object name. |
Get-sqmLinkedServerUsage | Analyzes which database objects (procedures, functions, views, triggers, SQL Agent jobs) access linked servers. |
Invoke-sqmConfigRollback | Restores SQL Server configuration from a previously exported snapshot. |
Invoke-sqmInstanceInventory | Creates a complete inventory of a SQL Server instance as a structured report (TXT + CSV). |
| Command | Description |
|---|---|
Get-sqmClusterInfo | Retrieves information about a Windows Failover Cluster: cluster name, nodes and roles including IP addresses. |
Get-sqmHpuAllowGroup | Searches for the HPU allow group in Active Directory based on configurable domain/group mappings. |
| Command | Description |
|---|---|
Get-sqmCertificateReport | Creates a comprehensive report on SQL Server certificates and their expiration dates. |
Get-sqmTlsStatus | Audits TLS/SSL configuration and certificate status for all SQL Server instances on one or more computers. |
Install-sqmCertificate | Installs a certificate (self-signed or CA-signed) in SQL Server and automatically binds it to the configured purpose. |
Install-sqmCertificateToStore | Installs a certificate file into the Windows certificate store - locally or on multiple remote computers. |
New-sqmCertificateRequest | Creates a CSR (Certificate Signing Request) and an order data sheet for a CA-signed certificate based on an existing SQL Server certificate. |
New-sqmSqlCertificate | Creates a new self-signed SQL Server certificate as a renewal of an existing one. |
Set-sqmSqlTlsCertificate | Binds a Windows certificate from the Machine store to SQL Server as the TLS certificate. |
Set-sqmSsrsHttpsCertificate | Binds a Windows certificate to SSRS or Power BI Report Server for HTTPS access. |
| Command | Description |
|---|---|
Get-sqmTsmConfiguration | Reads the IBM TSM / Spectrum Protect client configuration (dsm.opt) and returns server, user and password settings. |
Invoke-sqmTsmConfiguration | Configures the IBM Spectrum Protect (TSM) client options file dsm.opt for use with SQL Server backup directories. |
Test-sqmTsmConnection | Tests the connection to an IBM Spectrum Protect (TSM) server using dsmadmc. |
| Command | Description |
|---|---|
Install-sqmDb2Driver | Installiert den IBM DB2 ODBC/CLI-Treiber. |
Install-sqmJdbcDriver | Installiert den Microsoft JDBC Driver for SQL Server. |
Install-sqmOdbcDriver | Installiert den Microsoft ODBC Driver for SQL Server. |
| Command | Description |
|---|---|
Install-sqmSsrsReportServer | Installs SQL Server Reporting Services 2022 from a network share and automatically configures the instance afterwards. |
Invoke-sqmDeployScripts | Executes numbered SQL scripts from a directory sequentially against a SQL Server database. |
Invoke-sqmSignModule | Signs all PowerShell script files in a module directory using Set-AuthenticodeSignature. |
| Command | Description |
|---|---|
Copy-sqmLogins | Copies logins from a source SQL Server instance to a target instance. |
Copy-sqmToCentralPath | Copies one or more files to the configured CentralPath. |
Get-sqmAgentJobHistory | Displays the execution history of SQL Agent jobs. |
Get-sqmDiskBlockSize | Checks the NTFS block size (cluster size) of drives against 64KB. |
Get-sqmServerHardwareReport | Erstellt einen HTML-Hardware-Konfigurationsbericht fuer einen oder mehrere Server. |
Install-sqmAdModule | Ensures that the ActiveDirectory PowerShell module (RSAT) is installed. |
Install-sqmOlaMaintenanceSolution | Installs or updates Ola Hallengren's Maintenance Solution on a SQL Server instance. |
install-sqmolammaintenance solution | — |
Invoke-sqmSplunkConfiguration | Configures the Splunk Universal Forwarder on SQL Server hosts. |
New-sqmOlaMaintenanceJobs | Creates three SQL Agent jobs for Ola Hallengren's Maintenance Solution: IndexOptimize (user DBs) and IntegrityCheck (user and system DBs). |
New-sqmRandomSaPassword | Generates a random, policy-compliant SA password. |
repair-sqmalwaysondbases | — |
Show-sqmToolGui | Launches a small graphical interface (WinForms) for all sqmSQLTool functions. |