Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

<< WAIT >>


devel / alt.msdos.batch / Re: Win10 network on/off toggle with admin privileges

SubjectAuthor
o Re: Win10 network on/off toggle with admin privilegesFromTheRafters

1
Re: Win10 network on/off toggle with admin privileges

<t20rbg$12gr$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=160&group=alt.msdos.batch#160

  copy link   Newsgroups: alt.msdos.batch
Path: i2pn2.org!i2pn.org!aioe.org!QCiEG2yZwKrSNvfSDGS2fg.user.46.165.242.75.POSTED!not-for-mail
From: erratic@nomail.afraid.org (FromTheRafters)
Newsgroups: alt.msdos.batch
Subject: Re: Win10 network on/off toggle with admin privileges
Date: Wed, 30 Mar 2022 00:55:05 -0500
Organization: Peripheral Visions
Message-ID: <t20rbg$12gr$1@gioia.aioe.org>
References: <rvqdmf$dbd$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="35355"; posting-host="QCiEG2yZwKrSNvfSDGS2fg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-ICQ: 1701145376
X-Newsreader: MesNews/1.08.06.00-gb
 by: FromTheRafters - Wed, 30 Mar 2022 05:55 UTC

USE MODEL:
a. Hit the taskbar shortcut (gwtoggle.lnk)
b. If the network was on, it (the gateway) will be turned off.
If the network was off, it (the gateway) will be turned on.
The Windows hardware icons will show the status accordingly.
c. If VPN was on, nothing will happen until the VPN drops.
If the VPN subsequently drops, the network (gateway) will be turned off.
The Windows hardware icons will show the status accordingly.

TASKBAR SHORTCUT:
gwtoggle.lnk
Target = C:\Windows\System32\schtasks.exe /run /TN "task gwtoggle"

SCHEDULED TASK:
taskschd.msc
task gwtoggle
Run with highest privileges = checked
Action = Start a program
Program/script = %comspec%
Add arguments = /c start "anything" c:\pathto\gwtoggle.bat

BATCH SCRIPT:
c:\pathto\gwtoggle.bat
@echo off
set defgw=192.168.1.1
set "ip="
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do if not defined ip set ip=%%~a
IF "%ip%"=="%defgw%" ( %comspec% /c %windir%\system32\route.exe delete 0.0.0.0 %defgw%) ELSE ( %comspec% /c %windir%\system32\route.exe add 0.0.0.0 mask 0.0.0.0 %defgw%)
exit

SHORTCUT ICONS:
https://www.flaticon.com/free-icons/on-off
https://icons8.com/icons/set/on-off
https://iconarchive.com/tag/on-off

Example icon:
https://cdn.icon-icons.com/icons2/1535/PNG/512/3298613-onoff-switch-switchoff-switchon_106998.png

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor