Fix invalid assumption of non-nil code attribute and handle change to use -File instead of -Command with powershell.exe