Skip to content

Instantly share code, notes, and snippets.

@foxyseta
Created June 18, 2021 20:25
Show Gist options
  • Save foxyseta/cd29ee35fc6177b8d7cc984b51b3b54e to your computer and use it in GitHub Desktop.
Save foxyseta/cd29ee35fc6177b8d7cc984b51b3b54e to your computer and use it in GitHub Desktop.

Revisions

  1. foxyseta created this gist Jun 18, 2021.
    12 changes: 12 additions & 0 deletions xml_to_wifi.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # configure Wi-Fi using dynamic IP (admin required)
    if (-not (new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
    {
    $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
    $newProcess.Arguments = $myInvocation.MyCommand.Definition;
    $newProcess.Verb = "runas";
    [System.Diagnostics.Process]::Start($newProcess);
    exit
    }
    netsh interface ip set address "Wi-Fi" dhcp
    netsh WLAN add profile "E:\wifi.xml"
    pause