Skip to content

Instantly share code, notes, and snippets.

@skyblaster
Last active April 3, 2023 15:56
Show Gist options
  • Save skyblaster/d61d0137afb718e4420fad4f19baf162 to your computer and use it in GitHub Desktop.
Save skyblaster/d61d0137afb718e4420fad4f19baf162 to your computer and use it in GitHub Desktop.
OSD WiFi hack
#=================================================
# 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