Use case · SQL Server
Run SQL maintenance scripts without the 'oh no' moment.
Invoke-Sqlcmd and dbatools automation, with the SQL inside the query string read as carefully as the PowerShell around it.
No card required. Your script is never executed.
Three patterns we flag
Deletes every row
Invoke-Sqlcmd -Query "DELETE FROM dbo.Events"Drops a database on the wrong instance
Remove-DbaDatabase -SqlInstance $server -Database $db -Confirm:$falseGrants sysadmin to a service login
Invoke-Sqlcmd -Query "ALTER SERVER ROLE sysadmin ADD MEMBER [svc_app]"
Sample: purge-audit.ps1
Real pattern, synthetic script. SQL changes every row in a table.
What we check
- DELETE and UPDATE without WHERE
- DROP and TRUNCATE statements
- Login and server-role changes
- Instance and database targeting from variables
Check the next script before it runs.