Using a script to automate UNC definition updates for FEP 2010

Hi all,

I tested the script mentioned in this article http://blogs.technet.com/b/clientsecurity/archive/2010/09/16/using-a-script-to-automate-unc-definition-updates.aspx with no success. I am getting the following error:

Line: 11

Char: 5

Error: The operation timed out

 

Code: 80072EE2

Source: WinHttp.WinHttpRequest

the script content is as follows:

strMSEx86URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x86"
strMSEx86Location = "D:\defs\Updates\x86\mpam-fe.exe" 
strNISX86URL = "http://go.microsoft.com/fwlink/?LinkId=197095
strNISX86Location = "D:\defs\Updates\x86\nis_full.exe" 
strMSEx64URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x64
strMSEx64Location = "D:\defs\Updates\x64\mpam-fe.exe" 
strNISX64URL = "http://go.microsoft.com/fwlink/?LinkId=197094
strNISX64Location = "D:\defs\Updates\x64\nis_full.exe"
Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
    objWINHTTP.open "GET", strMSEx86URL, false  
    objWINHTTP.send
If objWINHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
   objADOStream.Open
  objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objWINHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the Start
Set objFSO = Createobject("Scripting.FileSystemObject") 
    'check if file exists if so delete 
    If objFSO.Fileexists(strMSEx86Location) Then objFSO.DeleteFile strMSEx86Location
objADOStream.SaveToFile strMSEx86Location 
objADOStream.Close
end if

Anybody can help?

March 30th, 2011 10:42am

Are you sure that these URLs and .exe files are not blocked by proxy or firewall ??
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2011 5:52pm

yes, if i browse to these links i get automatically the save as dialogue box.
March 30th, 2011 8:18pm

More info about the error "The operation timed out 80072EE2" http://blogs.msdn.com/b/jpsanders/archive/2008/06/25/troubleshooting-code-that-uses-the-http-protocol.aspx

Hope it helps.

Free Windows Admin Tool Kit Click here and download it now
March 31st, 2011 8:26pm

This is the script that I use and it works:

strMSEx86URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x86
strMSEx86Location = "C:\defs\Updates\x86\mpam-fe.exe" 
strNISX86URL = "http://download.microsoft.com/download/DefinitionUpdates/x86/nis_full.exe
strNISX86Location = "C:\defs\Updates\x86\nis_full.exe" 
strMSEx64URL = "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x64
strMSEx64Location = "C:\defs\Updates\x64\mpam-fe.exe" 
strNISX64URL = "http://download.microsoft.com/download/DefinitionUpdates/amd64/nis_full.exe
strNISX64Location = "C:\defs\Updates\x64\nis_full.exe"
 
Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
    objWINHTTP.open "GET", strMSEx86URL, false  
    objWINHTTP.send

If objWINHTTP.Status = 200 Then 
Set objADOStream = CreateObject("ADODB.Stream") 
    objADOStream.Open 
    objADOStream.Type = 1 'adTypeBinary 
    objADOStream.Write objWINHTTP.ResponseBody 
    objADOStream.Position = 0 'Set the stream position to

Set objFSO = Createobject("Scripting.FileSystemObject") 
    'check if file exists if so delete 
    If objFSO.Fileexists(strMSEx86Location) Then objFSO.DeleteFile(strMSEx86Location)
objADOStream.SaveToFile strMSEx86Location 
objADOStream.Close
End IF

Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
    objWINHTTP.open "GET", strNISx86URL, false  
    objWINHTTP.send

If objWINHTTP.Status = 200 Then 
Set objADOStream = CreateObject("ADODB.Stream") 
    objADOStream.Open 
    objADOStream.Type = 1 'adTypeBinary 
    objADOStream.Write objWINHTTP.ResponseBody 
    objADOStream.Position = 0 'Set the stream position to
Set objFSO = Createobject("Scripting.FileSystemObject") 
    'check if file exists if so delete 
    If objFSO.Fileexists(strNISx86Location) Then objFSO.DeleteFile (strNISx86Location)
objADOStream.SaveToFile strNISx86Location 
objADOStream.Close
END IF

Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
    objWINHTTP.open "GET", strNISx64URL, false  
    objWINHTTP.send

If objWINHTTP.Status = 200 Then 
Set objADOStream = CreateObject("ADODB.Stream") 
    objADOStream.Open 
    objADOStream.Type = 1 'adTypeBinary 
    objADOStream.Write objWINHTTP.ResponseBody 
    objADOStream.Position = 0 'Set the stream position to
