Latest Posts
  • Power Tips: COVID Webservice with PowerShell

    Do you want to stay up-to-date with Covid pandemic parameters? Try this simply webservice:

    $result = Invoke-RestMethod -Uri "https://coronavirus-19-api.herokuapp.com/countries"
    
    $result -match "Germany"
    

    The result looks similar to this:

     
    country             : Germany
    cases     …
  • Power Tips: Enabling Active Directory Cmdlets

    On both server and client, Windows ships with the “ActiveDirectory” PowerShell module. It adds numerous cmdlets to manage users and resources in the Active Directory.

    By default, the module is hidden though. To enable it on clients, with Administrator privileges run this:

    $element = Get-…
  • Power Tips: Four PowerShell Critical Prerequisites

    If you are switching to a new computer, you may want to do a quick sanity check to see if PowerShell is set up correctly. Here are four things you should definitely check:

    1 Check PowerShell Version
    Run $PSVersionTable to check your PowerShell version.

     
    PS> $PSVersionTable
    
    Name                   …
  • Power Tips: Better Help in PowerShell ISE

    There are still many professional scripters using the built-in PowerShell ISE editor, and it still is de facto a quick and reliable script development environment. If you do use PowerShell ISE, you may want to switch its built-in help system to use online help. Run this (inside PowerShell ISE):

     
    PS…
  • Power Tips: Opening Windows Settings Dialogs (Fast) (Part 2)

    Previously, we introduced the moniker “ms-settings:” that is supported by Start-Process and can be used to open various windows settings dialogs. For example, to open your personal registration info page, run this:

     
    PS> Start-Process ms-settings:yourinfo
     

    Whenever you need to open a…

  • Power Tips: Opening Windows Settings Dialogs (Fast) (Part 1)

    Most dialogs and settings in Windows can be opened directly via internal commands. The main Windows 10 settings dialog can be opened like this:

     
    PS> Start-Process ms-settings:
     

    To open a specific settings page, add its name. For example, to quickly open the “Duplicating my display” settings page…

  • Power Tips: Advanced Sorting (Part 4)

    In the previous parts we illustrated how you can use script blocks to gain more control over sorting. For example, you can use the “-as” operator to transform data to control the sort algorithm.

    This way, you can “correct” the data type of incoming data, for example, in case some or all numeric…

  • Power Tips: Advanced Sorting (Part 3)

    In the previous tip you have seen how Sort-Object accepts hash tables, providing you with advanced control over the sorting. For example, this line has sorted services by status, then display name, and used individual sort directions for each property:

    Get-Service | 
    Sort-Object -Property @{Expressi…
  • Power Tips: Advanced Sorting (Part 2)

    Sort-Object supports advanced sorting and provides much more control when you submit a hash table. The hash table can for example control sort direction individually for multiple properties.

    For example, this line sorts services by status, then by name. Sort direction can be controlled via the -Descending…

  • Power Tips: Advanced Sorting (Part 1)

    Sort-Object easily sorts results for you. For primitive data such as numbers or strings, simply add Sort-Object to your pipeline. This gets you a sorted list of lottery numbers:

    $lottery = 1..49 | Get-Random -Count 7 | Sort-Object
    # set the string you want to use to separate numbers in your output
    $…