GinShell.Utilities/Public/Test-GsEnvironment.ps1

function Test-GsEnvironment {
    param (
        [ValidateSet('Variable', 'Registry', 'File', 'Folder', 'Executable', 'Module')]
        [string]$Type,
        [string]$Name
    )
    switch ($Type) {
        'Variable'   { return [bool](Get-Item -Path "Env:\$Name" -ErrorAction SilentlyContinue) }
        'Registry'   { return Test-Path -Path $Name }
        'File'       { return Test-Path -Path $Name -PathType Leaf }
        'Folder'     { return Test-Path -Path $Name -PathType Container }
        'Executable' { return [bool](Get-Command $Name -ErrorAction SilentlyContinue) }
        'Module'     { return [bool](Get-Module -Name $Name -ListAvailable) }
    }
}