There is no single folder containing every PowerShell script. A .ps1 file can be saved in a project, Downloads, an administrator’s scripts folder or a network location.

Find scripts in a known folder

Get-Location
Get-ChildItem -LiteralPath . -Filter '*.ps1' -File
Get-ChildItem -LiteralPath . -Filter '*.ps1' -File -Recurse

The first search checks the current folder; the recursive version includes its subfolders. Start with the relevant project folder rather than scanning an entire drive. To run a file you found in the current directory, use .\Report.ps1.

Locate the script that is running

Inside a saved script:

$PSCommandPath
$PSScriptRoot

These give the script’s full path and its parent directory. They are useful for loading a file beside the script; see resolving missing paths. They are not a search tool for locating an unknown script from an interactive prompt.

Profiles and modules are different

$PROFILE | Select-Object *
$env:PSModulePath

$PROFILE exposes startup-profile paths for the current user and host. Windows PowerShell and PowerShell 7 can use different profile locations, and redirected Documents folders can alter them. Display the values rather than assuming a hard-coded path. Module directories serve module discovery; copying an arbitrary script there does not make every script name globally executable.

If a file exists but its name is not recognized, use PowerShell command discovery checks.

Sources and verification

Locations and automatic variables checked against Microsoft documentation. No user folders were recursively scanned during verification.