Wednesday, August 22, 2007

4314.aspx

Windows Update error 0x80072EFD and proxy scripts

Windows Update failed on my PC earlier this week with error 0x80072EFD.  It is a very generic error that just means that the Windows Update client did not receive a response from the Windows Update Web site.


Microsoft KB article #836941 explains the steps that normally resolve the error but it did not work for me. In my case it was caused the Proxy auto configuration configuration script I am using.



The PAC script works grand when browsing but Windows Update refuses to work. Temporarily disabling the PAC script and configuring a static proxy works.


The proxy script below is based on one I got from Michele. It has the following features:



  • Disables ads in Live Messenger and Live mail by sending requests for the host rad.msn.com to a proxy that does not exist :-)

  • Uses direct internet access from home

  • Supports different proxy configurations for several clients (I have changed the real IPs and hosts)
// Configure it as file://c:/scripts/proxy.pac
function FindProxyForURL(url, host)
{
// Set if (true) to show debug messages
if (false)
{
alert(url);
alert(host);
alert(myIpAddress());
}
if (host == "127.0.0.1" || host == "localhost")
{
return "DIRECT";
}
// Disable Live Messenger/Mail ads by pointing to proxy that does not exist
if (host == "rad.msn.com")
{
return "PROXY 127.0.0.1:55555";
}
// Home Network
if (isInNet(myIpAddress(), "192.168.10.0", "255.255.255.0"))
{
return "DIRECT";
}
// Client 1. Direct access to local network and to Exchange server
if (isInNet(myIpAddress(), "10.135.160.0", "255.255.252.0"))
{
if ((isInNet(host, "10.135.0.0", "255.255.0.0"))||(host == "owa.company.com"))
{
return "DIRECT";
}
else
{
return "PROXY 10.135.160.4:8080";
}
}

// Client 2
if (isInNet(myIpAddress(), "10.10.0.0", "255.0.0.0"))
{
if (isInNet(host, "10.10.0.0", "255.255.0.0"))
{
return "DIRECT";
}
else
{
return "PROXY proxy.company.com:8080";
}
}
   // N other clients here..

// Anything else goes directly
return "DIRECT";
}

A quick intro to the functions/variables used in the script:



  • The host variable tells the script which site I am accessing

  • myIpAddress() returns my ip address which changes according to my location

  • I match my ip address against a subnet using isInNet() to know if I am at home, in the office or on site at a client

  • The function returns the string “DIRECT“ if the host can be reached directly otherwise it returns “PROXY ip-or-host:port“

More info on how Windows Update works with proxies here:


No comments:

Post a Comment