PowerTip: Turn off the power to your computer with PowerShell

Summary: A simple way to power off your computer by using the Windows PowerShell cmdlets.    Hey, Scripting Guy! I’ve got a script that needs to power off a system after it’s done. How can I accomplish this with PowerShell?    Look no further than the Stop-Computer cmdlet to turn off the power! (How’s THAT…


PowerTip: Determine your version of PowerShell and host operating system

Summary:  Identify your PowerShell environment by making use of built-in PowerShell variables.    Hey, Scripting Guy! If I’m writing a script, how can I detect if I am running on Windows, Linux, or Mac with PowerShell?    Just use the built-in variable $PSVersionTable, which has all of the properties you’ll need. Here is an example:…


PowerTip: Use PowerShell to play WAV files

Summary: Make use of the native features of Windows through PowerShell to play sound.    Hey, Scripting Guy! I’ve got some WAV files I would love to play without launching an application. Is there a way in Windows PowerShell to do this?      You sure can! Using the System.Media.Soundplayer object, you can do this…


PowerTip: Ensure that errors in PowerShell are caught

Summary: Here’s how to make sure your errors get caught with Try Catch Finally.    Hey, Scripting Guy! I’ve been trying to use the Try Catch Finally, but some of my errors aren’t getting caught. What could be the cause?    For Try Catch Finally, you need to make sure the error defaults to a…


PowerTip: Build simple HTML with PowerShell

Summary: Here’s how to use the ConvertTo-HTML cmdlet to build basic HTML content.   Hey, Scripting Guy! Occasionally I need to build basic HTML documents. I heard there was a way to do that with Windows PowerShell.   There most certainly is! Just use the ConvertTo-HTML cmdlet to save the day! For example:    …


PowerTip: Create new authentication keys for AzureRM Cognitive Services

Summary: Change the keys to authenticate to Azure RM Cognitive Services, by using Windows PowerShell.   Hey, Scripting Guy! I created the keys for my Rest API. I know I can change them in the web portal, but is there a faster way of doing it through Windows PowerShell?   There absolutely is! Just use…


PowerTip: Use PowerShell to read an RSS feed

Summary: “Hey, Scripting Guy!” shows you how to use Invoke-RestMethod to read a list of entries from an RSS feed.  How can I use Windows PowerShell to see the list of articles from an RSS feed?       Just use the Invoke-RestMethod and provide the full path to the link to the RSS feed….


PowerTip: Remove calendar events from a mailbox

Summary: Remove calendar events within an Exchange Online mailbox.     Is there an easy way to remove calendar events from within an Exchange Online mailbox?         Yes there is. There is a newly deployed cmdlet to Office 365 tenants: Remove-CalendarEvents. This cmdlet is currently only available in Exchange Online, but it…


PowerTip: Get a list of security patches installed in the last 90 days

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to get a list of all the security patches installed in the last three months. How can I list all the security patches that I’ve installed in the last 90 days? There’s a class for that! Just use Get-CimInstance, and you can retrieve this information….