Test-ProfileExists.ps1
19 Sep 2025Description
Purpose
Checks if PowerShell profile paths exist.
Detailed Description
This function checks if the standard PowerShell profile paths exist and provides detailed information about each profile.
Usage
Example 1
PS C:\> Test-ProfileExists -Verbose
Checks if the PowerShell profile paths exist and provides detailed information about each profile.
Notes
Author: Your Name Date: 2024-06-30
Script
<#
.SYNOPSIS
Checks if PowerShell profile paths exist.
.DESCRIPTION
This function checks if the standard PowerShell profile paths exist and provides detailed information about each profile.
.EXAMPLE
PS C:\> Test-ProfileExists -Verbose
Checks if the PowerShell profile paths exist and provides detailed information about each profile.
.NOTES
Author: Your Name
Date: 2024-06-30
#>
function Test-ProfileExists {
[CmdletBinding()]
param ()
BEGIN {
Write-Verbose "Starting the Test-ProfileExists function."
}
PROCESS {
$profile.PSObject.Properties.Name |
Where-Object { $_ -ne 'Length' } |
ForEach-Object {
$profileName = $_
$profilePath = $profile.$profileName
$profileExists = Test-Path $profilePath
Write-Verbose "Checking profile: $profileName"
Write-Verbose "Profile path: $profilePath"
Write-Verbose "Profile exists: $profileExists"
[PSCustomObject]@{
Profile = $profileName
Present = $profileExists
Path = $profilePath
}
}
}
END {
Write-Verbose "Test-ProfileExists function completed."
}
}
# Example call to the function with verbose output
# Test-ProfileExists -Verbose | Format-Table -AutoSize
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.