Hi there,
I've got a serious problem with getting a remote shutdown functionality
working with VB.NET. I am using WMI to query the target PC and invoke the
Win32Shutdown method like this:
Dim aoInParams() As Object = {8}
For Each mngObj As ManagementObject In mngColl
mngObj.Scope.Options.EnablePrivileges = True
mngObj.InvokeMethod("Win32Shutdown", aoInParams)
Next
with mngColl being the ManagementObjectCollection, retrieved earlier.
However, I am experiencing the following behaviours:
- On a target computer with a logged in user, the computer shuts down
without any problems
- On a locked target computer or with nobody logged in, the computer shuts
down until it says "Windows is shutting down". Then, it simply hangs.
In both cases, the InvokeMethod tends to hang.
I also tried to call Win32Shutdown with "12", meaning a forced shutdown, so
that even locked computers can be powered off. But I got the same effects.
Is there any possibility, that the problem resides on the target computer,
i.e. some BIOS option, ACPI setting, driver problem, or something?
I am desperate. Does anyone have a failure proof example of how to powering
off a remote windows XP client with VB.NET?
Best regards and thank you for reading this,
Christian.