By Patrick Wahlmueller

AI and Automation in Practice

Technical Insights 1 min read

Check if all Module Paths are valid

A quick PowerShell one-liner to verify that all paths in your PSModulePath environment variable actually exist.

Wanted to check if all of my PowerShell module paths are valid. This little script helps:

$env:PSModulePath.Split(';') | Select-Object @{l='Path';e={$_}}, @{l='Valid';e={Test-Path $_}}

The output shows each path alongside a True/False for whether it exists – a very easy method to check if all paths are valid.