Jump to content
David Schwartz

enable/disable the internet connection?

Recommended Posts

I want a simple form with a button that lets me switch the internet connection on and off. Is there an API call for that?

 

I've got Windows 10 and I HATE IT!!! No matter what I tell it as far as not updating stuff, it just goes along its own merry way and is constantly downloading crap and then telling me, "Oh, sorry, we need to reboot. Back soon! Bye!"

 

I don't use the internet that much, and it's running inside of a VM anyway, so I figure I'll just turn on the ethernet port when I need to reach out, then turn it off when I'm done to keep Gates, er ... gated.

  • Sad 1

Share this post


Link to post

VM usually has much more convenient control over any network adapter.

Moreover, there are means of disabling auto-update. And you can try the option I used since XP - just disabling a winupdate service

  • Like 1

Share this post


Link to post
5 hours ago, David Schwartz said:

Oh, sorry, we need to reboot. Back soon! Bye!

You system must be badly configured. I never have a force reboot using Win10 PRO: the system tells me a reboot is required but don't reboot by itself (You can also set the working hours so that the system still reboot but only in the non-working hours). I suggest you have a better look at all the related setting. And also make sure you have the latest Windows 10. Currently this is version 21H1.

  • Like 3

Share this post


Link to post
1 hour ago, FPiette said:

You system must be badly configured. I never have a force reboot using Win10 PRO: the system tells me a reboot is required but don't reboot by itself (You can also set the working hours so that the system still reboot but only in the non-working hours). I suggest you have a better look at all the related setting. And also make sure you have the latest Windows 10. Currently this is version 21H1.

My thoughts exactly. I saw videos Windows rebooting itself on some live streams and conferences but never happened to me, not even once; and I was testing it from the first Insider build. I also have to admit that Microsoft did a great job around updates (less downtime, torrent-like downloading from Internet and neighboring PCs, active hour detection, etc); whoever says otherwise install Vista or 7 vanilla and try to patch it up to current.

 

I have a feeling that lots of absolute-negative opinions of Windows 10 would flip if only the logo would be Apple instead of Microsoft.

Share this post


Link to post
2 hours ago, FPiette said:

You system must be badly configured. I never have a force reboot using Win10 PRO: the system tells me a reboot is required but don't reboot by itself (You can also set the working hours so that the system still reboot but only in the non-working hours). I suggest you have a better look at all the related setting. And also make sure you have the latest Windows 10. Currently this is version 21H1.

I had some issues at the beginning when I installed W10 fresh. I tried to disable updates but they kept coming back online, but as soon as accepted the behavior and let it update everything and after a couple of days it was all good. Now I just press Pause for 7 days when it notifies me of new updates, if I work on something and can't shutdown.

And updates are so much faster and reliable than W7, it's not annoying anymore. Never experienced any issue with updates, except when I tried fighting them 🙂

Share this post


Link to post
7 hours ago, aehimself said:

I have a feeling that lots of absolute-negative opinions of Windows 10 would flip if only the logo would be Apple instead of Microsoft.

I have no idea what goes on behind the scenes with MacOS, but it does let me say not to install updates and it mostly respects that. Sometimes it does show a little thing that says there's an update and I can click Cancel or Install. Sometimes one of the options is "wait until tomorrow". I don't even like to install MacOS updates.

 

The problem with Windows is it downloads a bunch of files, then it starts running crap in the background and eats up 50% of the CPU for 30-45 minutes, then it tells me there's an update and keeps bugging me about it. I have the updater supposedly disabled. I have searched and shut off everything I've found, and yet it continues to download crap and run that background thing, and then tells me it needs to reboot. I can put it off for a while, but I shut off the VM when I'm not working with it because if the host crashes it can totally screw up the VM if it was open and doing anything. That's part of the reason I shut it off ... because windows is constantly doing background stuff when I'm inactive for 10 minutes or so. Win7 would just sit there and do nothing. Win10 seems to have a bunch of little elves scurrying around constantly doing stuff and there's no way to shut them down. 

 

I know how to open the internet panel and drill-down and enable / disable the network interface in Windows. The VM won't let you turn it on or off while it's running -- you actually have to shut off the VM (not just put it to sleep). It's as if you're unplugging the LAN card.

 

Windows will let you delay only so long before it FORCES a reboot on you, whether you want it or not.

 

And frequently it will start a count-down timer that's hidden beneath another window so you can't see it. I've had that happen in the middle of builds. The timer window appears below Delphi when I kicked off a build, and then a little later I saw a popup that said, "Windows is restarting..." and POOF! Then it shows a screen "Windows is updating, do not power down!" and it goes on for 10-15 minutes.

 

I have NEVER had this happen EVER with MacOS or any Apple product. 

Laptops employers have provided me with do this kind of thing almost weekly. But that's by design. I can't complain about it.

 

But when it's MY machine, I WANT TO BE ABLE TO TELL MICROSOFT AND ITS MINIONS "DO NOT MESS WITH THIS MACHINE!"

 

