Updates met WSUS in plaats van Microsoft Windows-website

Ik wil naar Wsus of een lokale map zoeken voor de BIJWERKENs in plaats van Microsoft. Om het even welke ideeën? Dit is wat ik heb, maar dit maakt alleen verbinding met Windows BIJWERKENs via internet.

BIJWERKEN

I FOUND OUT THE ANSWER WITH THE VBS script. The ssdefault server is set by group policy. So if I apply group policy to the WUA then I was able to make automatic BIJWERKENs based on WSUS. For the group policy steps go to: http://technet.microsoft.com/en-us/library/cc512630.aspx Make sure that specify intranet service location is pointing to your wsus server. In our case it was http://wsus for both the statistics and BIJWERKEN service.You also have to enable automatic BIJWERKENs like the article describes.

If you are going to use the C# code below make sure to change BIJWERKENSearchResult.Online = false; if ypu want to search WSUS instead of Online.Thanks for anybody that might have tried to answer this question.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WUApiLib;//this is required to use the Interfaces given by microsoft. 

//todo check isassigned and guids for the following and include them in the search.
//http://msdn.microsoft.com/en-us/library/ff357803(VS.85).aspx
//determine the size of the  BIJWERKEN in mb

namespace MSHWindowsBIJWERKENAgent
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Analyzing your needs");
            BIJWERKENsAvailable();
            if (NeedsBIJWERKEN())
            {
                EnableBIJWERKENServices();//enables everything windows need in order to make an BIJWERKEN
                InstallBIJWERKENs(DownloadBIJWERKENs());
            }
            else
            {
                Console.WriteLine("There are no BIJWERKENs for your computer at this time.");
            }
            Console.WriteLine("Press any key to finalize the process");
            Console.Read();
        }
        //this is my first try.. I can see the need for abstract classes here...
        //but at least it gives most people a good starting point.
        public static  void InstalledBIJWERKENs()
        {
            BIJWERKENSession BIJWERKENSession = new BIJWERKENSession();
            IBIJWERKENSearcher BIJWERKENSearchResult = BIJWERKENSession.CreateBIJWERKENSearcher();
            BIJWERKENSearchResult.Online = true;//checks for BIJWERKENs online
            ISearchResult SearchResults = BIJWERKENSearchResult.Search("IsInstalled=1 AND IsHidden=0");
            //for the above search criteria refer to 
            //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx
            //Check the remakrs section
            Console.WriteLine("The following BIJWERKENs are available");
            foreach (IBIJWERKEN x in SearchResults.BIJWERKENs)
            {
                Console.WriteLine(x.Title);
            }
        }
        public static void BIJWERKENsAvailable()
        {
            BIJWERKENSession BIJWERKENSession = new BIJWERKENSession();
            IBIJWERKENSearcher BIJWERKENSearchResult = BIJWERKENSession.CreateBIJWERKENSearcher();
            BIJWERKENSearchResult.Online = true;//checks for BIJWERKENs online
            ISearchResult SearchResults = BIJWERKENSearchResult.Search(
            "IsInstalled=0 AND IsPresent=0 and IsAssigned=1  AND CategoryIDs contains 'E6CF1350-C01B-414D-A61F-263D14D133B4' OR CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441'  ");
            //for the above search criteria refer to 
            //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx
            //Check the remakrs section

            foreach (IBIJWERKEN x in SearchResults.BIJWERKENs)
            {
                Console.WriteLine(x.Title);
            }
        }
        public static bool NeedsBIJWERKEN()
        {
            BIJWERKENSession BIJWERKENSession = new BIJWERKENSession();
            IBIJWERKENSearcher BIJWERKENSearchResult = BIJWERKENSession.CreateBIJWERKENSearcher();
            BIJWERKENSearchResult.Online = true;//checks for BIJWERKENs online
            ISearchResult SearchResults = BIJWERKENSearchResult.Search("IsInstalled=0 AND IsPresent=0 and IsAssigned=1  AND CategoryIDs contains 'E6CF1350-C01B-414D-A61F-263D14D133B4' OR CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441'");
            //for the above search criteria refer to 
            //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx
            //Check the remakrs section
            if (SearchResults.BIJWERKENs.Count > 0)
                return true;
            else return false;
        }
        public static BIJWERKENCollection DownloadBIJWERKENs()
        {
            BIJWERKENSession BIJWERKENSession = new BIJWERKENSession();
            IBIJWERKENSearcher SearchBIJWERKENs = BIJWERKENSession.CreateBIJWERKENSearcher();

            ISearchResult BIJWERKENSearchResult = SearchBIJWERKENs.Search("IsInstalled=0 AND IsPresent=0 and IsAssigned=1  AND CategoryIDs contains 'E6CF1350-C01B-414D-A61F-263D14D133B4' OR CategoryIDs contains '0FA1201D-4330-4FA8-8AE9-B877473B6441'");
            BIJWERKENCollection BIJWERKENCollection = new BIJWERKENCollection();
            //Accept Eula code for each BIJWERKEN
            for (int i = 0; i < BIJWERKENSearchResult.BIJWERKENs.Count; i++)
            {
                IBIJWERKEN BIJWERKENs = BIJWERKENSearchResult.BIJWERKENs[i];
                if (BIJWERKENs.EulaAccepted == false)
                {
                    BIJWERKENs.AcceptEula();
                }
                BIJWERKENCollection.Add(BIJWERKENs);
            }
            //Accept Eula ends here
            //if it is zero i am not sure if it will trow an exception -- I havent tested it.
            if (BIJWERKENSearchResult.BIJWERKENs.Count > 0)
            {
                BIJWERKENCollection DownloadCollection = new BIJWERKENCollection();
                BIJWERKENDownloader Downloader = BIJWERKENSession.CreateBIJWERKENDownloader();

                for (int i = 0; i < BIJWERKENCollection.Count; i++)
                {
                    DownloadCollection.Add(BIJWERKENCollection[i]);
                }

                Downloader.BIJWERKENs = DownloadCollection;
                Console.WriteLine("Downloading BIJWERKENs... This may take several minutes.");


                IDownloadResult DownloadResult = Downloader.Download();

                BIJWERKENCollection InstallCollection = new BIJWERKENCollection();
                for (int i = 0; i < BIJWERKENCollection.Count; i++)
                {
                    if (DownloadCollection[i].IsDownloaded)
                    {
                        InstallCollection.Add(DownloadCollection[i]);
                    }
                }
                Console.WriteLine("Download Finished");
                return InstallCollection;
            }
            else
                return BIJWERKENCollection;
        }
        public static void InstallBIJWERKENs(BIJWERKENCollection DownloadedBIJWERKENs)
        {
            Console.WriteLine("Installing BIJWERKENs now...");
            BIJWERKENSession BIJWERKENSession = new BIJWERKENSession();
            BIJWERKENInstaller InstallAgent = BIJWERKENSession.CreateBIJWERKENInstaller() as BIJWERKENInstaller;
            InstallAgent.BIJWERKENs = DownloadedBIJWERKENs;

            //Starts a synchronous installation of the BIJWERKENs.
           //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386491(v=VS.85).aspx#methods
            if (DownloadedBIJWERKENs.Count > 0)
            {
                IInstallationResult InstallResult = InstallAgent.Install();
                if (InstallResult.ResultCode == OperationResultCode.orcSucceeded)
                {
                    Console.WriteLine("BIJWERKENs installed succesfully");
                    if (InstallResult.RebootRequired == true)
                    {
                        Console.WriteLine("Reboot is required for one of more BIJWERKENs.");
                    }
                }
                else
                {
                    Console.WriteLine("BIJWERKENs failed to install do it manually");
                }
            }
            else
            {
                Console.WriteLine("The computer that this script was executed is up to date");
            }

        }
        public static void EnableBIJWERKENServices()
        {
            IAutomaticBIJWERKENs BIJWERKENs = new AutomaticBIJWERKENs();
            if (!BIJWERKENs.ServiceEnabled)
            {
                Console.WriteLine("Not all BIJWERKENs services where enabled. Enabling Now" + BIJWERKENs.ServiceEnabled);
                BIJWERKENs.EnableService();
                Console.WriteLine("Service enable success");
            }


        }

    }
}

