Category: PowerShell

Operational Validation Testing of SQL Server with PowerShell and Pester this weekend at SQL Saturday Baton Rouge

If you're interested in a free day of PowerShell training, there are numerous sessions on different topics in the dedicated PowerShell track at SQL Saturday #628 in Baton Rouge, Louisiana this Saturday, July 29th. I'll be presenting a session on how to "Automate Operational Readiness and Validation Testing of SQL Server with PowerShell and Pester". Here’s a little information about what you can expect from my session: Automate Operational Readiness and Validation Testing of SQL Server Read more [...]

Remove all user defined variables without restarting the PowerShell Console or ISE

Recently, fellow Microsoft MVP Mickey Gousset asked me how to remove existing user defined variables from the PowerShell ISE (Integrated Scripting Environment) before running a script a second time without having to restart the ISE. While you could keep track of the variables you've used within your script to remove them once the script completes with the Remove-Variable cmdlet or by deleting them from the variable PSDrive, that can be a less than desirable solution for long and complicated scripts Read more [...]

Copy databases from 5 different SQL Servers in 100 seconds with the DBATools PowerShell Module

As referenced in my blog article from yesterday, I'll be presenting a PowerShell 101 session at SQL Saturday Atlanta tomorrow morning (July 15, 2017). While I plan to cover the basics of PowerShell, I also plan to show you what you can do with PowerShell without having to write very much code at all. I'll be killing it in my session with live demos including this one that I've made a video of as a sneak preview. https://youtu.be/wBEqHwmM-z8 If the video embedded in this webpage doesn't display Read more [...]

Presenting PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell this weekend at SQL Saturday Atlanta

If you're interested in some free PowerShell training where you'll learn the basics of PowerShell from a best practices standpoint, I'll be presenting a session on "PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell" at SQL Saturday #652 in Atlanta, Georgia this Saturday, July 15th. My presentation begins at 8am eastern time and is a beginner level session. There's also a Powering Azure from PowerShell session that Microsoft MVP Robert Cain is presenting at 2:15pm. Here’s Read more [...]

Encrypt a Password with PowerShell for use by a Different User and/or on a Different Computer

Storing a password in an encrypted file for use by the same user on the same computer using PowerShell is fairly easy, but storing a password in an encrypted file for use on another computer or by another user is a bit more challenging. It requires the use of a key file and of course if someone else can read the key file, then they also can decrypt the password. In my scenario, I work in a VDI (Virtual Desktop Infrastructure) environment that doesn't use persistent desktops and I need to have Read more [...]

Renewed as a Microsoft Cloud & Datacenter Management MVP

I'm honored and humbled to have been awarded the Microsoft MVP award for a fourth consecutive year. I received email notification yesterday confirming that I've been renewed for another year. The first two Microsoft MVP awards that I received were for PowerShell and due to changes to Microsoft's MVP award program, the latest two have been for Cloud and Datacenter Management, although my focus is still PowerShell. In addition to being a multiyear recipient of the Microsoft MVP award, I'm also Read more [...]

Automatically Customizing the PowerShell ISE on Startup

This past weekend while at SQL Saturday Chattanooga, I was asked if it was possible to have the PowerShell ISE (Integrated Scripting Environment) automatically open with a right/left split pane: Instead of the top/bottom default split pane: One thing to note is that by default the PowerShell ISE will reopen in whatever configuration you close it in, which could be either of the ones previously shown or the full screen editor. If you want the ISE to open with a certain configuration Read more [...]

Presenting PowerShell Non-Monolithic Script Module Design this weekend at SQL Saturday Chattanooga

If you’re interested in some free PowerShell training, I’ll be presenting a session on "PowerShell Non-Monolithic Script Module Design" at SQL Saturday #624 in Chattanooga, Tennessee this Saturday, June 24th. My presentation begins at 1:15pm eastern time and is an intermediate level session. There's also a PowerShell precon on Friday being presented by Microsoft MVP Aaron Nelson (the precon is not free) and a PowerShell DSC (Desired State Configuration) session on Saturday being presented Read more [...]

Simple Obfuscation with PowerShell using Base64 Encoding

I recently received a question from someone wanting to know how I encoded a string of text on my blog site. Back in January of 2013, I competed in Jeff Hicks PowerShell Challenge that was held by TrainSignal. One of the questions had an encoded command which you were to decode. I figured out that the -EncodedCommand parameter of PowerShell.exe could not only be used to run commands that are encoded with Base64, that it could also be used to easily decode a string of text that was encoded with Base64. The Read more [...]

What is this Module Scope in PowerShell that you Speak of?

Last week I posted a blog article about a PowerShell script module that I had written with a few proof of concept commands to manage a Nimble Storage Area Network using their REST API. That module used a command to connect and authenticate to the storage device which needed to share a token with other commands in the module otherwise authentication would have to be performed for each command. I initially placed the token in a global variable even though I mentioned in the blog article that I’m Read more [...]

PowerShell and the Nimble Storage REST API

If you read my previous blog article on "PowerShell Function to Determine the Installed VSS Providers" then you're already aware that I recently migrated one of my customers to a Nimble Storage Area Network. While Nimble does have a PowerShell module and it's decent, I wanted to see how difficult it is to work with their REST API directly with PowerShell. Their REST API documentation also seems to be decent. Note: All of the functions shown in this blog article are a proof of concept and should Read more [...]

PowerShell Function to Determine the Installed VSS Providers

I've been migrating one of my customers from some older EqualLogic storage area networks to a Nimble SAN. It has all been good with the exception of some problems with VSS (Volume Shadow Copy Service). They use Altaro for backups and from what I've found, Nimble and Altaro don't play well together when it comes to VSS. Nimble's software was installed on the Hyper-V hosts and all three vendors (Nimble, EqualLogic, and Altaro) VSS providers seemed to play well together until volumes were actually moved Read more [...]

Use PowerShell to Determine if Specific Windows Updates are Installed on Remote Servers

It has been a crazy week to say the least. If you're like me, you wanted to make sure that the specific Windows updates that patch the WannaCry ransomware vulnerability have been installed on all of your servers. I've seen a lot of functions and scripts this week to accomplish that task, but most of them seem too complicated in my opinion. While it's personal preference, I also always think about whether I should use a PowerShell one-liner, script, or function. Usually one-liners are something Read more [...]

Retrieve Information about your Favorite Podcast with PowerShell

This past weekend, I attended the 2017 Atlanta MVP Community Connection. While there, I met fellow Microsoft MVP Allen Underwood who is one of the co-host of the {CodingBlocks}.NET podcast. I listened to their podcast on my trip back home from Atlanta and later discovered that their podcast has an RSS feed for episodes. A simple PowerShell one-liner can be used to retrieve information about each episode of their podcast: Keep in mind that a PowerShell one-liner Read more [...]

PowerShell Function to Determine PSSessions to your Servers

This past week, I needed to determine if anyone had a PSSession connected to any of the servers that I support. This is fairly easy to accomplish with a PowerShell one-liner, but I can never remember the syntax so I decided to create a reusable function to accomplish the task. The function accepts multiple computer names via parameter input: It also accepts the computer names via pipeline input and it has a Credential parameter Read more [...]