Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tags: SysAdminDoc/DefenderControl

Tags

v3.2.1

Toggle v3.2.1's commit message
fix: auto-relaunch under Windows PowerShell 5.1 when invoked from pwsh

Running the script from PowerShell 7 (pwsh.exe) previously errored out with
a MessageBox "Wrong PowerShell Edition" and exited. The script now detects
PSEdition == 'Core' before any WPF load and re-spawns itself under
powershell.exe (Windows PowerShell 5.1) with the full arg list preserved:

  CLI mode:  Start-Process -Wait -NoNewWindow -PassThru so stdout/stderr/exit
             code return to the caller. If not elevated, adds -Verb RunAs so
             the single re-launch handles both edition swap and UAC in one
             prompt.
  GUI mode:  Fire-and-forget new window (adds -Verb RunAs if not admin).

If auto-launch fails (unlikely) the CLI path writes a clear error to stderr
and the GUI path surfaces a MessageBox with the manual command.

Arg forwarding factored out into Get-ForwardedArgString so both the edition
re-host and the self-elevation code path use identical logic.

Release v3.2.1.

v3.2.0

Toggle v3.2.0's commit message
release: v3.2.0

v3.1.0

Toggle v3.1.0's commit message
Add .gitignore