Category: PowerShell

Registration for the PowerShell & DevOps Global Summit 2018

Registration for the PowerShell & DevOps Global Summit 2018 opens on Wednesday, November 1st which is less than one week away. I've attended every one of these conferences that have been held in North America since its inception 5 years ago. I speak from experience when I say now is the time to ask for approval to attend this conference because it has sold out each year and it's not a matter of if it will sell out, but when will it sell out? The event brochure has lots of great information Read more [...]

Configure Internet Connection Sharing with PowerShell

My test environment runs as Hyper-V VM's on my IBM Thinkpad P50. I use ICS (Internet Connection Sharing) to shield my Hyper-V test environment virtual network from my production network connection. ICS allows me to temporarily give my test VM's Internet access when needed without putting them directly on the production network. You might ask why? Because my test environment VM's run things like DHCP servers that would cause havoc on the production network. I use an Internal virtual switch with Hyper-V Read more [...]

Windows Server 2016 Automation with PowerShell Cookbook – Second Edition

One of the projects that I've been a part of this year that's now complete is Windows Server 2016 Automation with PowerShell Cookbook - Second Edition written by Thomas Lee and published by Packt Publishing. I personally read each and every page of the book while it was being written along with testing every single line of code in each of the recipes in the book. According to the book's webpage on the Packt Publishing website, it has more than a hundred recipes and we're not talking about one-liners. While Read more [...]

Presenting The No-Nonsense Beginner’s Guide to PowerShell for the Austin PowerShell User Group on October 5th

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” for the Austin PowerShell User Group this Thursday, October 5th. The presentation begins at 6pm central time and is a beginner level session. Here’s a little information about what you can expect from the presentation: Interested in PowerShell but Read more [...]

Regions now available in VSCode Insiders Build version 1.17.0

Today, David Wilson from the PowerShell team at Microsoft, announced that Regions are now available in VSCode (Visual Studio Code) as of insiders build version 1.17.0. I was hoping the region and endregion keywords would be case-insensitive unlike in the PowerShell ISE where they're case-sensitive. It looks like that's indeed what they intended since the region keyword is case-insensitive in VSCode, but unfortunately the endregion keyword is case-sensitive as shown in the following example. There's Read more [...]

PowerShell Toolmaking session this Saturday, September 30th at Gulf Coast Code Camp 2017 in Mobile, Alabama

Got no training budget? This Saturday, September 30th, is your opportunity to show some initiative by leveling up your skills on your own time and at your own expense (it's free) at Gulf Coast Code Camp 2017. The venue is at the University of South Alabama and features 16 speakers who are experts in the technology space. While I can't speak for everyone else who is presenting, my session begins at 9:40am central time where you'll learn the industry's best practices for PowerShell Toolmaking with Read more [...]

Not Specifying a Verb in PowerShell is an Expensive Shortcut

When working with PowerShell, there are lots of shortcuts that can be taken and while some of them may seem like a good idea at first, they usually end up costing you more trouble than they're worth in the long run. I recently saw a Tweet that a fellow PowerShell enthusiast Tore Groneng‏ responded to which referenced running commands in PowerShell without specifying a verb. Such as "Service" for Get-Service. That works great, right? Not so fast. It might Read more [...]

Detect the presence of and remove CCleaner with PowerShell

Based on the news today, I thought I would share a couple of PowerShell code snippets to detect the presence of and silently uninstall CCleaner. You can detect the presence of CCleaner along with the version of it you have installed via the registry. You can use a similar command to run its uninstaller silently if it's detected. Give it a couple of minutes and then run the first command again to verify it has been removed. If Read more [...]

PowerShell Version 2 Compatible Function to Determine Windows Firewall State

I recently had a need to perform some security auditing on an environment that still has some servers running PowerShell version 2 (PowerShell version 2 is deprecated). One of the things I needed to determine was whether or not the Windows firewall was enabled on each of the servers in the environment. Luckily, all of the servers at least had PowerShell remoting enabled. The PowerShell function shown in the previous code example is a wrapper for the Netsh.exe command. Read more [...]

Remotely cleanup log and temp files from your Windows based servers with PowerShell

Setting up a scheduled task or job on individual servers to cleanup log and temp files just doesn't scale very well because you have scheduled tasks or jobs setup on lots of individual servers that need to be maintained. Today it's this server and tomorrow it's two or three more. It's much easier to setup one scheduled task or job on a server that's designed for management to remotely cleanup the desired files on all of your servers. The following log and temp file cleanup script is provided as Read more [...]

Using Out-GridView to simplify selecting the region when managing Microsoft Azure with PowerShell

You've signed up for a Microsoft Azure account and you've installed the Azure Resource Manager PowerShell cmdlets on your computer. You login to Azure from PowerShell. You'll normally see most people use Login-AzureRmAccount, but that command is an alias (Login isn't an approved verb). Login to Azure and provide the account login information when prompted: Several of the cmdlets in Read more [...]

How to install Visual Studio Code and configure it as a replacement for the PowerShell ISE

If you follow me on Twitter, then I'm sure you're aware that I've been using nothing but VS Code (Visual Studio Code) as a replacement for the PowerShell ISE (Integrated Scripting Environment) for the past couple of weeks and while I had tried it in the past, I didn't previously think it was ready for prime time. That's now changed with all of the updates and work that has gone into it. From what I've found, it works fairly well flawlessly so I've created a short and simple video to help others Read more [...]

VS Code Rendering Problem in the PowerShell Integrated Terminal

I recently discovered a rendering problem in VS Code where pressing escape doesn't delete a multi-line command in the PowerShell integrated terminal. I created a video to report the problem and I thought I would share it here since the quality was less than optimal when sharing it on Twitter. Here's a link to my original tweet to David Wilson and here's a link to the GitHub issue that Max Trinidad has created. µ Read more [...]

PowerShell One-Liner to Audit Print Jobs on a Windows based Print Server

You've been tasked with auditing print jobs on your company's Windows based print server to determine who is wasting so much paper, toner, and causing excessive wear and tear on printers. No budget exists for this task and you need to have something to show by the end of the day. You would probably start off by searching the Internet, but most of the results you'll find to accomplish this task are over-complicated or simply don't work. Luckily this task can be accomplished with a PowerShell one-liner. Read more [...]

PowerShell PackageManagement and PowerShellGet Module Changes in Windows 10 Version 1511, 1607, and 1703

Recently, I reloaded my computer and noticed a problem when I tried to install the latest version of the Pester PowerShell module using PowerShellGet. I loaded Windows 10 version 1703 (the creators update) which has PowerShell version 5.1 installed by default: Pester version 3.4.0 ships with both Windows 10 version 1607 and 1703. Both of these versions of Windows and/or PowerShell seem to work differently than previous versions when updating and/or installing Read more [...]

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

Late last night I received an email about a session being cancelled at SQL Saturday #628 in Baton Rouge which is scheduled for tomorrow, Saturday, July 29th. I'll be presenting my PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell session in that time slot which is the first session of the day in the PowerShell track, beginning at 9:15am. I've presented this session a couple of times this year at other events and I've tweaked it each time based on the feedback I've received. Read more [...]