Follow @juneb_get_help [Update: The original post referred to “enums” as “enumerators” when, in fact, they are “enumerated types.” By contrast, enumerators allow you to process items one at a time. Many thanks to Windows PowerShell MVP Dave Wyatt (@msh_Dave) for the correction.] Enums have always been a part of Windows PowerShell, because they’re an important part […]
Category: Windows PowerShell
Find variables with class
Follow @juneb_get_help I’ve been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I […]
Displaying Output in a GUI Application
After many years of writing scripts for the Windows PowerShell console, I’m now learning the next level of automation — writing GUI applications that run Windows PowerShell commands. PowerShell Studio forms provide a gentle and well-guided introduction to GUI applications, but it’s still taken me some time to break old habits. I constantly need to […]
Beyond custom objects: Create a .NET class
In yesterday’s blog post, I used the Select-String cmdlet to capture the table of keywords and references from the about_language_keywords help topic and then used the new ConvertFrom-String cmdlet in the Windows PowerShell 5.0 preview to convert each row of the table into a custom object (PSCustomObject). The custom object worked quite well. I could search, sort, format, and […]
Get-LanguageKeywords: Using ConvertFrom-String on About Topics
There have been some great blog posts about the new ConvertFrom-String cmdlet in the Windows PowerShell 5.0 preview. My favorite learning tool is an excellent talk by Windows PowerShell MVP Tobias Weltner about the full range of text parsing options available in Windows PowerShell 3.0 – 5.0. While learning, I had some fun converting my […]
Removing Objects from Arrays in PowerShell
A member of the PowerShell group on Facebook asked how to delete an object from an array. It’s a simple question, but the answer isn’t very simple at all. It’s one of those beginner questions that has an advanced answer. When I first answered this question in about_Arrays, I didn’t really know much about […]
Update-OneGet: Install OneGet on PS 3.0+
One of the coolest new features in the Windows PowerShell 5.0 preview is the OneGet module. Windows PowerShell program manager, Dan Harman, describes OneGet as a “package manager manager,” but for most of us, it represents a simple, repeatable, and reliable way to install, update, and uninstall a variety of available programs from a variety […]
Throwback Thursday: Making batch files into executables
PrimalScript 2014 can make a variety of script files into executable files. We call that packaging. This feature is mostly used by VBScript and PowerShell administrators to wrap their scripts into an executable file that can be shipped to end users and prevent prying eyes from seeing what makes the magic happen. For the aforementioned […]
Get-Duplicates (or Unique items)
I take a lot of free online coding classes, mainly from Coursera and Udacity, and I’ve picked up a lot of programming tricks in other languages that are easy translated to Windows PowerShell. In a Java class on Udacity, I learned a cool way to find duplicates in any collection. It uses the fact that […]
Saving Passwords for Add-AzureAccount
One of the great features of the recent versions of Azure PowerShell is a non-interactive option for the Add-AzureAccount cmdlet. Unfortunately, the instructions tell you to save your Azure password in plain text, but there are much more secure alternatives. I explain one in this post. ——————- As users of Azure PowerShell know well, there […]