/// <summary> /// Get the system uptime /// </summary> /// <returns>System uptime</returns> public async Task <Uptime> GetSystemUpTime() { var queryString = "SELECT LastBootUpTime FROM Win32_OperatingSystem"; var wmiReader = new WmiReader(); var results = await wmiReader.ExecuteScalar(queryString); return(new Uptime() { UpTime = Uptime.ParseUpTime(results["LastBootUpTime"].ToString()) }); }
/// <summary> /// Provide the operating system information /// </summary> /// <returns>Operating system information </returns> public async Task <OSInfo> GetOSInfo() { var queryString = "SELECT caption, version, CSName FROM Win32_OperatingSystem"; var wmiReader = new WmiReader(); var results = await wmiReader.ExecuteScalar(queryString); return(new OSInfo() { MachineName = results["CSName"].ToString(), OSName = results["caption"].ToString(), Version = results["version"].ToString() }); }