0

I setup a scheudled task on Windows Server 2008 to run the following command:

C:\Windows\System32\cscript.exe //b //nologo D:\WebSites\MySite\Scripts\UpdateCache.vbs

The VBScript being run makes a simple GET request:

Dim o 
Set o = CreateObject("MSXML2.XMLHTTP") 
o.open "GET", "http://.../UpdateCache", False 
o.send 

When I check the IIS logs after this runs, it always results in a 401. The user running the scheduled task has read/write/modify access to the website folder and can access it through IE. Any idea why I might be getting the 401 when running this task?

Paul
  • 125
  • 3

1 Answers1

2

The reason you receive a 401.2 is because the XMLHTTP request object doesn't supply credentials. You can do that in the open-method:

o.open "GET", "http://.../UpdateCache", False, username, password
Mathias R. Jessen
  • 24,907
  • 4
  • 62
  • 95