How to set Citrix XenApp 7.6 Policies with PowerShell

I was recently asked how to create Citrix policies with PowerShell and I must admit that it took me some time to figure it out. If you search for solutions you get only a few hints on how to do it. The best hint came from Ingmar Verheij (http://www.ingmarverheij.com/set-citrix-policies-via-powershell/) but