Latest Posts
  • Power Tips: Code-Signing PowerShell Scripts (Part 3)

    In the previous parts, we created a code signing certificate and used it to add a digital signature to a PowerShell script file. Yet what good can a digital signature do that was added to a PowerShell script file?

    Use Get-AuthenticodeSignature to reveal the secrets found in the digital signature. Just…

  • Power Tips: Code-Signing PowerShell Scripts (Part 2)

    In our previous tip we explained how you can use New-SelfSignedCert to create a self-signed code signing certificate. Today, we’ll use a self-signed or corporate code signing certificate to actually start and digitally sign a Powershell script.

    For this, take any PowerShell script file you want…

  • Power Tips: Code-Signing PowerShell Scripts (Part 1)

    Adding a digital signature to a PowerShell script is no black magic anymore these days, and while you ideally need an official “trusted” code signing certificate from your corporate IT or trusted authority, even this is not mandatory anymore these days.

    Before we proceed with code signing…

  • Power Tips: Professional Error Handling

    Often PowerShell scripts use a very simple form of error reporting that is structured like this:

    # clearing global error list:
    $error.Clear()
    # hiding errors:
    $ErrorActionPreference = 'SilentlyContinue'
    
    # do stuff:
    Stop-Service -Name Spooler
    dir c:\gibtsnichtabc
    
    
    # check errors at end:
    $er…
  • Power Tips: Cleaning Hard Drive (Part 2)

    In the previous post we introduced the Windows tool cleanmgr and its parameters /sageset and /sagerun that you can use to define and run automated hard disk cleanups.

    Today we’ll be looking into how you can customize the actual cleanup tasks performed by cleanmgr.exe.

    This tool stores all configuration…

  • Power Tips: Cleaning Hard Drive (Part 1)

    Part of Windows is an ancient tool that can clean your hard drive: cleanmgr.exe.

    This tool can remove a variety of data garbage and at times removes many gigabytes of space. What makes it interesting for PowerShell is its support for automation.

    To automate hard drive cleanup, first you need to launch…

  • Power Tips: Managing Bluetooth Devices (Part 3)

    If you’d like to programmatically unpair a paired Bluetooth device, then there is no built-in cmdlet available. Still PowerShell can do the trick, and it often can even unpair Bluetooth devices that won’t remove via the UI or keeps coming back.

    What you need first to remove a Bluetooth device…

  • Power Tips: Managing Bluetooth Devices (Part 2)

    If you’re just looking for a quick way in Windows to pair and unpair Bluetooth devices, try this command:

     
    PS> explorer.exe ms-settings-connectabledevices:devicediscovery   
     

    It immediately pops up a dialog showing all Bluetooth devices. Just add a function to PowerShell so you don’t have…

  • Power Tips: Managing Bluetooth Devices (Part 1)

    Identifying Bluetooth devices that your computer has connected to is as easy as a one-liner:

     
    PS> Get-PnpDevice -Class Bluetooth 
    
    Status Class     FriendlyName                           InstanceId             
    ------ -----     ------------                           ----------             
    OK     Bluetooth…
  • Power Tips: PowerShell Plans for 2022

    The Microsoft PowerShell Team has just released its plans and investments for the year 2022: https://devblogs.microsoft.com/powershell/powershell-and-openssh-team-investments-for-2022/

    In short, these investments circle around even more security. In addition, custom remoting connections may become an…