Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Turn Off Computer

Reply
 
Old 01-27-2009   #1 (permalink)
Gary''s Student


 
 

Turn Off Computer

What command would I issue from VBScript to turn off my computer?
--
Gary''s Student - gsnu2007xx

My System SpecsSystem Spec
Old 01-27-2009   #2 (permalink)
mycow


 
 

Re: Turn Off Computer


"Gary''s Student" <GarysStudent@xxxxxx> wrote in message
news:4CD7F646-2B92-4834-857A-C71937CDF7E9@xxxxxx
Quote:

> What command would I issue from VBScript to turn off my computer?
> --
> Gary''s Student - gsnu2007xx
I've used this command successfully.. Look up the Win32Shutdown Function
for all Possible parameters.. (BTW: You must have Shutdown Privileges to run
this script..)

'----Code Start----
Set oWmi=GetObject("winmgmts:{(shutdown)}")
For Each oPC In oWmi.ExecQuery("Select * from Win32_OperatingSystem")
oPC.Win32Shutdown 6
Next
'----Code End----


My System SpecsSystem Spec
Old 01-27-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: Turn Off Computer


"Gary''s Student" <GarysStudent@xxxxxx> wrote in message
news:4CD7F646-2B92-4834-857A-C71937CDF7E9@xxxxxx
Quote:

> What command would I issue from VBScript to turn off my computer?
> --
> Gary''s Student - gsnu2007xx
This example from the Script Center shows how to shutdown:

http://www.microsoft.com/technet/scr.../dmstvb08.mspx

If the computer supports it, you can power off. See this link:

http://www.microsoft.com/technet/scr..._cpm_jleo.mspx

Navigate in the TOC to the left in the page to code examples:

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 01-27-2009   #4 (permalink)
Gary''s Student


 
 

Re: Turn Off Computer

Thank you
--
Gary''s Student - gsnu200829


"Richard Mueller [MVP]" wrote:
Quote:

>
> "Gary''s Student" <GarysStudent@xxxxxx> wrote in message
> news:4CD7F646-2B92-4834-857A-C71937CDF7E9@xxxxxx
Quote:

> > What command would I issue from VBScript to turn off my computer?
> > --
> > Gary''s Student - gsnu2007xx
>
> This example from the Script Center shows how to shutdown:
>
> http://www.microsoft.com/technet/scr.../dmstvb08.mspx
>
> If the computer supports it, you can power off. See this link:
>
> http://www.microsoft.com/technet/scr..._cpm_jleo.mspx
>
> Navigate in the TOC to the left in the page to code examples:
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Old 01-27-2009   #5 (permalink)
mr_unreliable


 
 

Re: Turn Off Computer

apparently richard and mycow have more recent versions
of wmi than I have, jw

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How can I turn on my computer? Vista hardware & devices
Cannot turn my computer on Vista General
Turn your Computer into a Super TV PowerShell
cant turn off computer Vista hardware & devices
Help! Computer will not turn on... Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46