@Echo Off
SET "HeaderTitle=Network Category - Context-Menu"
TITLE %HeaderTitle%
echo.
SET "OK="
for /f "tokens=4-5 delims=. " %%i in ('ver') do set "TestWinVer=%%i.%%j"
IF /I "%TestWinVer%"=="6.2" SET "OK=1"
IF /I "%TestWinVer%"=="6.3" SET "OK=1"
IF /I "%TestWinVer%"=="10.0" SET "OK=1"
IF NOT DEFINED OK echo This script only works on Windows 8.x/10 Kernels. & GOTO :Finished

cd "%systemroot%\system32"
call :IsAdmin

CLS
TITLE %HeaderTitle%
echo.
echo This should auto-translate the text into the Operating System's
echo installed Language.
echo.

SET "SysDrive=%SystemDrive%"
REG add "HKCR\DesktopBackground\Shell\Network Category" /v "HasLUAShield" /t REG_SZ /d "" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category" /v "Icon" /t REG_EXPAND_SZ /d "imageres.dll,-6203" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category" /v "MUIVerb" /t REG_EXPAND_SZ /d "@%SysDrive%\WINDOWS\system32\netshell.dll,-1019" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category" /v "Position" /t REG_SZ /d "Middle" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category" /v "SubCommands" /t REG_SZ /d "" /f >nul 2>&1

REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Private Network" /v "Icon" /t REG_EXPAND_SZ /d "imageres.dll,-5369" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Private Network" /v "MUIVerb" /t REG_EXPAND_SZ /d "@%SysDrive%\WINDOWS\system32\netshell.dll,-1170" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Private Network\command" /ve /t REG_SZ /d "PowerShell -windowstyle hidden -Command \"Start-Process PowerShell -windowstyle hidden -ArgumentList '$net = get-netconnectionprofile;Set-NetConnectionProfile -Name $net.Name -NetworkCategory Private' -Verb RunAs\"" /f >nul 2>&1

REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Public Network" /v "Icon" /t REG_EXPAND_SZ /d "imageres.dll,-5380" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Public Network" /v "MUIVerb" /t REG_EXPAND_SZ /d "@%SysDrive%\WINDOWS\system32\netshell.dll,-1171" /f >nul 2>&1
REG add "HKCR\DesktopBackground\Shell\Network Category\Shell\Public Network\command" /ve /t REG_SZ /d "PowerShell -windowstyle hidden -Command \"Start-Process PowerShell -windowstyle hidden -ArgumentList '$net = get-netconnectionprofile;Set-NetConnectionProfile -Name $net.Name -NetworkCategory Public' -Verb RunAs\"" /f >nul 2>&1

Echo.
echo Done.

:Finished
echo.
pause
Exit

:IsAdmin
Reg query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
 cls & echo. & Echo You must have administrator rights to run this script... 
 echo. & Pause & Exit
)
Cls
goto:eof
