hier noch eine etwas elegantere Lösung mit Powershell, um das Windows Sandbox Fenster maximiert zu starten:
folgendes PS Script startet die Sandbox ganz normal; ohne Konfiguration:
Code: Alles auswählen
$exe = Join-Path $env:windir "System32\WindowsSandbox.exe"
Start-Process $exe | Out-Null
Add-Type @"
using System;
using System.Runtime.InteropServices;
public static class Win32 {
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
$proc = $null
for ($i=0; $i -lt 600; $i++) {
$proc = Get-Process -Name "WindowsSandboxRemoteSession" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($proc) { $proc.Refresh(); if ($proc.MainWindowHandle -ne 0) { break } }
Start-Sleep -Milliseconds 100
}
if (-not $proc -or $proc.MainWindowHandle -eq 0) { throw "Sandbox-Fenster nicht gefunden." }
Start-Sleep -Seconds 8
[Win32]::ShowWindow($proc.MainWindowHandle, 3) | Out-Null # SW_MAXIMIZE
[Win32]::SetForegroundWindow($proc.MainWindowHandle) | Out-Null
bei "Start-Sleep -Seconds 8" muss man etwas jonglieren. Evtl. reichen da auch schon ein paar Sekunden weniger.
möchte man die Sandbox mit einer Konfigurationsdatei (.wsb) starten, dann sieht das so aus:
Code: Alles auswählen
$wsb = "C:\Users\Public\Downloads\WSB_portable.wsb"
Start-Process -FilePath $wsb | Out-Null
Add-Type @"
using System;
using System.Runtime.InteropServices;
public static class Win32 {
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
$proc = $null
for ($i=0; $i -lt 600; $i++) {
$proc = Get-Process -Name "WindowsSandboxRemoteSession" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($proc) {
$proc.Refresh()
if ($proc.MainWindowHandle -ne 0) { break }
}
Start-Sleep -Milliseconds 100
}
if (-not $proc -or $proc.MainWindowHandle -eq 0) { throw "Sandbox-Fenster nicht gefunden." }
Start-Sleep -Seconds 10
[Win32]::ShowWindow($proc.MainWindowHandle, 3) | Out-Null
[Win32]::SetForegroundWindow($proc.MainWindowHandle) | Out-Null
hier müßte der Speicherort der .wsb angepasst werden (im Beispiel: $wsb = "C:\Users\Public\Downloads\WSB_portable.wsb") und die Sekunden ggf. ebenfalls (Start-Sleep -Seconds 10).
Ein Beispiel für eine .wsb findet ihr hier:
viewtopic.php?p=453572#p453559
Diese .wsb umgeht die Smart App Control in der Sandbox
Bei Fragen: einfach fragen

hier noch eine etwas elegantere Lösung mit Powershell, um das Windows Sandbox Fenster maximiert zu starten:
folgendes PS Script startet die Sandbox ganz normal; ohne Konfiguration:
[code]$exe = Join-Path $env:windir "System32\WindowsSandbox.exe"
Start-Process $exe | Out-Null
Add-Type @"
using System;
using System.Runtime.InteropServices;
public static class Win32 {
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
$proc = $null
for ($i=0; $i -lt 600; $i++) {
$proc = Get-Process -Name "WindowsSandboxRemoteSession" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($proc) { $proc.Refresh(); if ($proc.MainWindowHandle -ne 0) { break } }
Start-Sleep -Milliseconds 100
}
if (-not $proc -or $proc.MainWindowHandle -eq 0) { throw "Sandbox-Fenster nicht gefunden." }
Start-Sleep -Seconds 8
[Win32]::ShowWindow($proc.MainWindowHandle, 3) | Out-Null # SW_MAXIMIZE
[Win32]::SetForegroundWindow($proc.MainWindowHandle) | Out-Null
[/code]
bei "Start-Sleep -Seconds 8" muss man etwas jonglieren. Evtl. reichen da auch schon ein paar Sekunden weniger.
möchte man die Sandbox mit einer Konfigurationsdatei (.wsb) starten, dann sieht das so aus:
[code]$wsb = "C:\Users\Public\Downloads\WSB_portable.wsb"
Start-Process -FilePath $wsb | Out-Null
Add-Type @"
using System;
using System.Runtime.InteropServices;
public static class Win32 {
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
$proc = $null
for ($i=0; $i -lt 600; $i++) {
$proc = Get-Process -Name "WindowsSandboxRemoteSession" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($proc) {
$proc.Refresh()
if ($proc.MainWindowHandle -ne 0) { break }
}
Start-Sleep -Milliseconds 100
}
if (-not $proc -or $proc.MainWindowHandle -eq 0) { throw "Sandbox-Fenster nicht gefunden." }
Start-Sleep -Seconds 10
[Win32]::ShowWindow($proc.MainWindowHandle, 3) | Out-Null
[Win32]::SetForegroundWindow($proc.MainWindowHandle) | Out-Null[/code]
hier müßte der Speicherort der .wsb angepasst werden (im Beispiel: $wsb = "C:\Users\Public\Downloads\WSB_portable.wsb") und die Sekunden ggf. ebenfalls (Start-Sleep -Seconds 10).
Ein Beispiel für eine .wsb findet ihr hier:
[url]https://www.deskmodder.de/phpBB3/viewtopic.php?p=453572#p453559[/url]
Diese .wsb umgeht die Smart App Control in der Sandbox
Bei Fragen: einfach fragen :smile: