Page 1 of 1 1
Topic Options
#102495 - 2003-07-01 03:18 PM Remote poweroff
Olan Wilson Offline
Lurker

Registered: 2003-07-01
Posts: 3
Anyone know of a way to reomtely poweroff a machine? Assume Windows 2000 SP2 for the client O/S. I know of various ways to log off and shutdown a remote machine, but I can't find anything on actually powering off a remote machine.

Thanks.

Top
#102496 - 2003-07-01 03:21 PM Re: Remote poweroff
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if the OS/BIOS doesn't support soft poweroff, then you can't.

meaning, if you can sit at the PC and click, Start, shutdown, shutdown and it powers off, then you can do it remotely

if not, you can't
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#102497 - 2003-07-01 03:41 PM Re: Remote poweroff
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Give this a go...

code:
Break On

$sComputer = "remote_pc"

$lLogoff = 0
$lShutdown = 1
$lReboot = 2
$lForce = 4
$lPoweroff = 8

$colOperatingSystems = GetObject("winmgmts:{(Shutdown)}!\\" + $sComputer +
"\root\cimv2").ExecQuery("Select * from Win32_OperatingSystem")
@ERROR ?

For Each $objOperatingSystem in $colOperatingSystems
$nul=$objOperatingSystem.Win32Shutdown($lPoweroff)
@ERROR ?
Next



[ 01. July 2003, 15:42: Message edited by: Chris S. ]

Top
#102498 - 2003-07-01 03:43 PM Re: Remote poweroff
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Only computers with an ATX-compliant motherboard and an ATX-compliant power supply offer the ability to poweroff a computer. Additionally, only Windows 2000/XP/2003 support this natively, though there is a registry hack available which will enable this feature under Windows NT 4.0.

A remote shutdown command under Windows 2000 will normally power off the computer, too. You will also need to have the correct permissions to the remote computer in order to issue the remote shutdown command.

See also the UDF Forum under fnWMIShutdown() - LogOff/reboot/shutdown a user/computer locally or remotely and RemoteLRS() - Remotely logoff/shutdown/reboot a computer

[ 01. July 2003, 15:45: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#102499 - 2003-07-01 03:57 PM Re: Remote poweroff
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Additionally, here are some more -

Shutdown/Restart - options

BTW, have you had a chance to look at the - KiXtart FAQ & How to's Forum?

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#102500 - 2003-07-01 04:51 PM Re: Remote poweroff
Olan Wilson Offline
Lurker

Registered: 2003-07-01
Posts: 3
Yes, I can sit at the machine and click Start -> Shut Down.. -> Shut down and the PCs will poweroff, but I have not been able to power off remotely. Using shutdown.exe from the resource kit, the rundll.exe trick, and even the shutdown KiX function all result in a shutdown with the "It is now safe to turn off your computer" screen. Nothing I have found yet will actually power off the workstations.

Thanks for the help, I will try the suggestion from Chris S.

Top
#102501 - 2003-07-01 06:01 PM Re: Remote poweroff
Olan Wilson Offline
Lurker

Registered: 2003-07-01
Posts: 3
Chris S.'s suggestion worked great. Thanks!!
Top
#102502 - 2003-07-01 06:07 PM Re: Remote poweroff
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
fnWMIShutdown() - LogOff/reboot/shutdown a user/computer locally or remotely has been updated with the 8/12 poweroff options.
_________________________
There are two types of vessels, submarines and targets.

Top
#102503 - 2003-07-18 08:43 PM Re: Remote poweroff
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
for some reason, this will shutdown remote PCs, but when I try to LOGOFF remote machines, the local machine logs off

code:
 Function RemoteLRS($computer,$x)
dim $oWBEM, $oShutdown, $oOpSys
; 0 - LogOff 4 - Force LogOff
; 2 - Reboot 6 - Force Reboot
; 8 - Shutdown 12 - Force Shutdown
$oWBEM = GetObject('winmgmts:{(Shutdown)}!\\$computer\root\CIMV2')
$oShutdown = $oWBEM.ExecQuery('Select * from Win32_OperatingSystem where Primary=true')
if $oShutdown.count
For Each $oOpSys in $oShutdown
$RemoteLRS=$oOpSys.Win32Shutdown($x)
Next
endif
$oShutdown=0 $oWBEM=0
endfunction

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.062 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org