I\'m using PowerShell scripts for some UI automation of a WPF application. Normally, the scripts are run as a group, based on the value of a global variable. It\'s a littl
EDIT: Use stej's answer below. My own (partially incorrect) one is still reproduced here for reference:
You can use
Get-Variable foo -Scope Global
and trap the error that is raised when the variable doesn't exist.