Mickey,
There is a free class here to help you reboot the system.
http://www.mentalis.org/soft/class.qpx?id=7
Ken
----------------
"Mickey Blue" <> wrote in message
news:Xns93AF7E5DCD921MBlue@206.127.4.10...
> Hello All
>
> I'm attempting to use WMI to reboot a remote server from an ASP.NET page,
> however I'm clearly missing some key piece of knowledge. Can anybody
> please tell me what I'm doing wrong?
>
> Thanks in advance.
>
> Here's the relevant code:
>
> -------
>
> Private Sub btnBoot_Click(ByVal sender As System.Object, _
> ByVal e As System.EventArgs) Handles btnBoot.Click
> 'Get name of computer to reboot
> '(List on the Web page named lstMemberList contains the names)
> Dim strComputer As String = lstMemberList.SelectedItem.Text
> 'WMI objects
> Dim objManScope As System.Management.ManagementScope
> Dim objQuery As System.Management.ObjectQuery
> Dim objSearcher As ManagementObjectSearcher
> Dim colQueryCollection As ManagementObjectCollection
> Dim outParams As ManagementBaseObject
> Dim colInstances As Collection
> Dim objInstance
> Dim strWQLQuery As String
> Dim intResult As Integer
> 'Build WQL string
> strWQLQuery = "SELECT * FROM Win32_OperatingSystem " & _
> "WHERE Primary = ""True"""
> 'Connect to WMI on remote computer
> objManScope = New System.Management.ManagementScope("\\" & _
> strComputer & "\root\cimv2")
> objQuery = New System.Management.ObjectQuery(strWQLQuery)
> objSearcher = New ManagementObjectSearcher(objManScope, objQuery)
> colQueryCollection = objSearcher.Get
> 'Reboot remote computer
> For Each objInstance In colQueryCollection
> 'intResult = objInstance.Win32Shutdown(6) '6 = ForcedReboot
> outParams = objInstance.InvokeMethod("Reboot", "", "")
> Next
> End Sub
>
> -------