Just seen a question about PowerShell v2. PowerShell v2 was a huge step forward when it appeared in October 2009 as part of Windows 7 / Server 2008...
RSiddaway
Test if a transcript is running
PowerShell has the ability to create a transcript of the commands you run at the console and the results displayed in the console. But how can you...
Identifying the host
Identifying the host in which your PowerShell code is running could be important. For instance you might not want to run some code that takes a long...
PowerShell Day UK 2019
The PowerShell Day UK 2019 one day conference is on Saturday 28 September 2019 - https://psday.uk/ I’ll be speaking and willing to answer any...
Unblock and unzip
When you download a zip file from the Internet you have to unblock and unzip the file. I need to do this fairly often so wrote this simple function...
Variables in scriptblocks
I often see questions regarding the use of variables in scriptblocks. Usually a variable will be defined outside the scriptblock and then an attempt...
Test local user doesn’t exist before creating
Saw a question asking how to Test local user doesn’t exist before creating. Windows 8 introduced the LocalAccounts module for Windows PowerShell. On...
Missing verbs?
I saw a post that suggested that you can’t use Sort as a verb in your functions. You get a message that sort is an unapproved verb. Are there any...
Sddl
An Sddl is a Security Descriptor Definition Language string -...
Sort direction
By default Sort-Object uses an ascending sort direction. Get-Command | Sort-Object -Property Source will sort the commands based on the Source...
Volume friendly name
When you use Get-Volume one of the properties displayed is the friendly name PS> Get-Volume -DriveLetter C DriveLetter FriendlyName...
Using aliases in scripts
There’s been a long debate on the PowerShell github site regarding ternary operators – think of it as a short cut for if-else. Twice in that debate...
PowerShell v7 preview 2
PowerShell v7 preview 2 arrived a few days ago. No big ticket items in this preview. Some useful things: Issue with Get-ChildItem Path with...
PowerShell v6.2.2
PowerShell v6.2.2 has just been released. One breaking change – the Enter-PSHostProcess is disabled when system is in lock down mode. The jumplist...
Logon sessions
Saw a question about logon sessions that had me looking at CIM class Win32_LogonSession. I really don’t like the example code they have – code...
MVP award
I received the email this afternoon informing that I’d been awarded MVP status for another year – the 12th year I’ve received the MVP award. I’m...
PowerShell Space Invaders
Way back in 2007 (PowerShell v1 days) I wrote about PowerShell space Invaders. I’ve just tried it in PowerShell v7 preview 1 and it seemed to...
Load format file in a module
Staying with the test-connection function I thought I’d show how to turn the function and format file into a module. This includes how to load the...
Test-Connection formatting
Last time I showed how to write a function that replaces the current PowerShell 6/7 Test-Connection. This time I’ll show you how to do the...
PowerShell 6/7 Test-Connection
The PowerShell 6/7 Test-Connection implementation as of PowerShell v6.2.1 and PowerShell v7.0 preview 1 is in my opinion a horrible example of how...
Quotes in CSVs
Up to and including PowerShell v6.2.x converting or exporting data to a csv has automatically put quotes round each field. In PowerShell v7 you can...
CDXML schema checks
PowerShell v3 introduced CDXML modules. Cmdlet Definition XML wraps a CIM class in XML to create a module. The methods of the CIM class can be used...
PowerShell Line continuation
There are a number of ways to signal PowerShell line continuation in your code. probably the most common is to have a pipeline symbol at the end of...
Test DNS servers
Had a recent comment about testing DNS servers which got me thinking how do I test DNS servers. I decided I wanted to get the DNS server address...