Welcome to ServerForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Shutdown Script

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  ID a Unix server via a script?  
Author Message
Woon Ping

External


Since: Aug 10, 2005
Posts: 2



(Msg. 1) Posted: Wed Aug 10, 2005 8:15 pm
Post subject: Shutdown Script
Archived from groups: microsoft>public>windows>server>scripting (more info?)

I use the script that provided by microsoft technet by I receive an error
when I try to run. The script that I use is as follow, and it give me this
error message. May I know why. Thank You

(Error Code)
Line:3
Char:5
Error:Expected statement
Code:800A0400
Source:Microsoft VBScript compilation error

(Script that I use)
strComputer = "."
Set objWMIService = GetObject_
("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(1)
Next


--
Regards,
woon Ping

 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
Marty List

External


Since: Mar 25, 2005
Posts: 148



(Msg. 2) Posted: Wed Aug 10, 2005 10:38 pm
Post subject: Re: Shutdown Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Woon Ping" wrote in message

>I use the script that provided by microsoft technet by I receive an error
> when I try to run. The script that I use is as follow, and it give me this
> error message. May I know why. Thank You
>
> (Error Code)
> Line:3
> Char:5
> Error:Expected statement
> Code:800A0400
> Source:Microsoft VBScript compilation error
>
> (Script that I use)
> strComputer = "."
> Set objWMIService = GetObject_
> ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
> strComputer & "\root\cimv2")
>
> Set colOperatingSystems = objWMIService.ExecQuery _
> ("Select * from Win32_OperatingSystem")
>
> For Each objOperatingSystem in colOperatingSystems
> objOperatingSystem.Win32Shutdown(1)
> Next
>
>
> --
> Regards,
> woon Ping


Lines 2, 3, 4 are all the same line, but wrapped to the next line using the
_ underscore character. Line 2 needs a space before the underscore.

This line:
Set objWMIService = GetObject_
needs to be:
Set objWMIService = GetObject _

 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
Woon Ping

External


Since: Aug 10, 2005
Posts: 2



(Msg. 3) Posted: Wed Aug 10, 2005 10:38 pm
Post subject: Re: Shutdown Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Marty for your help, but now I encounter another problem which is I
try remotely shutdown a PC in my network but that PC doesnt seem to shutdown
at all, what I did was replace the strComputer variable to the remote PC
name. Thank You.
--
Regards,
woon Ping


"Marty List" wrote:

>
> "Woon Ping" wrote in message
>
> >I use the script that provided by microsoft technet by I receive an error
> > when I try to run. The script that I use is as follow, and it give me this
> > error message. May I know why. Thank You
> >
> > (Error Code)
> > Line:3
> > Char:5
> > Error:Expected statement
> > Code:800A0400
> > Source:Microsoft VBScript compilation error
> >
> > (Script that I use)
> > strComputer = "."
> > Set objWMIService = GetObject_
> > ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
> > strComputer & "\root\cimv2")
> >
> > Set colOperatingSystems = objWMIService.ExecQuery _
> > ("Select * from Win32_OperatingSystem")
> >
> > For Each objOperatingSystem in colOperatingSystems
> > objOperatingSystem.Win32Shutdown(1)
> > Next
> >
> >
> > --
> > Regards,
> > woon Ping
>
>
> Lines 2, 3, 4 are all the same line, but wrapped to the next line using the
> _ underscore character. Line 2 needs a space before the underscore.
>
> This line:
> Set objWMIService = GetObject_
> needs to be:
> Set objWMIService = GetObject _
>
>
>
>
 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
david

External


Since: Nov 28, 2006
Posts: 3



(Msg. 4) Posted: Tue Oct 16, 2007 2:51 am
Post subject: RE: Shutdown Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I have encounter another error.

it says:
Line: 7
Char: 18
Error: Expected '='
Code: 800A03F3
Source: Microsoft VBScript compilation error

the funny thing is line 7 char 18 is not '='

pls help... tks Very Happy


"Woon Ping" wrote:

> I use the script that provided by microsoft technet by I receive an error
> when I try to run. The script that I use is as follow, and it give me this
> error message. May I know why. Thank You
>
> (Error Code)
> Line:3
> Char:5
> Error:Expected statement
> Code:800A0400
> Source:Microsoft VBScript compilation error
>
> (Script that I use)
> strComputer = "."
> Set objWMIService = GetObject_
> ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
> strComputer & "\root\cimv2")
>
> Set colOperatingSystems = objWMIService.ExecQuery _
> ("Select * from Win32_OperatingSystem")
>
> For Each objOperatingSystem in colOperatingSystems
> objOperatingSystem.Win32Shutdown(1)
> Next
>
>
> --
> Regards,
> woon Ping
 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
david

External


Since: Nov 28, 2006
Posts: 3



(Msg. 5) Posted: Tue Oct 16, 2007 3:16 am
Post subject: RE: Shutdown Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*i edit my post

"david" wrote:

> I have encounter another error.
>
> it says:
> Line: 6 (which is 'Set colOperating Systems = objWMIService.ExecQuery _')
> Char: 18
> Error: Expected '='
> Code: 800A03F3
> Source: Microsoft VBScript compilation error
>
> the funny thing is line 7 char 18 is not '='
>
> pls help... tks Very Happy
>
>
> "Woon Ping" wrote:
>
> > I use the script that provided by microsoft technet by I receive an error
> > when I try to run. The script that I use is as follow, and it give me this
> > error message. May I know why. Thank You
> >
> > (Error Code)
> > Line:3
> > Char:5
> > Error:Expected statement
> > Code:800A0400
> > Source:Microsoft VBScript compilation error
> >
> > (Script that I use)
> > strComputer = "."
> > Set objWMIService = GetObject_
> > ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
> > strComputer & "\root\cimv2")
> >
> > Set colOperatingSystems = objWMIService.ExecQuery _
> > ("Select * from Win32_OperatingSystem")
> >
> > For Each objOperatingSystem in colOperatingSystems
> > objOperatingSystem.Win32Shutdown(1)
> > Next
> >
> >
> > --
> > Regards,
> > woon Ping
 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
Al Dunbar

External


Since: Apr 09, 2007
Posts: 7



(Msg. 6) Posted: Wed Oct 17, 2007 12:04 am
Post subject: Re: Shutdown Script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"david" wrote in message

> *i edit my post
>
> "david" wrote:
>
>> I have encounter another error.
>>
>> it says:
>> Line: 6 (which is 'Set colOperating Systems = objWMIService.ExecQuery _')
>> Char: 18
>> Error: Expected '='
>> Code: 800A03F3
>> Source: Microsoft VBScript compilation error
>>
>> the funny thing is line 7 char 18 is not '='

The error message told you it was expecting an '='. That usually means that
it is not already an equal sign.

/Al

>> pls help... tks Very Happy
>>
>>
>> "Woon Ping" wrote:
>>
>> > I use the script that provided by microsoft technet by I receive an
>> > error
>> > when I try to run. The script that I use is as follow, and it give me
>> > this
>> > error message. May I know why. Thank You
>> >
>> > (Error Code)
>> > Line:3
>> > Char:5
>> > Error:Expected statement
>> > Code:800A0400
>> > Source:Microsoft VBScript compilation error
>> >
>> > (Script that I use)
>> > strComputer = "."
>> > Set objWMIService = GetObject_
>> > ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
>> > strComputer & "\root\cimv2")
>> >
>> > Set colOperatingSystems = objWMIService.ExecQuery _
>> > ("Select * from Win32_OperatingSystem")
>> >
>> > For Each objOperatingSystem in colOperatingSystems
>> > objOperatingSystem.Win32Shutdown(1)
>> > Next
>> >
>> >
>> > --
>> > Regards,
>> > woon Ping
 >> Stay informed about: Shutdown Script 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
W2K Shutdown Script - Hello all, Would anyone happen to know or be able to point me to a w2k server shutdown script? Thx Dan

Can I run a script at Shutdown? - Hi, is there a way I can automatically run a script during system shutdown? Similar concept to having a startup script only it will be launched before the computer shuts down. thanx in advance christos

Shutdown start up script - I am wanted to create a script to shutdown my PC at 9:02pm on Monday - Thursday and 5:02pm on Friday - Sunday. Is this an easy task in NT, 2000, and XP?

WIN2000 Shutdown script - Hi, I made a batch file that reboots the PC (shutdown -r) and I want to schedule this batch to run at a specific day. My question here is if I can make a script that copies shutdown.exe and my batch file to C:\winnt\system32 and that schedules the batch....

Shutdown script with msgbox - I'm preparing a shutdown script to install one program for client and would like to prompt a message to tell user what I'm doing (e.g. "abc is installing, PC will shutdown afterward and you can leave it here") but don't need any intervention...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]