none
Using a script to automate UNC definition updates for FEP 2010

Answers

All replies

  • Are you sure that these URLs and .exe files are not blocked by proxy or firewall ??
    Bechir Gharbi | http://myitforum.com/cs2/blogs/bgharbi/
    Wednesday, March 30, 2011 5:52 PM
  • yes, if i browse to these links i get automatically the save as dialogue box.
    Wednesday, March 30, 2011 8:18 PM
  • 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.


    Bechir Gharbi | http://myitforum.com/cs2/blogs/bgharbi/

    Thursday, March 31, 2011 8:26 PM
  • 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

    Wednesday, April 20, 2011 5:32 PM
  • Thank, it is working also with me
    Wednesday, April 20, 2011 6:43 PM
  • 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

    Wednesday, June 11, 2014 2:57 PM