1

I'm looking for a way to disable automatic Windows-Updates on Windows 7 when connected to the internet wirelessly.

The clients are all connected to a 2008 R2 Domaincontroller.

Doing a quick google search, i couldnt find anything at all.

There has to be a way to accomplish this i assume.

Does anybody know a registry key, or some group policy hack that will help me do this?

Thanks

  • 1
    For Windows 8.1 and 10 you can set a connection as metered, which will suppress downloading of all but important updates. Not sure what if anything you can do on 7. – Michael Hampton Mar 17 '16 at 09:39
  • thanks ill keep that in mind for when we migrate to windows 10 but for now, this wont help me as were all using windows 7 – Master Azazel Mar 17 '16 at 09:50

2 Answers2

0

Not sure how efficient it would be, but you can right a script that runs and checks for network connectivity(card is enabled, has pulled an IP address) through the WLAN adapter and then stop the Windows update service. Just a thought

jdycus002
  • 81
  • 1
  • 6
  • alright! thats a pretty good idea. we will try writing a little c# tool that eighter performs a check periodically or attaches itself to the system to be called when the ip changes if there is a way to do that. thanks! – Master Azazel Mar 17 '16 at 15:39
  • Sounds like a good plan. Glad it was able to get you headed in the right direction! – jdycus002 Mar 17 '16 at 16:38
0

Maybe you can use this fast hacked but realy easy C# Code. I would suggest to put that into an own "Service" which will be deployed (e.g. over GPO) on the target machines.

So what does the code: It creates an eventhandler on "NetworkInformation.NetworkAddressChanged" which always triggers, if something on the network interfaces changes (e.g. WIFI has been deactivated, IP Address changed, Laptop put on ethernet). Then it checks if at least one ethernet network interface is up: if so, start the "Windows Update" service - if not, stop the "Windows Update" servic

namespace WindowsUpdateLANOnly
{
    class Program
    {
        static void Main(string[] args)
        {
            //NetworkInformation from reference: System.Net.NetworkInformation
            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(AddressChangedCallback);
            Console.WriteLine("Listening for address changes. Press any key to exit.");
            Console.ReadLine();
        }

        private static void AddressChangedCallback(object sender, EventArgs e)
        {
            //handle only events from the ethernet network interface
            var adapters = NetworkInterface.GetAllNetworkInterfaces().Where(p => p.NetworkInterfaceType == NetworkInterfaceType.Ethernet);
            //check if we have at least one ethernet network interface online
            bool isOnLAN = false;
            foreach (NetworkInterface ethernetNetwork in adapters)
            {
                Console.WriteLine("   {0} is {1}", ethernetNetwork.Name, ethernetNetwork.OperationalStatus);
                if (ethernetNetwork.OperationalStatus == OperationalStatus.Up)
                {
                    isOnLAN = true;
                }
            }
            //deactivate or activate the windows update service
            WindowsUpdateService(isOnLAN);
        }

        private static void WindowsUpdateService(bool start)
        {   //ServiceController from reference: System.ServiceProcess
            ServiceController sc = new ServiceController("Windows Update");

            Console.WriteLine("Try to {0} the windows update service", start?"Activate":"Deactivate");
            if (start) //should start
            {
                if(sc.Status.Equals(ServiceControllerStatus.Stopped) ||
                    sc.Status.Equals(ServiceControllerStatus.StopPending))
                {
                    sc.Start();
                    //var timeout = new TimeSpan(0, 0, 5); // 5 seconds
                    //sc.WaitForStatus(ServiceControllerStatus.Running, timeout);
                    Console.WriteLine("Windows update service started");
                }
            }
            else //should stop
            {
                if (sc.Status.Equals(ServiceControllerStatus.Running) ||
                    sc.Status.Equals(ServiceControllerStatus.StartPending))
                {
                    sc.Stop();
                    //var timeout = new TimeSpan(0, 0, 5); // 5 seconds
                    //sc.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                    Console.WriteLine("Windows update service stopped");
                }
            }
        }
    }
}

What do you think?

dataCore
  • 206
  • 3
  • 7