G
Guest
I put some sample of code that was given here in the newsgroup
Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\LocalHost\root\cimv2"
Dim mo As System.Management.ManagementObjec
ms.Options.EnablePrivileges = Tru
' Verwende diesen Eigenschaften wenn es Probleme mit den Rechten gib
'ms.Options.Password = "
'ms.Options.Username = "
Dim oq As System.Management.ObjectQuery = New System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem"
Dim query1 As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(ms, oq
Dim queryCollection1 As System.Management.ManagementObjectCollection = query1.Get(
For Each mo In queryCollection
'Dim ss As String() = {"2", "0"} ' Reboo
'Dim ss As String() = {"2", "2"} ' Logof
Dim ss As String() = {"2", "0"} ' Shutdow
mo.InvokeMethod("Win32Shutdown", ss
Nex
but gives me this message...."PREVILEGE NOT HELD"...Why is that
....Or there is other way to do the reboot
THANKS
Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\LocalHost\root\cimv2"
Dim mo As System.Management.ManagementObjec
ms.Options.EnablePrivileges = Tru
' Verwende diesen Eigenschaften wenn es Probleme mit den Rechten gib
'ms.Options.Password = "
'ms.Options.Username = "
Dim oq As System.Management.ObjectQuery = New System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem"
Dim query1 As System.Management.ManagementObjectSearcher = New System.Management.ManagementObjectSearcher(ms, oq
Dim queryCollection1 As System.Management.ManagementObjectCollection = query1.Get(
For Each mo In queryCollection
'Dim ss As String() = {"2", "0"} ' Reboo
'Dim ss As String() = {"2", "2"} ' Logof
Dim ss As String() = {"2", "0"} ' Shutdow
mo.InvokeMethod("Win32Shutdown", ss
Nex
but gives me this message...."PREVILEGE NOT HELD"...Why is that
....Or there is other way to do the reboot
THANKS