Het uitvoeren van het volgende script helpt me de configuratie van WUA te bepalen

'---------------------START-----------------------

' Einstellungen für die automatischen BIJWERKENs
' http://www.wsus.de/
' Version 1.05.04.1
' Translated quick and dirty into English Marco Biagini
' [email protected]
'--------------------------------------------
On Error Resume Next

Set objWshNet = CreateObject("Wscript.Network")

const HKCU = &H80000001
const HKLM = &H80000002

strDefComputer = lcase(objWshNet.ComputerName)

Set oArgs = WScript.Arguments
If oArgs.Count = 0 Then
 strComputer = InputBox("Please enter the name or IP address of the Computer that you want to check WSUS settings", "Automatic BIJWERKENs", strDefComputer)
Else
 strComputer = oArgs(0)
End If

If strComputer = "" Then
 WScript.Quit
End if

strComputer = lcase(strComputer)
if left(strComputer,2)="\\" then
 strComputer=right(strComputer,(len(strComputer)-2))
end if

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

If Err.Number <> 0 Then
 msgbox "Unable to connect to:" & VBCRLF & VBCRLF & "     " & strComputer & VBCRLF, vbCritical, "Communication Error"
 WScript.Quit
End If

Resultmsg = "**** Results of WUA Settings ****" & VBCRLF & VBCRLF

