In order to write less code or to write better one-liners in Powershell, I often find one of these techniques useful, and let me know if you feel the same. Using -OutVariable parameter Variable squeezing Its a shame many of us ( including myself 😉 ) were not aware of this for quite long. Using Tee-Object Cmdlet… Read More 3 ways to Store & Display results in/from a Powershell variable at the same time
If you are reading this you must have used Select-object in PowerShell to select properties of an object something like Or, Where-Object cmdlet to filter out values on any specific object property like All these work well when you know the Property Name you are searching. But what if you don’t know the property name and… Read More Selecting Objects by value in Powershell
When you hit F7 in PowerShell console it brings up a command history dialog box where you can choose and run history items like in the following image But this feature doesn’t work in Powershell ISE or any other script editor. Well to the rescue following is a quick function which uses Out-GridView cmdlet to mimic… Read More Powershell Get-History+
I often see people wondering that some commands/applications launch from Windows Run (Windows Key+R) but when I try them in PowerShell console it throws an error, I know this gets frustrating at times. For example, when I try to run commands like Excel or WinWord my PowerShell console throws errors, but When I launch Notepad it just works… Read More Command discovery in Powerhell with $Env:Path
Introduction A few days ago in a discussion on Facebook’s PowerShell Group, I realized the many people don’t understand how to Tokenize or Use Abstract Syntax Tree to understand your PowerShell scripts better. I think the reason behind this unawareness is mostly because it doesn’t affect your ability to write better scripts, but you’ve to agree it… Read More PowerShell: Tokenization and Abstract Syntax Tree
Changing a URL candidate to valid ASCII format is called URL Encoding and can be done like in the below image using System.Web.HttpUtility class in .Net framework. You can also perform its reverse which is call URL Decoding.… Read More Encode\Decode URL with Powershell
Have you ever googled a port number to figure out what service uses it? I think every system administrator must have done this. But what if there are a lot of port to search?
So I thought giving it try with PowerShell if we can use the shell to pro-grammatical get port information of lots of port numbers.… Read More Query Port Information using Powershell