miten olisi parasta piilottaa ja poistaa tarpeettomat päivitykset kun ei ole wsus käytössä. tällä hetkellä on käytössä tuollainen skripti mutta sen suoritusaika alkaa olla melkoisen pitkä vähänkin heikommalla raudalla. poistoon on toinen skripti jolla vaan wusa.exellä käydään läpi poistaen kaikki tarpeettomat päivitykset.
Function WuaVersion 'get current WUA version
Dim oAgentInfo, ProductVersion
On Error Resume Next
Err.Clear
Set oAgentInfo = CreateObject("Microsoft.Update.AgentInfo")
If ErrNum = 0 Then
WuaVersion = oAgentInfo.GetInfo("ProductVersionString")
Else
Wscript.Echo "Error getting WUA version."
WuaVersion = 0 'calling code can interpret 0 as an error.
End If
On Error Goto 0
End Function
if WuaVersion <> "0" then
Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
'add the Microsoft Update Service, GUID
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
end if
'ServerSelection values
ssDefault = 0
ssManagedServer = 1
ssWindowsUpdate = 2
ssOthers = 3
'InStr values
intSearchStartChar = 1
dim strTitle
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
updateSearcher.ServerSelection = ssWindowsUpdate
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB971033", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2970228", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3004394", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3035583", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2965295", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2965270", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3038314", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2990214", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2952664", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3021917", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3068708", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
WScript.Quit
mutta onko tähän jotain parempaa tapaa, tuo toimii mutta hidas.
Function WuaVersion 'get current WUA version
Dim oAgentInfo, ProductVersion
On Error Resume Next
Err.Clear
Set oAgentInfo = CreateObject("Microsoft.Update.AgentInfo")
If ErrNum = 0 Then
WuaVersion = oAgentInfo.GetInfo("ProductVersionString")
Else
Wscript.Echo "Error getting WUA version."
WuaVersion = 0 'calling code can interpret 0 as an error.
End If
On Error Goto 0
End Function
if WuaVersion <> "0" then
Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
'add the Microsoft Update Service, GUID
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
end if
'ServerSelection values
ssDefault = 0
ssManagedServer = 1
ssWindowsUpdate = 2
ssOthers = 3
'InStr values
intSearchStartChar = 1
dim strTitle
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
updateSearcher.ServerSelection = ssWindowsUpdate
Set searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB971033", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2970228", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3004394", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3035583", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2965295", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2965270", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3038314", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2990214", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB2952664", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3021917", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
For I = 0 To searchResult.Updates.Count-1
Set update = searchResult.Updates.Item(I)
strTitle = update.Title
if InStr(intSearchStartChar, strTitle, "KB3068708", vbTextCompare) <> "0" then
update.IsHidden = True
end if
Next
WScript.Quit
mutta onko tähän jotain parempaa tapaa, tuo toimii mutta hidas.
Vastaukset
Vanhimmat
Ei vielä vastauksia
Aloittaja odottaa vastauksia. Kerro oma näkemyksesi ensimmäisenä.