ConfigMgr PowerShell Script to check if Application or Program is allowed to run in TS without being deployed

Kind of a long title for a blog post, but I could not come up with something shorter to describe the content of this blog post. The below script shows the status of the “Allow this Application / program to be installed from the Application / program install task sequence action without being deployed” setting.  

Additional Information SMS_Program Server WMI Class (ProgramFlags) Application.AutoInstall Property Application Members