Set objFSO = Createobject("Scripting.FileSystemObject") 
    'check if file exists if so delete 
    If objFSO.Fileexists(strNISx64Location) Then objFSO.DeleteFile (strNISx64Location)
objADOStream.SaveToFile strNISx64Location 
objADOStream.Close
END IF

Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")  
    objWINHTTP.open "GET", strMSEx64URL, false  
    objWINHTTP.send

If objWINHTTP.Status = 200 Then 
Set objADOStream = CreateObject("ADODB.Stream") 
    objADOStream.Open 
    objADOStream.Type = 1 'adTypeBinary 
    objADOStream.Write objWINHTTP.ResponseBody 
    objADOStream.Position = 0 'Set the stream position to

Set objFSO = Createobject("Scripting.FileSystemObject") 
    'check if file exists if so delete 
    If objFSO.Fileexists(strMSEx64Location) Then objFSO.DeleteFile(strMSEx64Location)
objADOStream.SaveToFile strMSEx64Location 
objADOStream.Close
END IF

April 20th, 2011 5:32pm

Thank, it is working also with me
Free Windows Admin Tool Kit Click here and download it now
April 20th, 2011 6:43pm

Thanks for the original post of the full script.

I figured I'd post an updated version that was a little cleaned up, simpler and with less code.

Option Explicit

Dim strUpdate
Dim objWINHTTP, objADOStream, objFSO
Dim dicFEPUpdates

Set objWINHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")   
Set objADOStream = CreateObject("ADODB.Stream")  
Set objFSO = Createobject("Scripting.FileSystemObject")  
Set dicFEPUpdates = CreateObject("Scripting.Dictionary")

dicFEPUpdates.Add "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x86","E:\Packages$\OSD\Packages\FEP2010-Updates\x86\mpam-fe.exe"  
dicFEPUpdates.Add "http://download.microsoft.com/download/DefinitionUpdates/x86/nis_full.exe","E:\Packages$\OSD\Packages\FEP2010-Updates\x86\nis_full.exe"  
dicFEPUpdates.Add "http://go.microsoft.com/fwlink/?LinkID=121721&clcid=0x409&arch=x64","E:\Packages$\OSD\Packages\FEP2010-Updates\x64\mpam-fe.exe"  
dicFEPUpdates.Add "http://download.microsoft.com/download/DefinitionUpdates/amd64/nis_full.exe","E:\Packages$\OSD\Packages\FEP2010-Updates\x64\nis_full.exe" 

For Each strUpdate In dicFEPUpdates
	objWINHTTP.open "GET", strUpdate, false   
	objWINHTTP.send

	If objWINHTTP.Status = 200 Then  
		objADOStream.Open  
		objADOStream.Type = 1 'adTypeBinary  
		objADOStream.Write objWINHTTP.ResponseBody  
		objADOStream.Position = 0 'Set the stream position to
		'check if file exists if so delete
		If NOT objFSO.FolderExists(objFSO.GetParentFolderName(objFSO.GetParentFolderName(dicFEPUpdates(strUpdate)))) Then objFSO.CreateFolder(objFSO.GetParentFolderName(objFSO.GetParentFolderName(dicFEPUpdates(strUpdate))))
		If NOT objFSO.FolderExists(objFSO.GetParentFolderName(dicFEPUpdates(strUpdate))) Then objFSO.CreateFolder(objFSO.GetParentFolderName(dicFEPUpdates(strUpdate)))
		If objFSO.Fileexists(dicFEPUpdates(strUpdate)) Then objFSO.DeleteFile(dicFEPUpdates(strUpdate)) 
		objADOStream.SaveToFile dicFEPUpdates(strUpdate)
		objADOStream.Close
	End IF
Next

June 11th, 2014 2:57pm

I try it and I get 

Path not found error !!! error:800a004c

any Ideas? 

Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2014 1:37pm

this script works great! awesome job... I was just thinking about something like this the other day...  I'm sure I could have created it too (in 10 years...), but I'm glad you did!

Thanks!

November 25th, 2014 9:49pm

did you change the default path in the script?

try from a different machine, try it off the network without mgmt stuff between you and the internet?

I think there is a way to turn on logging in the script more than what is there possibly...

Free Windows Admin Tool Kit Click here and download it now
November 25th, 2014 9:51pm

This worked for me!
June 8th, 2015 7:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics