public static IUpdateService2 GetService(this PSCmdlet command, bool force)
        {
            _command = command;

            DownloadWusscn2(force);

            IUpdateServiceManager manager = new UpdateServiceManager();

            return((IUpdateService2)manager.AddScanPackageService("Offline Sync Service", "D:\\wsusscn2.cab", 1));
        }
Exemplo n.º 2
0
        private bool SetOffline()
        {
            try
            {
                AppLog.Line(Program.fmt("Setting up 'Offline Sync Service'"));

                // http://go.microsoft.com/fwlink/p/?LinkID=74689
                mOfflineService = mUpdateServiceManager.AddScanPackageService("Offline Sync Service", Directory.GetCurrentDirectory() + @"\wsusscn2.cab");

                mUpdateSearcher.ServerSelection = ServerSelection.ssOthers;
                mUpdateSearcher.ServiceID       = mOfflineService.ServiceID;
                mUpdateSearcher.Online          = true;
                return(true);
            }
            catch (Exception err)
            {
                AppLog.Line(err.Message);
                return(false);
            }
        }