'函数名 :ResetComputer '函数功能:使远程的机算机重新启动 '传入参数:sUserName:登录用户名,sPassWord:登录密码,sURL:要重启的机算机IP '返回值 :Ture:成功,False:失败 '制作人 :zzz '制作日期:2007-01-08 '说 明 :此函数需要有System.Management的引用 PrivateFunction ResetComputer()Function ResetComputer(ByVal sUserName AsString, ByVal sPassWord AsString, ByVal sURL AsString) AsBoolean Try '连接到远程计算机 Dim co As ConnectionOptions =New ConnectionOptions co.Username = sUserName co.Password = sPassWord Dim ms As System.Management.ManagementScope =New System.Management.ManagementScope("//"& sURL &"/root/cimv2", co) '使用连接进行查询 Dim oq As System.Management.ObjectQuery =New System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem") Dim query1 As ManagementObjectSearcher =New ManagementObjectSearcher(ms, oq) Dim queryCollection1 As ManagementObjectCollection = query1.Get() '对查询的结果进行重启动 Dim mo As ManagementObject ForEach mo In queryCollection1 Dim ss() AsString= {""} mo.InvokeMethod("Reboot", ss) 'Console.WriteLine(mo.ToString()) Next ResetComputer =True Catch ex As Exception MsgBox(ex.Message) ResetComputer =False EndTry End Function