Latest Posts
  • Power Tips: Deleting Multiple Subfolders

    Occasionally, it may become necessary to delete a set of subfolders within a given folder. Here is a simple chunk of code that deletes the folders from a list of folder names.

    Warning: this code will delete the subfolders listed in $list without further confirmation. If the subfolders do not exit, nothing…

    • 28 Aug 2020
  • Power Tips: Managing Autostarts

    To manage auto starting programs on Windows, don’t bother writing extensive scripts. PowerShell can directly open the autostart manager included in task manager which does all you need:

     
    PS C:\> Taskmgr /7 /startup 
     

    This opens a window and lists all auto starting programs, along with their…

    • 26 Aug 2020
  • Power Tips: Downloading Useful Scripts

    The PowerShell Gallery not only offers public modules with new PowerShell commands but also public scripts. Before you invest time, you may want to investigate if someone else may have created PowerShell code that can do what you want.

    Here is a quick example that illustrates how searching and downloading…

    • 24 Aug 2020
  • Power Tips: Speeding Up PowerShell Remoting

    PowerShell remoting is insanely powerful: with Invoke-Command, you can send arbitrary PowerShell code to one or many remote machines and execute it there in parallel.

    On Windows Servers, PowerShell remoting is typically enabled, so all you need are Administrator privileges. Here is a simple example:

    • 20 Aug 2020
  • Power Tips: Creating PowerShell Functions Dynamically

    New-Item can create new things on any PowerShell drive, including the function: drive that holds all PowerShell functions.

    If you’d like, you can define new functions dynamically inside your code. These new functions would then exist only in the scope where they were defined. To make them script-global…

    • 18 Aug 2020
  • Power Tips: Validating User Account Passwords (Part 3)

    In the previous parts, we created the Test-Password function that can test user account passwords for both local and remote user accounts.

    In our last part, we’ll add error handling to the Test-Password function so it responds gracefully when the user enters domain that does not exist or is unavailable…

    • 14 Aug 2020
  • Power Tips: Validating User Account Passwords (Part 2)

    In the previous tip we showed how PowerShell can validate and test user account passwords, however the password was requested in plain text. Let’s change this so that PowerShell masks the password when it is entered.

    You can re-use the strategy used below for any other PowerShell function where…

    • 12 Aug 2020
  • Power Tips: Validating User Account Passwords (Part 1)

    PowerShell can test user account passwords for you. This works both for local and domain accounts. Here is a sample function called Test-Password:

    function Test-Password
    {
       param
       (
          [Parameter(Mandatory)]
          [string]
          $Domain,
    
          [Parameter(Mandatory)]
          [string]
          $Use…
    • 10 Aug 2020
  • Power Tips: Reading 4K-Hash

    Windows operating systems can be uniquely identified by a so-called 4K-Hash: this is a special hash string that is 4000 bytes in size. You can use this hash for example with “Windows Autopilot” to add physical and virtual machines.

    The 4K Hash is just one piece of information required to…

    • 6 Aug 2020
  • Power Tips: Sophisticated Battery Report

    If your laptop battery is going low too soon, or you’d like to investigate related issues, there is a simple way to generate an extensive battery charging report. It shows exactly when your battery was charged, what its capacity is, and how long it took to deplete.

    Here is the code to create a…

    • 4 Aug 2020