I'm writing a Powershell script (on a Win10 machine) that needs to be backward-compatible all the way to Win7 machines - which shipped with Powershell Version 2.0. I'd like to restrict my command set in the ISE to only those commands available in 2.0, or throw an error if I stray outside that version or something while I'm writing the script - is there an easy way to do this?
I don't know if there's a way in the ISE (I think not), but you can start the prompt (console host) separately in 2.0 mode:
powershell.exe -Version 2.0
You could use this in conjunction with ISE by editing and saving the script in ISE, then executing it in the console host. Not ideal, but not too bad of a workaround.