WMI to reboot remote machine

前端 未结 4 1231
长发绾君心
长发绾君心 2020-11-30 09:18

I found this code on an old thread to shutdown the local machine:

using System.Management;

void Shutdown()
{
    ManagementBaseObject mboShutdown = null;
           


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 09:31

    this will work like sharm

    gwmi win32_operatingsystem -ComputerName xxxxxxxxxxxx | Invoke-WmiMethod -Name reboot
    

提交回复
热议问题