Press "Enter" to skip to content

Category: Powershell

Tools for the DBA Jumpbox

Tracy Boggiano has a script:

I wrote a blog post a few months ago about the tools I use on my jumpbox you can read here.  Since then, I have automated most of the install with Chocately and so I’ll have the script later I’m going to blog it here.  First, we need to install Chocately on the jumpbox by opening PowerShell as the adminstrator.

Read on to see how to do that, the installation of a slew of tools via Chocolatey, and then several Powershell modules.

Comments closed

Creating a Multi-Function Powershell Module

Patrick Gruenauer builds a module:

In this blog post, I will show you how to create a module with multiple functions using an example. You will see that this is not rocket science. Let’s jump in.

In order to use multiple functions in a module, we have to declare them as functions to export. This also means we need a module manifest file with that statements in it.

Read on to see what it takes to build a module in Powershell.

Comments closed

Good Practices for Powershell Development

Jeff Hicks shares some good practices with us:

Over the course of the last several weeks, I’ve been sharing and demonstrating techniques for writing effective PowerShell functions. I know I’ve mentioned a few recommended best practices. But since they are important, I want to review and re-emphasize them. These practices will make your code easier to write, easier to debug or troubleshoot, and more secure. I’d like to think some of them are simple, common sense, but sometimes we need someone to remind us. These items are not in any particular order.

There are some Powershell specifics here but most of the advice is language-agnostic.

Comments closed

Using Power BI Powershell Cmdlets

Reza Rad explains the value of the Power BI Powershell cmdlet set:

Power BI has a set of PowerShell Cmdlets that help automate part of the operations with Power BI. However, PowerShell is not a commonly familiar technology. In the world of Power BI, we are used to working with graphical options and settings provided in the tools and the service. However, using commands provided for Power BI in a command/scripting tool such as PowerShell can be an excellent asset for a Power BI administrator, architect, and developer. In this article and video, you will learn about the PowerShell Cmdlets for Power BI, what they are, how they can be helpful, and examples of using them.

There are more modules than I expected there to be and Reza does a good job of walking through them.

Comments closed

Finding Blockers in Azure SQL DB + MI

Jose Manuel Jurado Diaz writes a program:

Today, I worked on a service request that our customer is looking for all blocking issues that is happening in their database. We have many articles about it Lesson Learned #22: How to identify blocking issues? – Microsoft Community Hub and in Diagnostics Settings and QDS we can collect this information but all points to that we cannot see the TSQL that is blocking and TSQL command that is blocked in an easy way. In the following script that I share as a script example we could take this one. 

First of all, please, remember that a blocking issue is normal and fundamental for any RDBMS. This script is basically when you need to understand what is happening to improve or reduce this.

I was a little surprised the answer wasn’t to use Extended Events, though this does work if you simply need something to run in ad hoc scenarios.

Comments closed

Reverse File Order and Rename via Powershell

Jana Sattainathan gets things backwards and then forwards:

In the case of this app, I just did “Select All” within the app and moved all the videos over to “Photos”. When I downloaded the content to my computer, I noticed that it downloaded the most recently downloaded video first and the oldest video last. This meant the file names given to the videos were in reverse order of chronological order.

Read on to see how you can use Powershell to sort this all out.

Comments closed

Ignoring Warnings in Powershell

Kenneth Fisher puts a sticky note over the blinking red light so it won’t bother him anymore:

Ok, great! Good information. Not something that affects me right now but still helpful to know. And I really appreciate the fact that going forward I can expect this type of information.

I found this information less useful and less appreciated after I put it into a loop and it ran ~40 times in a row, hiding any real information beneath a pile of warnings. Fortunately, right there in the warning there is a helpful note on how to suppress it

Read on for the story of why this message popped up, as well as how to prevent it from popping up and Kenneth’s medium-term plan for dealing with it.

Comments closed

Just Enough Administration and Granting Access to SQL Server

Andrew Pruski tries out a tool:

We’ve all been there as DBAs…people requesting access to the servers that we look after to be able to view certain things.

I’ve always got, well, twitchy with giving access to servers tbh…but what if we could completely restrict what users could do via powershell?

Enter Just Enough Administration. With JEA we can grant remote access via powershell sessions to servers and limit what users can do.

Click through to see how it works.

Comments closed