Nâng cấp trên Windows Server 2008 R2 Core - Phương pháp 2

Nâng cấp trên Windows Server 2008 R2 Core - Phương pháp 2

Phương pháp 2: Cài đặt từ kịch bản

Bạn cũng có thể sử mẫu dụng kịch bản dưới đây từ MSDN:

Tìm kiếm, download và cài đặt các nâng cấp: http://msdn.microsoft.com/en-us/library/aa387102(VS.85).aspx

Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
WScript.Echo "Searching for updates..." & vbCRLF
Set searchResult = _
updateSearcher.Search("IsInstalled=0 and Type='Software'")
WScript.Echo "List of applicable items on the machine:"
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
WScript.Echo I + 1 & "> " & update.Title
Next
If searchResult.Updates.Count = 0 Then
WScript.Echo "There are no applicable updates."
WScript.Quit
End If
WScript.Echo vbCRLF & "Creating collection of updates to download:"
Set updatesToDownload = CreateObject("Microsoft.Update.UpdateColl")
For I = 0 to searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
WScript.Echo I + 1 & "> adding: " & update.Title
updatesToDownload.Add(update)
Next
WScript.Echo vbCRLF & "Downloading updates..."
Set downloader = updateSession.CreateUpdateDownloader()
downloader.Updates = updatesToDownload
downloader.Download()
WScript.Echo  vbCRLF & "List of downloaded updates:"
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
If update.IsDownloaded Then
WScript.Echo I + 1 & "> " & update.Title
End If
Next
Set updatesToInstall = CreateObject("Microsoft.Update.UpdateColl")
WScript.Echo  vbCRLF & _
"Creating collection of downloaded updates to install:"
For I = 0 To searchResult.Updates.Count-1
set update = searchResult.Updates.Item(I)
If update.IsDownloaded = true Then
WScript.Echo I + 1 & "> adding:  " & update.Title
updatesToInstall.Add(update)
End If
Next
WScript.Echo  vbCRLF & "Would you like to install updates now? (Y/N)"
strInput = WScript.StdIn.Readline
WScript.Echo
If (strInput = "N" or strInput = "n") Then
WScript.Quit
ElseIf (strInput = "Y" or strInput = "y") Then
WScript.Echo "Installing updates..."
Set installer = updateSession.CreateUpdateInstaller()
installer.Updates = updatesToInstall
Set installationResult = installer.Install()
'Output results of install
WScript.Echo "Installation Result: " & _
installationResult.ResultCode
WScript.Echo "Reboot Required: " & _
installationResult.RebootRequired & vbCRLF
WScript.Echo "Listing of updates installed " & _
"and individual installation results:"
For I = 0 to updatesToInstall.Count - 1
WScript.Echo I + 1 & "> " & _
updatesToInstall.Item(i).Title & _
": " & installationResult.GetUpdateResult(i).ResultCode
Next
End If

 

Copy đoạn văn bản có trong kịch bản, lưu nó dưới file WUA_SearchDownloadInstall.vbs trong thư mục system32 và chạy:

cscript WUA_SearchDownloadInstall.vbs

 

Văn Linh (Theo Petri)

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của vu hoang

Không một gia đình nào là hoàn hảo… vẫn có cãi vã, vẫn có chiến tranh, thậm chí là sự lạnh lùng trong một thời gian rất dài, nhưng cho đến cuối cùng, gia đình vẫn là gia đình… nơi tình yêu luôn luôn hiện hữu.

“Cái gọi là duyên phận, chính là trong ngàn vạn người gặp được người cần gặp là anh, trong ngàn vạn năm, giữa mênh mông hoang hoải vô tận của thời gian, không sớm một bước cũng không muộn một bước.”

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Đại bản doanh của Lenovo Group

“Chiến lược ba bước” của tập đoàn máy tính Lenovo

Công nghệ thông tin Trung Quốc đã có bước tiến vượt bậc, với điển hình là tập đoàn máy tính Lenovo có doanh số tăng từ 25.000 USD với 10 người năm 1984 lên doanh số 14,6 tỉ USD và hơn 25.000 nhân viên.

Disappointing iPhone: Android Device Set to Gain

Disappointing iPhone: Android Device Set to Gain

Asian smartphone makers have a chance to exploit a rare letdown from pacesetter Apple Inc. after the new iPhone 4S failed to wow fans and investors, leaving Android rivals better placed to grab market share.

DrupalCon năm 2015 diễn ra tại Latin America

DrupalCon năm 2015 diễn ra tại Latin America

Yes – it’s true! After extensive research, we have selected the location of DrupalCon Latin American 2015…drumroll please…

Công ty diệt chuột T&C

 

Diet con trung