Tag: PowerShell

Determine the Default Password Policy for an Active Directory Domain with PowerShell

I've been working with PowerShell since the version 1.0 days and I'm still amazed that I find cmdlets that I didn't know existed. Back in 2003, I had written some PowerShell code to query group policy for the lockout policy of an Active Directory domain. It used code similar to what's shown in the following example which requires the GroupPolicy PowerShell module that installs as part of the RSAT (Remote Server Administration Tools). I recently discovered that Read more [...]

Test Active Directory User Accounts for a Default Password with PowerShell

How do you control password resets in your environment? I've worked for numerous companies where their forgotten password reset process was all over the board. Hopefully you have a process in place that allows you to sleep at night. Even with the best policies and procedures in place, what happens when someone on your help desk staff resets a users password to some default password and forgets to set the account so the password has to be changed at next logon? Is the user still using that default Read more [...]

Video: PowerShell Non-Monolithic Script Module Design

This past Tuesday night, I presented a session on "PowerShell Non-Monolithic Script Module Design" for the Arizona PowerShell Users Group. The video from that presentation is now available. The presentation begins at 10 minutes and 30 seconds seconds into the video. https://www.youtube.com/watch?v=XH7ajz3WT0A#t=10m30s The presentation materials to include the slide deck and code can be found in my presentations repository on GitHub. µ Read more [...]

PowerShell Function to Determine the Hyper-V Host for a VM

This week, I thought I would share a PowerShell function that I wrote to determine what Hyper-V host server a VM (virtual machine) resides on. In this scenario, you have no idea which Hyper-V host a VM resides on. First off, let me say that this function is written a bit unorthodox. Typically you'll see functions written where each item in the ComputerName array is iterated through one at a time. Since this function uses the PowerShell remoting Invoke-Command Read more [...]

Convert, Resize, and Optimize VHD and VHDX files with PowerShell

I recently received an email from someone who attended one of my presentations asking if I had a blog article on using PowerShell to compact and optimize VHD files. Since I didn't have a blog article on that subject, I decided to create one. The process itself is fairly simple. The examples shown in this blog article are being run on a Windows 10 computer which has Hyper-V enabled on it. Only specific SKU's of Windows 10 are capable of running Hyper-V. The same process can be used on servers running Read more [...]

Presenting 2 PowerShell sessions this weekend at SQL Saturday Birmingham

If you're interested in some free PowerShell training, I'll be presenting two PowerShell sessions at SQL Saturday #593 in Birmingham, Alabama this Saturday, March 18th. My first one hour presentation begins at 9:40am central time and is geared for beginners. The content covered in this session is based off of a book by the same title that I'm currently writing. PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell Interested in PowerShell but not sure how to get started? Already Read more [...]

PowerShell 101 Book Update: Chapter 4 Added

This morning, I published Chapter 4 of my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell. The book now contains chapters one through four and is forty percent complete. The book will contain a minimum of ten chapters when it's completed later this year. Interested, but not ready to commit to purchasing it? Chapter 1 is available as a free download and I've created a video that demonstrates many of the concepts covered in Chapter 1. If you’re interested in purchasing Read more [...]

How to add your PowerShell blog to Planet PowerShell

Do you blog about PowerShell? If so, consider adding your blog site to Planet PowerShell which is an aggregator of content from PowerShell Community members. There are some guidelines for submission on their GitHub page so be sure to take a look at it before continuing. Instructions for adding your blog also exists on that page, but I've recently seen a number of tweets about it being too difficult or too much work. To be honest with you, if everything in IT was as easy as adding my blog to Planet Read more [...]

PowerShell 101 Book Update: First 3 Chapters Now Available

Another update to my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell is now available. The update which was published this morning added chapter 3 to the already available first two chapters. If you're interested in purchasing this book, consider buying it while it's still a work in progress. The price of the book increases slightly with each chapter that's released. Chapter 1 of the book is available as a free sample download. There's also a video available which Read more [...]

PowerShell One-Liner to Disable Active Directory Accounts and Log the Results to a SQL Server Database

The new PowerShell cmdlets that are part of the SQLServer PowerShell module that's distributed as part of SSMS (SQL Server Management Studio) 2016 make it super easy to write the output of PowerShell commands to a SQL Server database. The ActiveDirectory PowerShell module that's part of the RSAT (Remote Server Administration Tools) is also required by the code shown in this blog article. This PowerShell one-liner retrieves a list of Active Directory users who have not logged in within the past Read more [...]

Managing Altaro VM Backup with PowerShell

Recently, I decided to try to determine if there was a way to manage Altaro VM Backup with PowerShell. I figured there must be some database, files, or something that I could at least query with PowerShell. What I found is Altaro has a RESTful API and they have numerous PowerShell scripts for working with it. In Altaro version 7, there are 33 PowerShell scripts located in the "C:\Program Files\Altaro\Altaro Backup\Cmdlets" folder if you took the defaults during the installation, otherwise they're Read more [...]

Video: PowerShell 101 – The No-Nonsense Beginner’s Guide to PowerShell

Last week, I announced a new book for PowerShell beginners that I'm self-publishing. I decided to create a short video about the book and cover the topics from Chapter 1. https://youtu.be/aU4qw13zgQc The video can also be found on YouTube.com The book (PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell) can be found on Leanpub.com. µ Read more [...]

Announcing a new book: PowerShell 101 – The No-Nonsense Beginner’s Guide to PowerShell

I've contributed, co-authored, performed technical reviews and edits on a number of PowerShell books. I also speak to a lot of beginners at user group meetings and technology events such as PowerShell Saturday's and SQL Saturday's. One thing I've found is there are still a lot of IT Pro's out there who are reluctant to learn PowerShell and they're often overwhelmed by information overload when they do try to learn it. What I mean by that is those of us who are fired up about going out there and educating Read more [...]

Beware of the PowerShell Update-ModuleManifest Function

I recently presented a session for the Mississippi PowerShell User Group on PowerShell Non-Monolithic Script Module Design. While preparing for that session, I discovered that a problem I had previously experienced with Update-ModuleManifest when trying to update the FunctionsToExport section when FormatsToProcess is specified appeared to be resolved in PowerShell version 5.1 (I'm running build 14393). The details of this bug can be found here. I also noticed that Nicholas Getchell had written about Read more [...]

Using PowerShell to Audit Antivirus Updates on your Servers

How often do you check to make sure that things like antivirus has received the latest definition files on all of your servers? There's probably some centralized GUI interface somewhere that you could log into and check. The antivirus product itself may even have some sort of notification system that sends alerts if the updates fail. Both of those options provide data in a format that can't be worked with and what happens if something falls through the cracks? Are you willing to bet your job and Read more [...]