• Hyper-V VM IP address

    Saw a question about getting the Hyper-V VM IP address. One thing with Hyper-V is that the VM has to be running for you to retrieve the IP address. Once you VM is running you can get the IP address PS> Get-VM -Name W19ND01 | select -ExpandProperty... Read the full text.
    • 9 Sep 2019
  • Pet peeves

    Back in July I mentioned the using ? instead of Where-Object was a pet peeve. I’ve been asked a few times since for other pet peeves. The order of peevishness changes over time but these three will probably be always near the top. In no particular... Read the full text.
    • 31 Aug 2019
  • Foreach-Object -parallel

    The introduction of Foreach-Object -parallel in PowerShell v7 preview 3 brings some much needed parallelisation options back into PowerShell. PowerShell workflows are available in Windows PowerShell but are quirky (to be kind) and can be difficult... Read the full text.
    • 30 Aug 2019
  • Testing Windows activation

    Testing Windows activation from PowerShell involves a little dive into CIM (WMI). At its simplest a function like this function test-activation { $ta = Get-CimInstance -ClassName SoftwareLicensingProduct -Filter "PartialProductKey IS NOT NULL"... Read the full text.
    • 29 Aug 2019
  • Get-AdUser in PowerShell Core

    There has been a problem with Get-ADUser in PowerShell core such that Get-ADUser -Identity Richard -Properties * Throws an error. The problem is in .NET Core and affects a small number of properties including ProtectedFromAccidentalDeletion... Read the full text.
    • 29 Aug 2019
  • Windows Terminal v0.4.2382.0

    Windows Terminal v0.4.2382.0 has ben released to the Microsoft store. if you have Windows Terminal installed it should automatically update for you. Copying out of a window using the keyboard shortcuts now works – thank you – that makes the whole... Read the full text.
    • 28 Aug 2019
  • Experimental features

    PowerShell core has recently. v6.2, had the concept of experimental features added. An experimental feature is new or changed functionality that may be a breaking change or about which the PowerShell team want feedback before finalising the code. My... Read the full text.
    • 23 Aug 2019
  • PowerShell v7 preview 3

    PowerShell v7 preview 3 is now available from https://github.com/PowerShell/PowerShell/releases Breaking changes seem to be confined to non-Windows platforms with the removal of the kill alias on Stop-Process and support for pwsh as a login shell... Read the full text.
    • 21 Aug 2019
  • Out-GridView is back

    Out-GridView is finally back in PowerShell core - https://devblogs.microsoft.com/powershell/out-gridview-returns/ . The project is hosted on github - https://github.com/powershell/GraphicalTools Install the module from the gallery - PS> Install... Read the full text.
    • 15 Aug 2019
  • PowerShell v2

    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 R2 Windows 7 support finishes 14 January 2020 Windows Server 2008 R2 support finishes 14 January... Read the full text.
    • 13 Aug 2019
  • 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 test if a transcript is running? It used to be that you could only have a single transcript running but... Read the full text.
    • 9 Aug 2019
  • 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 time to complete in VSCode – you may prefer to ensure it runs in the console as it consumes fewer resources... Read the full text.
    • 5 Aug 2019
  • 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 PowerShell questions that I can during the breaks. If you have any books of mine that you want signing... Read the full text.
    • 3 Aug 2019
  • 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 to perform both actions rather than doing it manually. function unzipfile { param ( [string]$path... Read the full text.
    • 31 Jul 2019
  • 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 will be made to use it in the scriptblock: PS> $path = 'C:\test\OldData01.txt' PS> Start-Job -Name... Read the full text.
    • 31 Jul 2019
  • 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 Windows 10 1903 it runs in PowerShell v6/7. There isn’t a Test-Localuser cmdlet but you can attempt... Read the full text.
    • 29 Jul 2019
  • 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 other missing verbs? I started with the object cmdlets as they are probably the most used cmdlets. ... Read the full text.
    • 28 Jul 2019
  • Sddl

    An Sddl is a Security Descriptor Definition Language string - https://docs.microsoft.com/en-us/windows/win32/secauthz/security-descriptor-definition-language  - that provides a succinct way to provides the security descriptor of an object as a string... Read the full text.
    • 27 Jul 2019
  • 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 (module) in ascending Source order. If you use multiple properties Get-Command | Sort-Object -Property... Read the full text.
    • 26 Jul 2019
  • Volume friendly name

    When you use Get-Volume one of the properties displayed is the friendly name PS> Get-Volume -DriveLetter C DriveLetter FriendlyName FileSystemType ----------- ------------ -------------- C NTFS In this case its blank because I haven’t set a... Read the full text.
    • 24 Jul 2019
  • 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 the point has been made that aliases are perfectly acceptable in scripts. Wrong. Using aliases in scripts... Read the full text.
    • 23 Jul 2019
  • 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 wildcards has been fixed UseAbbreviationExpansion and TempDrive are moved from experimental features... Read the full text.
    • 22 Jul 2019
  • 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 is now created in STA to avoid potential CLR crash Other changes are around the build process... Read the full text.
    • 16 Jul 2019
  • 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 shouldn’t posted that contains aliases especially the abominable use of ? for Where-Object (pet PowerShell... Read the full text.
    • 4 Jul 2019
  • 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 highly honoured to receive this and thank everyone who’ve read my blog, my articles or books, or listened... Read the full text.
    • 1 Jul 2019