PowerShell Community

A place for the community to learn PowerShell and share insights

How to Use $FormatEnumerationLimit

Q: When I format an object where a property contains more than 4 objects, I never see the extra property values. How can I fix that? A: Use the variable. This query is one I hear in many PowerShell support forums, and I have encountered this issue a lot over the years. What happens is that you issue a command to return objects, for example...

How to use the Secret modules

Q: I have a bunch of scripts we use in production that make use of Windows credentials. In some cases, these scripts have an actual password in plain text, while others read the password from an XML file. Is there a better way? A: Scripts with high-privilege account passwords in plain text is not a good idea. There are several methods you can...

A closer look at the Crescendo configuration

In my previous post, I looked at the details of a Crescendo output handler from my VssAdmin module. In this post, I explain the details of a cmdlet definition in the Crescendo JSON configuration file. The purpose of the configuration The structure for the interface of a cmdlet is a reasonably predictable thing. The pattern of the ...

Converting string output to objects

In my previous post, I talked about using Crescendo to create a PowerShell module for the command in Windows. As I explained, you have to write Output Handler code that parses the output of the command you are using. But if you never written a parser like this, where do you start? In this post I show you how to parse the output from the ...

Understanding Get-ACL and AD Drive Output

Understanding Active Directory ACL using PowerShell can be a bit tricky. There are no out-of-the-box cmdlets with ActiveDirectory PowerShell module to help in settings the permission quickly. While there are no cmdlets, you can nevertheless manage AD permissions using the AD PowerShell drive. In this post, I will try to simplify Active ...

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 ...

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...

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 ...

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 ...