Latest Posts
  • Power Tips: Getting Available Video Resolutions

    WMI can return a list of available video resolutions for your video adapter:

    PS> Get-CimInstance -ClassName CIM_VideoControllerResolution |
     Select-Object -Property SettingID
    640 x 480 x…
    • 6 Apr 2020
  • Power Tips: Be Careful with Some Commands

    Here are three commands often found in PowerShell scripts that you should be careful about because they can have severe side effects:

    “exit” is not really a command but rather part of the language. It exits PowerShell immediately, and optionally you can submit a number which will be the “error level…

    • 2 Apr 2020
  • Power Tips: Dealing with Out-GridView Bug

    Out-GridView can serve as a universal selection dialog when you add the -PassThru parameter. The one-liner below stops all services you select in the grid view window (well, not really; you can play safely until you remove -WhatIf):

    Get-Service | Out-GridView -Title 'Select Service' -PassThru | Stop…
    • 31 Mar 2020
  • Power Tips: Exploring WMI with PowerShell

    The Win32_LogicalDevice WMI class represents all logic devices available in a computer, and by querying this “superclass”, you get back all the specialized individual classes. This is a simple way of finding out what kind of information WMI can get you, and what the names of WMI classes are:…

    • 27 Mar 2020
  • Power Tips: Adding New PowerShell Commands with Carbon

    Carbon is one of the most popular free PowerShell modules available from the PowerShell Gallery. Similar to a swiss army knife, it comes with a variety of helper functions. To install it, run this:

    PS> Install-Module -Name Carbon -Scope CurrentUser -Force

    Apparently, the owner of this module has…

    • 25 Mar 2020
  • Power Tips: Managing Updates with PSWindowsUpdate

    There are many useful PowerShell modules available from the PowerShell Gallery. One helps you managing updates. To download and install it, run:

    PS> Install-Module -Name PSWindowsUpdate -Scope CurrentUser -Force

    It adds a list of new commands related to Windows Update:

    PS> Get-Command -Module…
    • 23 Mar 2020
  • Power Tips: Dynamic Argument Completion (Part 5)

    In our previous tip we looked at sophisticated completion code that completed application paths. Collecting the completion values could take some time and had the potential of timing out IntelliSense. For completion values that are unlikely to change, it is much better to calculate the values once and…

    • 19 Mar 2020
  • Power Tips: Dynamic Argument Completion (Part 4)

    In the previous tip we explained how you can use [ArgumentCompleter] to add powerful argument completers for parameters. There are limitations though:

    • When the completion code becomes complex, your code becomes hard to read
    • You cannot add argument completion to existing commands. The [ArgumentCompleter…
    • 17 Mar 2020
  • Power Tips: Dynamic Argument Completion (Part 3)

    With the discoveries in our past tips, let’s compose a useful completion code that suggests all available programs you can launch:

    function Start-Software {
    # get registered applications from registry     …
    • 13 Mar 2020
  • Power Tips: Dynamic Argument Completion (Part 2)

    In our previous tip we looked at [ArgumentCompleter] and how this attribute can add clever code to parameters that provides auto-completion values for your arguments. AutoCompletion can do even more: you can submit different values for the IntelliSense menu, and for the actual completion.

    Check this…

    • 11 Mar 2020