strMsg = "No Auto BIJWERKEN:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "NoAutoBIJWERKEN"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetNoAutoBIJWERKEN(dwValue) & VBCRLF & VBCRLF
Else
 Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF & VBCRLF
End If

strMsg = "Use WU Server:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "UseWUServer"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetUseWUServer(dwValue) & VBCRLF

 If dwValue = "1" Then
  strMsg = "  - WSUS Server:  "
  strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN"
  strValueName = "WUServer"
  If RegValueExists(strKeyPath, strValueName) Then
   oReg.GetStringValue HKLM,strKeyPath,strValueName,strValue
   Resultmsg = Resultmsg & strMsg & strValue & VBCRLF
  Else
   Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF
  End If

  strMsg = "  - WU Status Server:  "
  strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN"
  strValueName = "WUStatusServer"
  If RegValueExists(strKeyPath, strValueName) Then
   oReg.GetStringValue HKLM,strKeyPath,strValueName,strValue
   Resultmsg = Resultmsg & strMsg & strValue & VBCRLF
  Else
   Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF
  End If
 Else
  Resultmsg = Resultmsg & VBCRLF
 End If
Else
 Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF
 Resultmsg = Resultmsg & "  - Client configured to receive BIJWERKENs from windowsBIJWERKEN.microsoft.com" & VBCRLF
End If

strMsg = "  - TargetGroup:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN"
strValueName = "TargetGroup"
 If RegValueExists(strKeyPath, strValueName) Then
  oReg.GetStringValue HKLM,strKeyPath,strValueName,strValue
  Resultmsg = Resultmsg & strMsg & strValue & VBCRLF & VBCRLF
 Else
  Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF & VBCRLF
End If

strMsg = "AU Options:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "AUOptions"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetAUOptions(dwValue) & VBCRLF

 If dwValue = "4" Then
  strMsg = "  - Scheduled Install Day:  "
  strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
  strValueName = "ScheduledInstallDay"
  If RegValueExists(strKeyPath, strValueName) Then
   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
   Resultmsg = Resultmsg & strMsg & getday(dwValue) & VBCRLF
  Else
   Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  End If

  strMsg = "  - Planned Installation Time:  "
  strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
  strValueName = "ScheduledInstallTime"
  If RegValueExists(strKeyPath, strValueName) Then
   oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
   Resultmsg = Resultmsg & strMsg & dwValue &":00 - 24 hours 4:00 is 4 AM, 16:00 is 4 PM" & VBCRLF
  Else
   Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
  End If
 Else
   Resultmsg = Resultmsg & VBCRLF
 End If

Else
 Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF
 strMsg = "  - Benutzerdefinierte Einstellung:  "
 strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsBIJWERKEN\Auto BIJWERKEN"
 strValueName = "AUOptions"
 If RegValueExists(strKeyPath, strValueName) Then
  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  Resultmsg = Resultmsg & strMsg & GetAUOptions(dwValue) & VBCRLF

  If dwValue = "4" Then
   strMsg = "    - ScheduledInstallDay:  "
   strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsBIJWERKEN\Auto BIJWERKEN"
   strValueName = "ScheduledInstallDay"
   If RegValueExists(strKeyPath, strValueName) Then
    oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
    Resultmsg = Resultmsg & strMsg & getday(dwValue) & VBCRLF
   Else
    Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF
   End If

   strMsg = "    - ScheduledInstallTime:  "
   strKeyPath = "Software\Microsoft\Windows\CurrentVersion\WindowsBIJWERKEN\Auto BIJWERKEN"
   strValueName = "ScheduledInstallTime"
   If RegValueExists(strKeyPath, strValueName) Then
    oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
    Resultmsg = Resultmsg & strMsg & dwValue &":00" & VBCRLF
   Else
    Resultmsg = Resultmsg & strMsg & "Automatic BIJWERKENs are not configured" & VBCRLF
   End If
  Else
    Resultmsg = Resultmsg & VBCRLF
  End If

 Else
  Resultmsg = Resultmsg & strMsg & "Not configured" & VBCRLF
 End If
End If

