using system;
using system. management;
namespace wmi3
{< br> ///
/// summary description for class1.
///
class class1
{< br> static void main (string [] ARGs)
{< br> console. writeline ("Computer details retrieved using Windows Management Instrumentation (Wmi)"); console. writeline ("mailto: Written % 2002/01/02% 20by % 20 John % 20o 'Donnell % 20-% 20csharpconsulting@hotmail.com");
console. writeline ("========================================== ====< BR >=======================================" );
// connect to a remote computer
connectionoptions CO = new connectionoptions (); Co. username = "John" Co. password = "John" system. management. management scope MS = new system. management. managementscope ("\\\\ 192.168.1.2 \\ Root \ cimv2", CO);
// query remote computers
system. management. objectquery OQ = new system. management. objectquery ("select * From win32_operatingsystem");
New managementobjectsearcher (MS, OQ); managementobjectcollection querycollection1 = query1.get (); foreach (managementobject Mo in querycollection1) {string [] Ss = {""}; mo. invokemethod ("reboot", SS); console. writeline (MO. tostring () ;}}}