Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\LocalHost\root\cimv2")
ms.Options.EnablePrivileges = True
' Verwende diesen Eigenschaften wenn es Probleme mit den Rechten gibt
'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 As System.Management.ManagementObject In queryCollection1
Dim ss As String() = {"2", "0"} ' Reboot
'Dim ss As String() = {"2", "2"} ' Logoff
'Dim ss As String() = {"0", "0"} ' Shutdown
mo.InvokeMethod("Win32Shutdown", ss)
Next
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?
Use this properties when there are problems with the privileges.
I think he means
Use this rows with the properties set as shown when there are problems with
the privileges
Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\LocalHost\root\cimv2")
Dim mo As System.Management.ManagementObject
ms.Options.EnablePrivileges = True
' Verwende diesen Eigenschaften wenn es Probleme mit den Rechten gibt
'ms.Options.Password = ""
'ms.Options.Username = ""
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.