
Wenn Ninja ein PowerShell-Skript ausführt (über ein benutzerdefiniertes Skript, das Sie Ihrer Skriptbibliothek hinzugefügt haben), geschieht dies über eine 32-Bit-Konsole. Durch Hinzufügen des folgenden Skripts zu Ihrem PowerShell-Skript wird sichergestellt, dass es über eine 64-Bit-Konsole ausgeführt wird.
#Wenn Powershell die 32-Bit-Version auf einem 64-Bit-Rechner ausführt, müssen wir
#Powershell zwingen, im 64-Bit-Modus zu laufen.
#####################################################
if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
write-warning "Ausführung Ihres Skripts im 64-Bit-Modus"
if ($myInvocation.Line) {
&"$env:WINDIRsysnativewindowspowershellv1.0powershell.exe" -NonInteractive -NoProfile $myInvocation.Line
}else{
&"$env:WINDIRsysnativewindowspowershellv1.0powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args
}
exit $lastexitcode
}
write-host "Hauptteil des Skripts"
#Ende