anonymous
07-16-2002, 03:51 PM
[Originally posted by jrwolfe@paonline.com]
I'm running Windows XP Pro on a main PC and a second remote computer via a
LAN connection.
Remote Desktop Connection works great but there doesn't seem to be anyway to
shut down my remote system. I'm somewhat familiar with Wakeup On LAN for
turning on a remote system but I don't know if it will also shut down the
system. Appreciate any help or suggestions.
Someone sent me this VBA script which they indicated would do this job but I have been unable to get it to work. I am not very knowledgable when it comes to VBA.
====================================
'Input: sServer a machine name˙ ˙ sServer˙ =""˙ 'a machine name
' sUserName in the form of a user name or Domain\Username
' sPassword password of the user
sServer= "Athlon_remote"
sUserName ="abc"˙ 'in the form of a user name or Domain\Username
sPassword˙ ="sam12" 'password of the user
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
oLocator.Security_.Privileges.AddAsString "SeRemoteShutdownPrivilege"
Set oService = oLocator.ConnectServer(sServer, "root\cimv2", _
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ sUserName, sPassword)
Set oOSSet = oService.InstancesOf("Win32_OperatingSystem")
For Each obj in oOSSet
˙ Set oOS = obj :˙ Exit For
Next
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
'
'oOS.win32shutdown EWX_blablah
' Power off:
oOS.win32shutdown EWX_POWEROFF
Jim
I'm running Windows XP Pro on a main PC and a second remote computer via a
LAN connection.
Remote Desktop Connection works great but there doesn't seem to be anyway to
shut down my remote system. I'm somewhat familiar with Wakeup On LAN for
turning on a remote system but I don't know if it will also shut down the
system. Appreciate any help or suggestions.
Someone sent me this VBA script which they indicated would do this job but I have been unable to get it to work. I am not very knowledgable when it comes to VBA.
====================================
'Input: sServer a machine name˙ ˙ sServer˙ =""˙ 'a machine name
' sUserName in the form of a user name or Domain\Username
' sPassword password of the user
sServer= "Athlon_remote"
sUserName ="abc"˙ 'in the form of a user name or Domain\Username
sPassword˙ ="sam12" 'password of the user
Set oLocator = CreateObject("WbemScripting.SWbemLocator")
oLocator.Security_.Privileges.AddAsString "SeRemoteShutdownPrivilege"
Set oService = oLocator.ConnectServer(sServer, "root\cimv2", _
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ sUserName, sPassword)
Set oOSSet = oService.InstancesOf("Win32_OperatingSystem")
For Each obj in oOSSet
˙ Set oOS = obj :˙ Exit For
Next
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2
Const EWX_FORCE = 4
Const EWX_POWEROFF = 8
'
'oOS.win32shutdown EWX_blablah
' Power off:
oOS.win32shutdown EWX_POWEROFF
Jim