if (-not([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Write-Warning "You need to have Administrator rights to run this script!`nPlease re-run this script as an Administrator in an elevated powershell prompt!" Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "irm bonguides.com/office | iex" break } # Load ddls to the current session. Add-Type -AssemblyName PresentationFramework, System.Drawing, PresentationFramework, System.Windows.Forms, WindowsFormsIntegration, PresentationCore [System.Windows.Forms.Application]::EnableVisualStyles() # Place your xaml code from Visual Studio in here string (between @ symbols) # $xamlinput = @'