I am trying to get the time of the last system shutdown time of a client machine and I am using the following method:
public static DateTime GetLastSystemShutdown()
{
string sKey = @"System\CurrentControlSet\Control\Windows";
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey);
string sValueName = "ShutdownTime";
byte[] val = (byte[])key.GetValue(sValueName);
long valueAsLong = BitConverter.ToInt64(val, 0);
return DateTime.FromFileTime(valueAsLong);
}
It works fine within the debugger on my system, however, when I publish to the server where IIS is hosting, whenever the user triggers method it displays the last shutdown time of the IIS server instead of the client machine.
Is it possible to get that information from the client machine? I am using Windows Authentication.