Latest Posts
  • Power Tips: Sorting Tricks (Part 1)

    Sort-Object is your cmdlet to sort things: simply specify the property you like to sort, and Sort-Object covers the rest, including picking the correct sort algorithm based on the property data type:

     
    Get-Service | Sort-Object -Property DisplayName -Descending 
     
    1. A lesser-known fact is that Sort-Object…
    • 24 Jun 2021
  • Power Tips: Hashing Text

    PowerShell comes with Get-FileHash which reads a file and calculates a unique hash value. That’s great to test whether files have identical content. However, there is no way to hash plain texts.

    Of course, you could write the text you want to hash to a file, then use Get-FileHash.

    A better way…

    • 22 Jun 2021
  • Power Tips: Identifying Windows Version (Part 3)

    In the previous tip we illustrated that accessing the WinRT class AnalyticsInfo seems to be the only supported way to read the current Windows 10 version. Rather than using asynchronous methods like in the previous example, to get just the current Windows 10 version, here is a simpler way:

    # get raw…
    • 18 Jun 2021
  • Power Tips: Identifying Windows Version (Part 2)

    In the previous tip we reported that ReleaseId is deprecated and can no longer be used to correctly identify the current Windows 10 version. Instead, DisplayVersion should be used:

     
    PS> (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').DisplayVersion
    20H2  
     

    • 16 Jun 2021
  • Power Tips: Identifying Windows Version (Part 1)

    The current Windows version can be read easily from the Windows Registry:

     
    PS> Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' | Select-Object -Property ReleaseId, DisplayVersion
    
    ReleaseId DisplayVersion
    --------- --------------
    2009      20H2   
     

    Be aware though…

    • 14 Jun 2021
  • Power Tips: Original Windows 10 Product Key

    There are tons of PowerShell scripts floating around pretending they can decode the original Windows 10 product key. Most of these scripts use outdated algorithms that no longer work in Windows 10.

    Here is a much simpler way to retrieve your original Windows 10 product key:

    Get-CimInstance -ClassNam…
    • 10 Jun 2021
  • Power Tips: Evaluating Event Log Data (Part 3)

    In the previous tip we looked at Get-WinEvent and how you can use calculated properties to directly access the “Properties” attached to each event rather than having to text-parse the event message.

    For example, below code produced a list of installed updates by pulling out the names of installed…

    • 8 Jun 2021
  • Power Tips: Evaluating Event Log Data (Part 2)

    In the previous tip we looked at Get-WinEvent and how you can use a hash table to specify your query. The previous tip used below code to list all events written by the Windows Update Client using the event ID 19, across all event log files:

    Get-WinEvent -FilterHashTable @{
        ID=19
        ProviderNam…
    • 4 Jun 2021
  • Power Tips: Evaluating Event Log Data (Part 1)

    Event logs contain hugely useful information about almost any aspect of your Windows system. When using the deprecated Get-EventLog cmdlet, however, only a fraction of this information is accessible because this cmdlet can only access the older classic logs. That’s why the cmdlet was removed from PowerShell…

    • 2 Jun 2021
  • Power Tips: Parsing Raw Data and Log Files (Part 2)

    In the previous tip we explained that most log files can be treated as CSV files and read by Import-Csv. All you need to do is tell Import-Csv where your log file differs from standard CSV, and for example define a different delimiter or supply missing headers.

    One log file format however is hard to…

    • 31 May 2021