PowerShell Community
A place for the community to learn PowerShell and share insights
Latest posts
My Crescendo journey
In a recent PowerShell Users Group meeting I was thinking that it might be good to talk about the new Crescendo module and how to use it. I was going to ask Jason Helmick if he would do a presentation for us. Then, in an unrelated conversation, someone mentioned using for some project. This got me thinking: is a perfect candidate for a Crescendo module and maybe I should just learn it and do the presentation myself. What is Crescendo? Crescendo is an experimental module developed by Jim Truher, one of the main developers of PowerShell. Crescendo provides a framework to rapidly develop PowerShell cmdlets that ...
How to Make Use Of PowerShell Profile Files
Q: I would like to personalize the way that PowerShell works. I have heard that I can use a thing called a profile to do this, but when I try to find information about profiles, I come up blank. There is no cmdlet, so I do not see how to create such a thing. Can you help me, please? A: Profiles are a powerful part of PowerShell and allow you to customize PowerShell for your environment. They are easy to create and support a range of deployment scenarios. What is a Profile? Before explaining the profile, let's first examine the PowerShell host. A PowerShell host is a program that hosts PowerShell to allow you ...
How can I be notified any time a service goes down?
Q: How can I be notified any time a service goes down? A: The short quick answer to utilizing WMI and PowerShell 7. You use PowerShell to create temporary event monitoring using WMI. Then WMI monitors any service changes and generates an alert once it detects a change. Basic Requirement To achieve this, you need Windows PowerShell 5.1 and above. This post uses the latest version of PowerShell 7. So if you are don't yet have PowerShell 7, see the Microsoft documentation on how to Install PowerShell 7 on Windows. Also, make sure that PowerShell is running as administrator. Finding the Required Class Before ...
How to Update or Add a Registry Key Value with PowerShell
Q: I am having a problem trying to update the registry. I am using the New-ItemProperty cmdlet, but it fails if the registry key does not exist. I added the –Force parameter, but it still does not create the registry key. The error message says that it cannot find the path because it does not exist. Is there something I am not doing? I include my script so you can see what is going on. Help me, please? A: Let's look at how you can use PowerShell to add or update any registry key value. The Registry Before answering the query, let me cover some of the background basics. You probably already know this but I star...
How to Change the Start Page for the Edge Browser
Q: How can I change the Edge startup page? A: You can change the start page easily using PowerShell. Edge and It's Start Page I am basing this article on the latest incarnation of the Edge browser, aka Edge Chromium. The settings in this article seem to work fine on the latest versions of Windows 10 and Server 2022. Other browsers can have different approaches to startup page. And as ever - E&OE! (Errors and Omissions Excepted) When the Edge browser starts up, it displays a startup page based on Bing by default. For many, this is fine - they can browse the contents and then navigate where they want. But i...
How to rename a NIC
Q: Is there a simple way to rename a NIC, especially inside a Hyper-V VM? A: You can change the name of any Windows NIC using PowerShell - whether the NIC is in a physical host or a Hyper-V VM. NICS and NIC names One thing that can quickly become confusing when using Hyper-V with multiple VMs and VM Switches is how fast the network adapters seem to proliferate. You start with a few wired Ethernet Adapters on the host. Then you install Hyper-V and create a VM farm with loads of virtual NICs. Before you know it, you have a dozen adapters inside the VM host and an unclear set of adapters in the VM. To discover t...
How to send output to a file
Q: Is there an easy way to save my script output to a text file rather than displaying it on screen? A: Of course - there are multiple ways to do just that! PowerShell and Output One of PowerShell's great features is the way it automatically formats output. You type a command - PowerShell gives you the output it thinks you want. If the default output is not what you need, use the formatting cmdlets like and to get what you want. But sometimes, what you want is getting output to a file, not to the console. You might want to run a command or script that outputs information to a file and sends this file via ema...
How Do I Discover Changes to an AD Group’s Membership
Q: Is there an easy way to detect and changes to important the membership of AD Groups? A: Easy using PowerShell 7, WMI, and the CIM Cmdlets. WMI Windows Management Instrumentation (WMI) is an important component of the Windows operating system. WMI is an infrastructure of both management data and management operations on Windows-based computers. You can use PowerShell to retrieve information about your host, such as the BIOS Serial number. Additionally, you can perform management actions, such as creating an SMB share. WMI is, in many cases, just another way to do things. For example, you can use WMI to crea...
Sending data to the Clipboard from PowerShell
Q: Hey I have a fun question! I remember reading a while back about using VBScript to paste to the clipboard. Are we able to do that with PowerShell? A: Why yes, yes we can! It is far often a much quicker solution if we start with PowerShell! Pasting content to the clipboard, the old VBScript method Before we show the quick and easy solution, let's learn how we could adapt an older solution. Now back in the day if I wanted to paste something on the clipboard I would go down to the store, get some glue and... "DOH! Wrong Clipboard!" (Knew I should have splashed some water on my face before typing this up!) W...