Many years ago, file and folder names had a maximum of 8 characters, and these short path names still exist. They can even still be useful: short...
ps1
Identifying PowerShell Host and Path
Here is a quick one-liner that identifies the full path to your current PowerShell host: PS> (Get-Process -Id $pid).Path C:\Program...
Using Online Help (Part 2)
In the previous tip we mentioned that many PowerShell users prefer the online help over locally downloaded help. To use the online help documents by...
Using Online Help (Part 1)
PowerShell supports both local help files and online resources. Take a look at the differences: # outputs help in same console window # level of...
Updating Help without Admin Privileges
In Windows PowerShell, updating help used to require Administrator privileges due to a design flaw: help had to be stored in the location where the...
Checking Profile Scripts (Part 2)
In the previous script we came up with a one-liner that checks which profile scripts actually exist. This solution works per host only, though,...
Checking Profile Scripts (Part 1)
PowerShell uses up to four profile scripts. When they exist, PowerShell silently executes any content when it launches. It’s important to know...
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...
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...
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...
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...
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...
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...
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...
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...
Identifying Installed Antivirus Product
A PowerShell one-liner can help you identify the antivirus product installed on a Windows box: PS> Get-CimInstance -Namespace...
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...
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...
Managing Autostarts
To manage auto starting programs on Windows, don’t bother writing extensive scripts. PowerShell can directly open the autostart manager...
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...
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...
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...
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...
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....