Skip to content

PowerShell

How to patch SQL Server instances with Qualys Patch Management

By one of our Customers, I have to use Qualys to patch their production SQL Server instances. And to be more precise the Qualys Patch Management application which provides a solution to manage vulnerabilities and deploy patches to secure and keep assets up-to-date.I will use the job functionality of Qualys Patch Management to automate the patching based on a specific… 

Set SQL Server Trace Flags Automatically and Smoothly

Managing SQL Server trace flags effectively is a common task for DBAs and system engineers, especially when tuning the SQL Server behavior for specific use cases or performance optimizations. While trace flags can be enabled programmatically using T-SQL commands such as DBCC TRACEON, this approach has an inherent limitation: the flags are session-based or global only until the SQL Server… 

Starting with PowerShell 7 and parallelization

For the time being Windows PowerShell 5.1 is installed with Windows Server. It means that if you want to use or even test PowerShell 7 you need to install it by your own.To be honest, even if I’m using PowerShell as a DBA more or less every day, I did not take too much care of PowerShell 7 until I… 

Make SQL Server services more secure with Managed Service Accounts

In the past years, I actively have been involved in securing MSSQL Instances (and other services).This lead me to use the Managed Service Accounts (MSA) and the grouped Managed Service Accounts (gMSA)The MSA have been introduced in Windows Server 2008 R2 and the gMSA in Windows Server 2012. I. What exactly are MSA or gMSA MSA (Managed Service Accounts) or… 

Move SQL Server database files to different folders with PowerShell

In my previous post, I explained how to move SQL Server databases files programmatically by leveraging the high availability of an Availability Group (AG).But when you can afford to have a database unavailable for a short time, and if it is of a reasonable size, then an offline approach may be desirable. This will have the advantage of also working… 

Move secondary database files in SQL Server AG with PowerShell

For some circumstances, you may want to move data and log files for a database to a different location.Usually, this operation has to be made offline. But with an Availability Group (AG) environment, it is possible to choose an approach which is slightly transparent. If you have a lot of databases to process, you may want to automate this operation:… 

Installing Azure AZ Module on Windows

Since Azure (or AzureRM) module is marked as deprecated some years ago, AZ module is the official replacement to manage Azure resources with PowerShell. This module is running with at least PowerShell 7.0.6 LTS (Long Term Support) or PowerShell 7.1.3, but higher versions are recommended. When PowerShell from 1.0 to 5.1 are component of Windows operating systems, PowerShell 7 is… 

dbachecks: how to add your own checks

As a DBA I used more and more the dbachecks at customer place to validate environments. It became part of our DBA toolkit at the same place than its famous brother the dbatools.My colleague Steven Naudet did a blog-post some weeks ago about it and today I will show you how is it possible to add your own checks if… 

Patch a SQL Server instance automatically with PowerShell

In my last blog post I explained how to automatically download the last Service Pack and Cumulative Update for all versions of SQL Server.Here I will show you how to patch your SQL Server instances automatically with some cmdlets from the dbatools. First we need a SQL Credential to be able to remotely connect to the server where we will… 

Azure Resource Inventory: Managed instance integration

Intro Let me present you in this Blog post a useful tool to asset your Azure environment and in a second step show you how to add Azure SQL managed instance in the assessment report. ARI presentation Azure Resource Inventory is an open-source project developed in PowerShell that allows you to quickly generate a complete Excel report of your Azure…