Press "Enter" to skip to content

Category: Powershell

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

How to Disable a SQL Agent Job via Powershell

Tom Collins gets a question:

I have a  SQL Server Agent job  in a disabled status. The disabled status is  applied to the SQL Agent Job and the associated schedule.  The problem is I’m logged on as a full administrator onto the Windows Server – and as BUILTIN\Administrator is defined on the SQL Server , but am able to manually override the SQL Agent Job.   

Is there a way to Disable the SQL Agent Job where I’m not able to manually override the job?

Click through for the answer.

Comments closed

Removing Indexes by Name from Multiple SQL Servers

Jana Sattainathan doesn’t have time to click-and-repeat:

This is something I had to do today. In this blog post, I am going to show you how you can disable or remove indexes matching certain name criteria or other condition(s) across multiple servers and databases in various tables. Usually, this is a very painful process if done by hand but with the fantastic work done by the dbatools team, it becomes quite easy.

Read on for the Powershell script.

Comments closed

Enabling SSH Remoting with Powershell 7

Patrick Gruenauer makes a remote connection:

With Powershell 7, we can enable and use SSH Remoting. Unlike WinRM, SSH is more popular because it is a more familiar technology and is also available on other platforms. In this post I will show you how to easily enable SSH on PowerShell 7 with a few lines of code.

Click through to see what you need to install on the machine and how to configure everything.

Comments closed

A WPF-Based Countdown Timer

Jeffrey Hicks keeps track of time:

Last year I released a PowerShell module called PSClock. The module contains a command to create a transparent WPF form displaying a clock. Shortly after, someone posted a request for a countdown timer. Not an unreasonable request and one I finally got around to implementing. However, I already had a module with a number of timer and countdown-related commands called PSTimers I had been thinking of a WPF-based timer, so this solved two problems.

Read on to see how it works.

Comments closed

Thoughts on Publishing a Powershell Module

Shane O’Neill reflects on pushing a Powershell module into the Gallery:

I’ve worked with PowerShell for years but have never published a module before. I’ve helped write changes to a few, e.g. dbatoolsdbachecks, and a few internal ones.

But the actual creating and publishing one needs adding to my experience list.

There was a lot of gnashing of the teeth, wailing of the cries, and reading of the documentation.

Read on for a few tips from Shane. You’ll probably still need to read the documentation…but maybe not as much?

Comments closed

Finding Outdated Powershell Modules

Jeff Hill has a script for us:

In the world of PowerShell, some things move super fast while others may stay the same for years. If the module you are using does what you want with no issues, you may not think to see if a newer version is available. The PSReadline module is a good example. The version I was on worked great and it did what I wanted. I had no idea there was so much more that had been done.

Click through for a script which checks the Powershell Gallery for updates, though it does not force install those updates.

Comments closed