Press "Enter" to skip to content

Category: Powershell

WinGet and Path Not Updating

Justin Bird ran into some trouble:

Whilst I predominantly use MacOS, I do have to run a Windows VM for certain apps (cough Power BI cough). I ran into an issue recently when trying to installing apps on a vanilla Windows 10 build using Winget via the terminal in VS Code.

After installing the app, I found that the PATH environment variable was not updated, which meant I couldn’t run the app from the command line without specifying the full path.

Read on to learn what the issue was and how Justin was able to fix it.

Leave a Comment

PSBlitz 6.1.0 Released

Vlad Drumea has a new version of PSBlitz:

For anyone not familiar with PSBlitz: it’s a PowerShell-based tool that outputs SQL Server health and performance diagnostics data to either Excel or HTML, and saves execution plans and deadlock graphs as .sqlplan and .xdl files.

If you’re familiar with Oracle, this is pretty much my attempt of a SQL Server equivalent to Oracle’s AWR report.

Feel free to check out the blog post announcing PSBlitz 4 years ago, as well as the 3 year anniversary post.

Read on to see what Vlad has added.

Leave a Comment

Building a Multi-Instance Health Check with Powershell

Garry Bargsley puts it all together:

Over the past four weeks, you’ve built a real foundation. You know that single quotes are literal and double quotes expand variables. You know how to store and use data in variables – strings, integers, booleans, and hashtables. You know how to loop over a collection and do something useful to each item, including handling errors when a server doesn’t cooperate.

Now we put it all together. No new concepts this week, just everything you’ve learned working as a single, practical script that solves a real DBA problem. Think of it as your Jedi trials. The training is done. Time to use the Force.

Click through for the script. It’s fairly simple in terms of what it’s actually doing, but gives you a good idea of the types of things you can do.

Leave a Comment

Get-SqlSafe: A Baseline Assessment for SQL Server Security

Andreas Wolter has a new tool:

In my experience with SQL Server security assessments, many environments show typical patterns: excessive permissions, weak or missing auditing, legacy authentication exposure, risky configuration choices, and ownership or access-control drift accumulated over years.

Get-SqlSafe Community Edition was released to give teams and also consultants a practical first look at those high-level indicators. It is a free PowerShell-based assessment tool for Microsoft SQL Server, supporting all versions from SQL Server 2016-2025 that helps surface baseline issues before they turn into deeper security problems.

Click through for the link where to grab Get-SqlSafe Community Edition, as well as more information on how it works.

Leave a Comment

ForEach Loops in Powershell

Garry Bargsley continues a series on Powershell capabilities:

Welcome back to PowerShell Strikes Back. We’re three weeks in, and the training is paying off. In Week 1, we learned that quotes are not interchangeable. In Week 2, we put variables to work – storing server names, config values, service objects, and boolean results. If you’ve been following along and running the examples in your own environment, you’re already writing better PowerShell than you were a month ago.

This week, we tackle the concept that transforms a script from a one-time operation into an actual tool: the ForEach loop.

Garry also ties in error handling, which is important during loop iteration.

Leave a Comment

Working with Variables in Powershell

Garry Bargsley is a wild card:

Last week, we learned that quotes are not created equal. This week, we’re going deeper into the building blocks that make PowerShell scripts actually useful: variables.

If quotes are your lightsaber, variables are the Force itself. They carry information from one part of your script to another. They make the difference between a script that works on one server and a script that works on all of them. Get comfortable with variables, and you’ll look back at your pre-PowerShell DBA life the way Luke looked back at Tatooine – relieved to be moving on.

I can tell when Garry wrote this one.

Leave a Comment

Building a Health Check with dbatools

David Seis has a dashboard:

After a longer break than expected, I am back to the dbatools for SQL Server DBAs blog series, and this one is a monster! In fact, this project is so big that I think it will be better to release it incrementally. This will allow you clone the repository, test and modify it in your own environment and come back for free updates over the weeks/ months to come. It is designed to allow you to customize it to your environment’s needs. This first post will be the initial process overview as well as the first set of checks and how to navigate the report.

Click through to see what David has in store.

Comments closed

PSBlitz Updates

Vlad Drumea has a changelog:

For anyone not familiar with PSBlitz: it’s a PowerShell-based tool that outputs SQL Server health and performance diagnostics data to either Excel or HTML, and saves execution plans and deadlock graphs as .sqlplan and .xdl files.

If you’re familiar with Oracle, this is pretty much my attempt of a SQL Server equivalent to Oracle’s AWR report.

Click through for updates, screenshots, and one breaking change.

Comments closed

Configuring a New Windows Device via Chocolatey

Reitse Eskens writes a script:

Last month, my company got me a new laptop. I have very little choice in which one I get, and I have to reinstall a lot of software. So, what to do next?

Click through for an example of such an installation script. Having one or more Chocolatey scripts does help, especially for fairly stable corporate machines. I’ve found it to be moderately useful for home devices, where I tend to cycle through software a bit more frequently. But it does make the process of rebuilding a Windows-based machine less painful.

On the Linux side, this is more built-in. For anything via repo managers (such as apt or yum), you can list your installed packages and turn that into a script. It’s a similar story for snap or flatpak packages, though maybe a little bit less conveneint. For AppImage files or deb/rpm files you installed separately from the repo, it’s a bit more of a mixed bag.

Comments closed

Managing Eventhouses and Environments with MicrosoftFabricMgmt

Rob Sewell continues a series on the MicrosoftFabricMgmt module. First up is a dive into the Kusto world:

Real-Time Intelligence (RTI) is Microsoft Fabric’s answer to streaming data workloads. If you are ingesting telemetry, IoT data, clickstreams, or any high-velocity data that needs querying with low latency, this is the part of Fabric you want. MicrosoftFabricMgmt supports the full set of RTI resources: Eventhouses, KQL Databases, KQL Dashboards, KQL Querysets, and Eventstreams.

Rob then pivots to creating an environment from scratch:

Over the past few posts we have worked through a number of the item choices that you can use in the MicrosoftFabricMgmt module. Today I want to bring it all together into a single, practical script that provisions a complete Fabric environment from scratch.

This is the kind of script I could use when setting up a new project. It is repeatable, idempotent (safe to run multiple times), fully logged, and handles errors gracefully.

Comments closed