strMsg = "  - NoAUShutdownOption:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "NoAUShutdownOption"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetNoAUShutdownOption(dwValue) & VBCRLF & VBCRLF
Else
 Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF & VBCRLF
End If

strMsg = "AutoInstallMinorBIJWERKENs:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "AutoInstallMinorBIJWERKENs"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetAutoInstallMinorBIJWERKENs(dwValue) & VBCRLF & VBCRLF
Else
 Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF & VBCRLF
End If

strMsg = "DetectionFrequency:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "DetectionFrequency"
 If RegValueExists(strKeyPath, strValueName) Then
  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  Resultmsg = Resultmsg & strMsg &"Every " & dwValue &" Hours to search for BIJWERKENs"& VBCRLF
 Else
   Resultmsg = Resultmsg & strMsg & "Value is not configured"& VBCRLF
 End If

strMsg = "RebootRelaunchTimeout:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "RebootRelaunchTimeout"
 If RegValueExists(strKeyPath, strValueName) Then
  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  Resultmsg = Resultmsg & strMsg & dwValue &" Minutes to wait until system restart"& VBCRLF
 Else
   Resultmsg = Resultmsg & strMsg & "Value is not configured" & VBCRLF
 End If

strMsg = "RebootWarningTimeout:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "RebootWarningTimeout"
 If RegValueExists(strKeyPath, strValueName) Then
  oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
  Resultmsg = Resultmsg & strMsg & dwValue &" Minutes wait until system restart"& VBCRLF
 Else
   Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
End If

strMsg = "NoAutoRebootWithLoggedOnUsers:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "NoAutoRebootWithLoggedOnUsers"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 Resultmsg = Resultmsg & strMsg & GetNoAutoReboot(dwValue) & VBCRLF
Else
 Resultmsg = Resultmsg & strMsg & "Value not configured" & VBCRLF
 Resultmsg = Resultmsg & "  - Default: User will be presented with a 5 minutes countdown" & VBCRLF
End If

strMsg = "RescheduleWaitTime:  "
strKeyPath = "Software\Policies\Microsoft\Windows\WindowsBIJWERKEN\AU"
strValueName = "RescheduleWaitTime"
If RegValueExists(strKeyPath, strValueName) Then
 oReg.GetDWORDValue HKLM,strKeyPath,strValueName,dwValue
 If dwValue = "0" Then Resultmsg = Resultmsg & strMsg & "Value not configured: " & dwValue & VBCRLF & VBCRLF End If
 If dwValue = "1" Then Resultmsg = Resultmsg & strMsg & dwValue &" Minute" & VBCRLF & VBCRLF End If
 If dwValue > "1" and dwValue < "61" Then Resultmsg = Resultmsg & strMsg & dwValue &" Minutes" & VBCRLF & VBCRLF End If
 If dwValue > "60" Then Resultmsg = Resultmsg & strMsg & "Invalid Value" & dwValue & VBCRLF & VBCRLF End If
Else
 Resultmsg = Resultmsg & strMsg & "Not Configured" & VBCRLF & VBCRLF
End If


Resultmsg = Resultmsg & "http://www.wsus.de" & VBCRLF & "Die Infoseite zu Windows Server BIJWERKENs Services"

MsgBox Resultmsg,,strComputer

set oReg = nothing


Function GetNoAutoBIJWERKEN(Index)
 Select Case Index
  Case 0 GetNoAutoBIJWERKEN = "0 - Auto BIJWERKEN applied by GPO"
  Case 1 GetNoAutoBIJWERKEN = "1 - No Auto BIJWERKEN is applied by GPO"
  Case Else GetNoAutoBIJWERKEN = "Invalid Entry"
 End select
End Function

Function GetUseWUServer(Index)
 Select Case Index
  Case 0 GetUseWUServer = "0 - Client is configured to receive BIJWERKENs from windowsBIJWERKEN.microsoft.com"
  Case 1 GetUseWUServer = "1 - Client is configured to receive BIJWERKENs from your WSUS Server"
  Case Else GetUseWUServer = "Invalid Entry"
 End select
End Function

Function GetDay(Index)
 Select Case Index
  Case "0" GetDay = "Every Day"
  Case "1" GetDay = "Every Sunday"
  Case "2" GetDay = "Every Monday"
  Case "3" GetDay = "Every Tuesday"
  Case "4" GetDay = "Every Wednesday"
  Case "5" GetDay = "Every Thursday"
  Case "6" GetDay = "Every Friday"
  Case "7" GetDay = "Every Saturday"
  Case Else GetDay = "Invalid Entry"
 End select
End Function

