Press "Enter" to skip to content

Category: Powershell

Adding Timeouts to Pester Tests

Adam Bertram runs out of time:

Have you ever had a Pester test hang indefinitely, blocking your entire test suite? Maybe it’s waiting for a network response that never comes, or stuck in an infinite loop. Without proper timeout handling, one bad test can ruin your entire CI/CD pipeline.

In this article, you’ll learn how to implement robust timeout handling for Pester tests using PowerShell runspaces, ensuring your test suite always completes in a predictable timeframe.

Click through for the code and explanation.

Leave a Comment

Testing Database Backups with dbatools

David Seis performs a test:

In this blog post, we will audit the dbatools command Test-DbaLastBackup. I will test, review, and evaluate the script based on a series of identical steps. Our goal is to provide insights, warnings, and recommendations to help you use this script effectively and safely. Test-DbaLastBackup is a powerful tool to automate the validation of a backup. Backup testing should be a regular part of SQL Server maintenance and this command works well in automating this task.

Click through for a dive into the cmdlet. I’m a big fan of this cmdlet because it drastically simplifies the process of ensuring that your backups are good.

Leave a Comment

The FabricTools Powershell Module

Kamil Nowinski has a module for us:

In the world of Microsoft Fabric, DevOps is still maturing. Unlike Azure Data Factory (ADF), which has been around long enough to have established tooling – like the #ADFTools I developed 5 years ago – Fabric is new, broad, and complex, in a very positive way!

Microsoft Fabric integrates data engineering, warehousing, real-time analytics, and BI. With this scale, the need for solid DevOps tooling is more critical than ever.

Click through to read a little bit of the history behind the project, as well as what’s currently available. And it’s all free and open-source.

Leave a Comment

Restoring a Database via dbatools

David Seis digs into the Restore-DbaDatabase cmdlet:

In this blog post, we will audit the dbatools command Restore-DbaDatabase. I will test, review, and evaluate the script based on a series of identical steps. Our goal is to provide insights, warnings, and recommendations to help you use this script effectively and safely. Restore-DbaDatabase is powerful tool to automate the restore of any database, and it works well in automated solutions such as daily refreshes or weekly refreshes of production to a lower environment.

David’s blog post takes a look at the cmdlet’s functionality, but also thinking about it from a security perspective.

Leave a Comment

Listing Items in a Fabric Workspace using Powershell

Rob Sewell continues a series on working with Microsoft Fabric assets via Powershell:

Having created a workspace, a lakehouse, a warehouse, a Fabric SQL database previously, it’s time to move onto something a little more interesting. I was getting bored writing the same post over and over again, so I thought I would show you how to list the items in a Fabric Workspace using PowerShell. This command was super useful for me today to answer the question “What do they have in this workspace?” and I hope it will be useful for you too.

Click through to see how you can accomplish this.

Comments closed

Creating Fabric Databases via Powershell

Rob Sewell has a trio of posts. First up, Rob creates a warehouse:

We are going to use [FabricTools, a PowerShell module that simplifies the management of Microsoft Fabric resources. You can find it on GitHub at[FabricTools provides functions to create, update, and delete Fabric warehouses and other resources. It has been developed and is maintained by members of the community.

Next up is a lakehouse:

Having created a Microsoft Fabric workspace using PowerShellassigned users to it using PowerShell, and created a Microsoft Fabric Warehouse using PowerShell, we now turn our attention to creating a Microsoft Fabric Lakehouse using PowerShell. These posts all look remarkably similar 🙂 and thats because the functionality they are showing is exactly same..

Just like dbatools and dbachecks creating functions that follow the same pattern makes it easier to learn. This is why FabricTools has chosen to use the same pattern for creating Fabric resources using PowerShell.

And from there is a Fabric SQL Database:

Fabric SQL Database is a SQL Database that is hosted in Microsoft Fabric. It provides a fully managed SQL database service that allows you to store and query your data using SQL using the same SLQ Engine as Azure SQL Database.

Click through for examples of all three.

Comments closed

sudo in Windows

Patrick Gruenauer elevates our access:

Sudo for Windows is a new way for users to execute commands with elevated privileges (as an administrator) directly from a non-relevant console session on Windows.

The following requirements apply to the use of sudo in Windows:

  1. Windows 11 24H2
  2. Sudo needs to be enabled

Click through to see how to activate sudo. The English-language header reads “System > For Developers” and the exact setting is at the bottom of the first section and has the name “Enable sudo” with a toggle switch. The number of times I’ve run a command just to see it error out because I needed to be in an administrative command prompt or PowerShell terminal is high enough that I immediately turned it on.

But importantly, this is different from Linux, in that it opens up a new command prompt or PowerShell terminal rather than executing the command with elevated permissions in the same prompt. This is important because that new prompt goes away after the command finishes, so you lose the output. In other words, if you run sudo ipconfig in a command prompt, it will hit you with a UAC request (depending on how you’ve configured your PC) and then run ipconfig in a new command prompt, which disappears as soon as the command finishes. You don’t get to keep what was in stdout. I think this limits some of the capability of the option, unfortunately.

Comments closed