How to check if a cmdlet exists in PowerShell at runtime via script
Use the Get-Command cmdlet to test for the existence of a cmdlet: if (Get-Command $cmdName -errorAction SilentlyContinue) { “$cmdName exists” } And if you want to ensure it is a cmdlet (and not an exe or function or script) use the -CommandType parameter e.g -CommandType Cmdlet