function fred_report_info() { var info={report_cat : "SYSTEM", report_name : "Shutdown time", report_author : "Gillen Daniel", report_desc : "Dump last known shutdown time", fred_api : 2, hive : "SYSTEM" }; return info; } function IsValid(val) { if(typeof val !== 'undefined') return true; else return false; } function print_table_row(cell01,cell02) { println(" ",cell01,"",cell02,""); } function fred_report_html() { var val; // println(""); // println(" Last known shutdown time"); // println(" "); println("

Last known shutdown time

"); // Get current controlset var cur_controlset=GetRegistryKeyValue("\\Select","Current"); if(IsValid(cur_controlset)) { cur_controlset=RegistryKeyValueToString(cur_controlset.value,cur_controlset.type); // Current holds a DWORD value, thus we get a string like 0x00000000, but // control sets are referenced only with the last 3 digits. cur_controlset="ControlSet"+String(cur_controlset).substr(7,3); println("

"); println(" "); print_table_row("Active control set:",cur_controlset); // Shutdown time val=GetRegistryKeyValue(cur_controlset+"\\Control\\Windows","ShutdownTime"); print_table_row("Shutdown time:",(IsValid(val)) ? RegistryKeyValueToVariant(val.value,"filetime") : "Unknown"); println("
"); println("
"); println("

"); } else { println("

"); println(" Unable to determine current control set!
"); println(" Are you sure you are running this report against the correct registry hive?"); println("

"); } // println(""); }