Last active
April 3, 2023 15:56
-
-
Save skyblaster/d61d0137afb718e4420fad4f19baf162 to your computer and use it in GitHub Desktop.
OSD WiFi hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#================================================= | |
# Initialize Wireless Network | |
#================================================= | |
if (Test-Path "$env:SystemRoot\System32\dmcmnutils.dll") { | |
Write-Host -ForegroundColor DarkGray "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Wireless Network" | |
if ($WirelessConnect){ | |
Start-Process PowerShell -ArgumentList 'Start-WinREWiFi -WirelessConnect' -Wait | |
} | |
else { | |
Write-Host -ForegroundColor Cyan "$((Get-Date).ToString('yyyy-MM-dd-HHmmss')) Starting WlanSvc Service" -NoNewline | |
if (Get-Service -Name WlanSvc) { | |
if ((Get-Service -Name WlanSvc).Status -ne 'Running') { | |
Get-Service -Name WlanSvc | Start-Service | |
Start-Sleep -Seconds 10 | |
} | |
} | |
Write-Host -ForegroundColor Green 'OK' | |
Connect-WinREWiFiByXMLProfile $env:SystemDrive\WiFiProfile.xml -ErrorAction Stop | |
Start-Sleep -Seconds 60 | |
Start-Process PowerShell Start-WinREWiFi -Wait | |
} | |
} | |
#================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment