Latest Posts
  • Power Tips: Using Profile Scripts

    Profile scripts work like autostart scripts in PowerShell. They do not need to exist, but if they do, PowerShell executes its content silently during each launch. There are up to four profile scripts, and this line exposes their paths:

     
    PS> $profile | Select-Object -Property *
    
    AllUsersAllHosts    …
    • 25 Sep 2020
  • Power Tips: Identifying User Profile

    Be careful when using $env:userprofile or $home to create paths to user files. When a Windows box is set up for OneDrive, the documents folder may have been redirected to a subfolder named “OneDrive”. Here are some examples:

     
    PS> $env:USERPROFILE
    C:\Users\tobia
    
    PS> $HOME
    C:\Users\tobia…
    • 23 Sep 2020
  • Power Tips: Get Rid of Get-EventLog

    The Get-EventLog cmdlet provides easy access to event log entries in the primary Windows event logs, however it neither can access the many application level event logs, nor is it available at all in PowerShell 7.

    If you ever plan to run your code in PowerShell 7, you should start getting used to its…

    • 21 Sep 2020
  • Power Tips: Setting and Clearing Trusted Hosts

    PowerShell remoting maintains a list of trusted IP addresses and/or machine names on the client side (the machine that issues the command and authenticates at the server). This list is important for you because it governs how you can authenticate to remote computers.

    By default, PowerShell supports Kerberos…

    • 17 Sep 2020
  • Power Tips: Using PowerShell 7 inside PowerShell ISE

    The PowerShell ISE built into Windows works with Windows PowerShell only and is stuck at PowerShell version 5.1. Typically, when you want to use an editor to write PowerShell 7 code, Visual Studio Code and the PowerShell extension is the way to go.

    Still, you can make PowerShell ISE “talk” to PowerShell…

    • 15 Sep 2020
  • Power Tips: Using $Is* Variables

    In PowerShell 7, there is a new set of variables all starting with “Is”. They help you understand the environment in which your script runs:

     
    PS> Get-Variable -Name is*
    Name                           Value
    ----                           -----
    IsCoreCLR                      True
    IsLinux …
    • 11 Sep 2020
  • Power Tips: Enabling and Disabling Realtime Antivirus Protection

    You can use PowerShell to enable and disable real-time antivirus protection provided you are running with full Administrator privileges. Temporarily disabling real-time antivirus protection may occasionally be helpful when there is explicit need to run legit scripts that may otherwise be blocked. Generally…

    • 9 Sep 2020
  • Power Tips: Identifying Antivirus Engine State

    In the previous tip you learned how you can query WMI to find out the antivirus product present on your Windows machine:

    $info = Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct
    
    $info
    

    The ProductState property encodes additional pieces of information, telling you whether…

    • 7 Sep 2020
  • Power Tips: Identifying Installed Antivirus Product

    A PowerShell one-liner can help you identify the antivirus product installed on a Windows box:

     
    PS> Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct 
     

    Add the -ComputerName parameter to query remote systems.

    Note that this line returns only antivirus products that properly…

    • 3 Sep 2020
  • Power Tips: Deleting Microsoft Teams Cache Data

    If you use Microsoft Teams for video conferencing, you may occasionally want to clean cache files and remove traces which reside in a number of subfolders.

    You can adjust the code from our previous example to do the cleanup for you:

    # the folder that contains the Microsoft Teams data
    $parentFolder =
    • 1 Sep 2020