There was a post on the PowerShell Facebook group today asking how to set the “Run As Administrator” checkbox on the Compatibility tab of the properties for an application.

The compatibility settings are just registry entries, either under the user’s account or under the local machine.

(You can find them under HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers or

HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers)

Compatibility settings reference the path of the executable as the value and store the app compat flags in the data for the registry key.

I’ve written a quick PowerShell script to automate the setting of these compatibility flags and posted it on PoshCode.

Want more great reading? Check out my reading list!