2

I'm writing a script that loops through a list of machines and returns various things about that machine. One of the things I return is a Dell Service Tag pulled from WMI. I then use the service tag and create a New-WebServiceProxyobject to return various warranty information from Dell. The script will run fine at first but after a while when I make request to Dell it start giving the following error:

New-WebServiceProxy : The request failed with HTTP status 401: Authorization Required.
At C:\..\..\..\ServerInfo.ps1:68 char:15
+             $service = New-WebServiceProxy -Uri http://xserv.dell.com/services/assetservi ...
+                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (http://xserv.de...rvice.asmx?WSDL:Uri) [New-WebServiceProxy], WebExcept
   ion
    + FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.NewWebServiceProxy

What I can not seem to figure out it why this error is happening. I've done some research and I'v found that people who normally encounter this error are not login into the web service they are making calls to. This web service doesn't require authentication of any sort! Why does it work fine for so long and then error out? I've tried limiting the amounts of calls I make as if I'm send to many request, but even waiting two minutes between each call it still eventually errors out.

Here is the code block that cause this error:


    $STAG = "XXXXXXX" #ServiceTag
    $WebProxy = New-WebServiceProxy -Uri http://xserv.dell.com/services/assetservice.asmx?WSDL 
    $GUID = [guid]::NewGuid() 
    $Return = $WebProxy.GetAssetInformation($GUID,'CheckWarranty',$STAG) 
    $Return[0].Entitlements[0].ServiceLevelDescription.ToString()

So what I'm asking is why does this error out, after so many requests There is no authentication required, so why is telling me it needs authentication?

apples
  • 137
  • 2
  • 6
  • 16
  • Your corporate proxy requires authentication – Frode F. Mar 08 '16 at 21:04
  • @FrodeF. I would guess that @ apples is querying from his corporate network, in which case the proxy shouldn't be needed. @ apples: to check go to Control Panel, Internet Options, Connections, LAN settings, and then see if "Use a proxy server for your LAN..." is checked. If it is then you would be using a proxy server. In that case it's still odd that some requests work and subsequent requests fail. If I had this problem I'd use Wireshark to look at a requests that succeed and ones that fail. – Χpẘ Mar 09 '16 at 21:28
  • The reason I said it was because `new-Webserviceproxy` isn't compatible with proxy-settings. It's a known problem. – Frode F. Mar 09 '16 at 22:27
  • We have a web filter on the corporate network everything go trough it,passing with it a authentication via the logged in user. The error would show up because after a while my connection to the web filter would time out, and the traffic that I was sending from powershell had no authentication. Adding the xserv.dell.com domain to a no auth list in the web filter fixed it. – apples Mar 10 '16 at 15:51

0 Answers0