#this script minimizes the content player and switches to the start screen #minimize Powershell script $sig = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32 $PSId = @(Get-Process "powershell" -ErrorAction SilentlyContinue)[0].MainWindowHandle If ($PSId -ne $NULL) { [Win32.NativeMethods]::ShowWindowAsync($PSId, 2)} #Minimize the content player $sig = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);' Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32 #find the process ID for the content player $hwnd = @(Get-Process "signage")[0].MainWindowHandle # "Hidden" {$WinStateInt = 0} # "Normal" {$WinStateInt = 1} # "ShowMinimized" {$WinStateInt = 2} # "Maximized" {$WinStateInt = 3} # "ShowNoActivate" {$WinStateInt = 4} # "Show" {$WinStateInt = 5} # "Minimized" {$WinStateInt = 6} # "ShowMinNoActive" {$WinStateInt = 7} # "ShowNA" {$WinStateInt = 8} # "Restore" {$WinStateInt = 9} # "ShowDefault" {$WinStateInt = 10} # "ForceMinimize" {$WinStateInt = 11} # minimize content player window [Win32.NativeMethods]::ShowWindowAsync($hwnd, 11) #execute CTRL=ESC command to switch to start screen [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms") [System.Windows.Forms.SendKeys]::SendWait("^{ESC}")