You will likely need to call these pages as a user other than the anonymous IUSR. This is because extra privileges are required for reading the registry and/or WMI. Here is a method for obtaining the information from the registry:
<% set oShell = CreateObject("WScript.Shell") stn = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\" & _ "Control\TimeZoneInformation\StandardName" atb = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\" & _ "Control\TimeZoneInformation\ActiveTimeBias" response.write oShell.RegRead(stn) & "<br>" response.write "(currently " & oShell.RegRead(atb)/60 & _ " hours off GMT)<br>" %> |
The following WMI script should work on Windows 2000 and up -- not sure about NT 4.0. Note that you may have to parse the output, as you probably get more than you want...
<% Set Locator = CreateObject("WbemScripting.SWbemLocator") Set NameSpace = Locator.ConnectServer() WQLQuery = "SELECT caption,daylightBias FROM Win32_TimeZone" Set TZCollection = NameSpace.ExecQuery(WQLQuery, "WQL", 48) For Each Item In TZCollection response.write Item.caption & " (if daylight time, add " & _ Item.daylightBias/60 & " hours to the abs(offset).)" next %> |
Instead of calling this dynamically, you could use a scheduled VBS file to run every day, or every week, to check the current timezone and store this information in a flat file or a database (after all, how often does the time zone change?). That way you only have the 'hit' to the registry / WMI so often, and you don't have to worry about the permissions of IUSR.