I want to remove all user-created variables at the start of a script.
Currently I am doing Remove-Variable -Name * but it tries to dele
Remove-Variable -Name *
I suppose you could make a list of all the variables you don't want to delete.
$DontDelete = '$','?','^','args',...,'WhatIfPreference'
Then delete the variables that are not on the Don't Delete list.