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 […]
Tag: juneb
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 […]
PowerShell Studio Templates : Get a head start on your scripts
When you open a new script file (.ps1) in PowerShell Studio 2014, you don’t get a blank page, at least by default. Instead, the page begins with a comment block, like this one: <# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2014 v4.1.74 Created on: 11/5/2014 4:28 PM Created by: juneb Organization: SAPIEN […]
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 […]
Run Selection v. Run Selection in Console
PowerShell Studio is full of features and options. As a new user, I’m trying to learn as many as I can. There are four options in the Run menu, so, of course, I tried them all. But the result was unexpected. Run and Run Selection run your code and show the result in […]
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 […]
Expand All Aliases: Ctrl+Shift+A
Windows PowerShell aliases are very handy. They typically have fewer characters than the commands and parameters that they represent, so they’re quicker to type and great for tweeting. However, it has long been an established best practice that aliases should not be used in blogs, in help, in examples, or in any shared scripts and […]
A Better ToString() Method for Hash Tables
I didn’t make it to the PowerShell Summit 2014 in Europe this year, but I’ve been getting much of the benefit by watching the Summit presentations on YouTube. After watching Windows PowerShell MVP Bartek Bielawski’s excellent presentation, in which he reviews PSCustomObjects and dynamic type data, I was inspired to fix a shortcoming in the […]