ConnectionOptions co = new ConnectionOptions(); System.Management.ManagementScope ms = new ManagementScope(sServer + "\\root\\CIMV2"); System.Management.ObjectQuery oq = new ObjectQuery("select * from win32_Processor"); ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms, oq); ManagementObjectCollection moc = query1.Get(); foreach (ManagementObject mo in moc) { string[] s = { "" }; mo.InvokeMethod("Reboot", s); Console.WriteLine(mo.ToString()); }
gc c:\Temp\ServerList.txt |%{Restart-computer –computername $_ –force}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)