That seems to be imposible except by shutting off the internet when you're not using it.

 

I just want a little box with an OFF / ON switch for that.

 

You guys are all entitled to your own opinions and your threshold of getting annoyed of being bullied by the OS is whatever it is. I have a lot tolerance for that -- when I'm busy working on something, I don't like to be interrupted by something like a 2-yo that decides to pull the plug on the computer to get your attention. And no, I don't have kids, partly for that reason.

Share this post


Link to post
1 hour ago, David Heffernan said:

The OS already has UI to let you switch connections on and off. Why not use it? 

Yes, I found an option to do that. 

 

But the question was and still is "Is there an API call to do this from a Delphi app" not "is there a windows setting button somewhere that does this".

 

Q: "What's a good pair of boots I can wear at the beach?"

A: "The weather is great, so why not just wear flip-flops?!"

A: "Crocs are really the best thing to wear at the beach"

A: "I prefer going barefoot"

A: <photo of toe-socks>

A: "My gf hates boots. Here's what she has me wear" <photo attached>

Share this post


Link to post
22 hours ago, David Schwartz said:

I've got Windows 10

Which version do your have ? There are several DIFFERENT Windows 10 version. It has been largely enhanced since the first version! Major updates are in the optional updates so you probably are still running the first version. That would explain the different behavior between your WIN10 and mine.

 

Currently the last major release is named "21H1". See attached image from my system.

Capture.PNG

Share this post


Link to post
4 minutes ago, David Schwartz said:

But the question was and still is "Is there an API call to do this from a Delphi app" not "is there a windows setting button somewhere that does this".

With all your experience you shouldn't be surprised when people wonder if there are better ways to solve problems people face. I'm sure you do the same in your work. 

  • Like 2

Share this post


Link to post
3 minutes ago, David Schwartz said:

But the question was and still is "Is there...

/* Don't be offended */ Many peoples are asking questions about how to implement a solution to a problem they have.

You gave the reason why you are asking your question and I gave answers to help solve the update problem you have (I don't have that Windows 10 update so there should be no reason for you to have it).

 

Probably you can achieve your goal by launching netsh utility from your Delphi code. Look at the doc: https://docs.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-contexts

Share this post


Link to post
5 hours ago, David Schwartz said:

Is there an API call to do this from a Delphi app

I did not understand that. Sry.

Share this post


Link to post
5 hours ago, David Schwartz said:

Is there an API call to do this from a Delphi app

There are many posts on this topic on Stack Overflow. What did those posts yield? 

Share this post


Link to post

There is another solution, use the 'route' shell command to temporarily change the gateway and isolate the PC.
Other ways I doubt there are without a dedicated driver (network filter). TCP packets, and worse still UDP packets, cannot be filtered at the user level without a system filter.

 

Bye

Share this post


Link to post

I finally figured out how to shut off the auto-updates. It requires you to make changes to the system policies. So I don't have to shut off the internet connection to prevent it from downloading stuff automatically any more.

 

Now I'd just like to know how to tell Windows 10 to stop doing undisclosed background processing after some amount of idle time. Maybe that's another system policy that needs to be edited...

 

(It seems if you don't do anything for 10 minutes or so, it starts doing some housekeeping activities. It suddenly starts chewing up a bunch of CPU time which makes my computer fan start hissing, like a tea kettle coming to a boil.)

Edited by David Schwartz
  • Sad 1

Share this post


Link to post
Quote

I finally figured out how to shut off the auto-updates.

Please tell us what you found.

 

Quote

It seems if you don't do anything for 10 minutes or so, it starts doing some housekeeping activities.

Virus scan, defragmenter,...

Look at task scheduler there are a huge number of tasks.

 

Share this post


Link to post
3 hours ago, FPiette said:

Please tell us what you found.

 

Virus scan, defragmenter,...

Look at task scheduler there are a huge number of tasks.

 

There are some policies what you can set 

gpedit.msc

Computer Configuration>Administrative Templates>Windows Components>Windows Update

 

But i believe microsoft  can always push updates with nondomain member computers. (have to look that up).

 

  • Like 1

Share this post


Link to post
31 minutes ago, mvanrijnen said:

There are some policies what you can set 

gpedit.msc

Computer Configuration>Administrative Templates>Windows Components>Windows Update 

 

But i believe microsoft  can always push updates with nondomain member computers. (have to look that up). 

  

With that policy, the automatic update is not operational. It can be done manually.
Function on versions of Windows 10 Professional and above, does not work on Windows 10 Home, at least on the latest releases.

 

 

Share this post


Link to post
19 hours ago, DelphiUdIT said:

With that policy, the automatic update is not operational. It can be done manually.

Yes, that's what I want -- to be able to run stuff like this manually. 

Share this post


Link to post

I don't know which one is funnier: the reply, or that an MSFT marked it as an answer 😄

  • Haha 1

Share this post


Link to post

What the heck are you talking about, linux since 10 years and you are asking for an "API"?

Where is an API to do that under linux?

Take a powershell and write your scripts like in linux.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×