25 January 2016

Fix for A connection to the deployment could not be made

This error is very annoying when running through a build. I Googled and found this fix to it by Kyle Beckman. The trick is delaying the LiteTouch.wsf from trying to execute the next task before network connectivity is available. Kyle's fix is putting a simple timed delay in the LiteTouch.wsf. I decided to enhance this fix by using PowerShell. Instead of having to guess at how long to wait, why not use the Test-Connection commandlet and delay the script until connectivity is available? That is what I did and it has worked perfectly. The first thing was to create the oShell object. Next use oShell.run to execute the powershell command. I used the -command so that it did not have to execute and external script. You will also need to customize the part that says <IP or DNS Address>. I use the fully qualified domain name of our DNS server to test for network connectivity. You can see the code I added in the field below:


           Set oShell = CreateObject("Wscript.shell")  
           oShell.run("powershell.exe -executionpolicy bypass -command Do {$Connectivity = Test-Connection -Destination <IP or DNS Address> -Count 1 -Quiet} while ($Connectivity -eq $false)")  
   

This is what the code looks like as a whole within the LiteTouch.wsf file:

      Function ValidateDeployRootWithRecovery  
   
           Dim sARF  
           Dim sNetworkErrorHint  
           DIm iRetVal  
           Dim sLTISuspend  
   
           'Wait for network connectivity  
           Set oShell = CreateObject("Wscript.shell")  
           oShell.run("powershell.exe -executionpolicy bypass -command Do {$Connectivity = Test-Connection -Destination <IP or DNS Address> -Count 1 -Quiet} while ($Connectivity -eq $false)")  
           If oUtility.ValidateConnectionEx(oEnvironment.Item("DeployRoot"), True) = Success then  
                ValidateDeployRootWithRecovery = SUCCESS  
                exit function  
           End if  
   


NOTE: This will require at least PowerShell version 3. Also, I would highly recommend making a copy of LiteTouch.wsf before making any modifications to it. 

Related Posts:

  • Initiate Hardware Inventory Here is the scripting code in both powershell and VBScript to initiate a hardware inventory in both SMS and SCCM. The backend calls are the same in both SMS and SCCM, so both scripts will work in either app. Powershell … Read More
  • Custom Naming Distribution Points If you are using standard machines as distribution points in your remote offices, the naming might be an issue for you, as it was for us. There was nothing in the naming that distinguished them to allow us to know … Read More
  • Multiple Naming Schemas in the customsettings.ini file It is nothing new that you can setup MDT or SCCM to automatically create the computer name via the customsettings.ini file. This is a sample I used from a forum on the net: [ByLaptopType] Subsection=Laptop-%IsLaptop% … Read More
  • Deploying enormous packages across a WAN As many of you might know, deploying huge packages through SCCM can be a challenge. The first question you might ask is, define enormous. IMO, anything over the default 5GB client cache size is enormous. Working in the archi… Read More
  • SCCM: Package not updating on the distribution points You have made changes to your installation package and it does not update on the distribution points, even after validating and redistributing. I ran into this issue and could not figure out why it was doing this. I ended up… Read More

0 comments:

Post a Comment