Function GetAUOptions(Index)
 Select Case Index
  Case "0" GetAUOptions = "0"
  Case "1" GetAUOptions = "1 - Deaktiviert in den Benutzereinstellungen"
  Case "2" GetAUOptions = "2 - Notify before download and Install."
  Case "3" GetAUOptions = "3 - Autom. Download, notify before installation."
  Case "4" GetAUOptions = "4 - Autom. Download, install according to GPO settings."
  Case "5" GetAUOptions = "5 - Allow Local Administator installation and manual configuration."
  case Else GetAUOptions = "Invalid Entry"
 End select
End Function

Function GetNoAUShutdownOption(Index)
 Select Case Index
  Case 0 GetNoAUShutdownOption = "0 - 'BIJWERKENs are being installed and system will be restarted' user ill be notified"
  Case 1 GetNoAUShutdownOption = "1 - 'BIJWERKENs are being installed and system will be restarted' user will NOT be notified"
  Case Else GetNoAUShutdownOption = "Invalid Entry"
 End select
End Function

Function GetAutoInstallMinorBIJWERKENs(Index)
 Select Case Index
  Case 0 GetAutoInstallMinorBIJWERKENs = "0 - Automatic BIJWERKENs are not immediately installed"
  Case 1 GetAutoInstallMinorBIJWERKENs = "1 - Automatic BIJWERKENs are immediately installed"
  Case Else GetAutoInstallMinorBIJWERKENs = "Invalid Entry"
 End select
End Function

Function GetNoAutoReboot(Index)
 Select Case Index
  Case "0" GetNoAutoReboot = "0 - User Countdown of 5 Minutes"
  Case "1" GetNoAutoReboot = "1 - User will be notified before a system restart"
  case Else GetNoAutoReboot = "Invalid Entry"
 End select
End Function

Function RegValueExists(sRegKey, sRegValue)
  sRegKey = Trim(sRegKey)
  sRegValue = LCase(Trim(sRegValue))
  ' init value
  RegValueExists = False
  If oReg.EnumValues(HKLM, sRegKey, aValueNames, aValueTypes) = 0 Then
    If Not IsNull(aValueNames) Then
      For i = 0 To UBound(aValueNames)
        If LCase(aValueNames(i)) = sRegValue Then
          RegValueExists = True
        End If
      Next
    End If
  End If
End Function

Function RegKeyExists(sRegKey)
  sRegKey = Trim(sRegKey)
  If oReg.EnumValues(HKLM, sRegKey, aValueNames, aValueTypes) = 0 Then
    RegKeyExists = True
  Else
    RegKeyExists = False
  End If
End Function

'---------------------END-----------------------
15
Wie heeft hierboven de C# -code geschreven?
toegevoegd de auteur T.Coutlakis, de bron
Ik heb dit zojuist ontdekt: msdn. microsoft.com/en-us/library/windows/desktop/… maar hoe stel ik de ssManagedServer in? Daar ben ik momenteel mee bezig.
toegevoegd de auteur hidden, de bron
Iets anders dat ik zojuist heb ontdekt: Wanneer ik dat doe: Console.WriteLine (UpdateSearchResult.ServerSelection.ToStrin & zwnj; g ()); het resultaat is ssDefault. Die kwam ik te weten: ssDefault Alleen gebruikt door IUpdateSearcher. Geeft aan dat de zoekactie naar de standaardserver moet zoeken. De standaardserver die wordt gebruikt door de Windows Update Agent (WUA) is dezelfde als ssMangagedServer als de computer is ingesteld om een ​​beheerde server te hebben. Als de computer niet is ingesteld om een ​​beheerde server te hebben, gebruikt WUA de eerste updateservice waarvoor de eigenschap IsRegisteredWithAU van IUpdateService is ingesteld op true
toegevoegd de auteur hidden, de bron
Ik waarom is het zo slecht !?
toegevoegd de auteur hidden, de bron
Goede vraag en zelf-antwoord. Ik raad u aan de oplossing te verplaatsen naar een echt antwoord op uw vraag en deze als zodanig te markeren.
toegevoegd de auteur KP., de bron

1 antwoord

Ik heb een eenvoudige C# -app geschreven die alle updates van een lokale server met de naam SRV1 haalt en deze alleen op Windows 7-systemen gebruikt. Het maakt gebruik van ASP.NET 3.5 dat standaard door Windows 7 wordt geïnstalleerd.

Verander eenvoudig de SRV1 in de bron in uw lokale wsus-server.

Source code can be found here

3
toegevoegd
Ik heb het project gedownload maar zag geen enkele code die zou impliceren dat er iets van wsus zou worden gedownload.
toegevoegd de auteur hidden, de bron