Home All Groups Group Topic Archive Search About


Author
11 Aug 2005 3:15 AM
Woon Ping
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

Author
11 Aug 2005 4:38 AM
Marty List
Show quote
"Woon Ping" <WoonP***@discussions.microsoft.com> wrote in message
news:3FF72A56-71EB-492A-A85D-930E001BCD3A@microsoft.com...
>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 _
Author
11 Aug 2005 4:58 AM
Woon Ping
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


Show quote
"Marty List" wrote:

>
> "Woon Ping" <WoonP***@discussions.microsoft.com> wrote in message
> news:3FF72A56-71EB-492A-A85D-930E001BCD3A@microsoft.com...
> >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 _
>
>
>
>
Author
11 Aug 2005 5:05 AM
Marty List
"Woon Ping" <WoonP***@discussions.microsoft.com> wrote in message
news:51D62A79-D139-46C6-97D2-66E308DE6BE9@microsoft.com...
> 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


Are you getting any error messages from the script?  While troubleshooting,
try adding this line to the top of your script:
On Error GoTo 0

Post your entire script with the strComputer set to a remote computer name.

Instead of Win32Shutdown(1) you could try Win32Shutdown(1 + 4):
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32shutdown_method_in_class_win32_operatingsystem.asp
Author
11 Aug 2005 5:19 AM
Woon Ping
The script is as follow and it do have an error message

(Error Code)
Line:2
Char:1
Error:The remote server machine does not exist or is unavailable: 'GetObject'
Code:800A01CE
Source:Microsoft VBScript runtime error

(Script with remote computer name)
strComputer = "mis003"
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+4)
Next
--
Regards,
woon Ping


Show quote
"Marty List" wrote:

>
> "Woon Ping" <WoonP***@discussions.microsoft.com> wrote in message
> news:51D62A79-D139-46C6-97D2-66E308DE6BE9@microsoft.com...
> > 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
>
>
> Are you getting any error messages from the script?  While troubleshooting,
> try adding this line to the top of your script:
> On Error GoTo 0
>
> Post your entire script with the strComputer set to a remote computer name.
>
> Instead of Win32Shutdown(1) you could try Win32Shutdown(1 + 4):
> http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32shutdown_method_in_class_win32_operatingsystem.asp
>
>
>
>
Author
11 Aug 2005 6:05 AM
Marty List
Show quote
"Woon Ping" <WoonP***@discussions.microsoft.com> wrote in message
news:1CC7F8DD-E775-4245-BA8A-8DC01ECBBC2F@microsoft.com...
> The script is as follow and it do have an error message
>
> (Error Code)
> Line:2
> Char:1
> Error:The remote server machine does not exist or is unavailable:
> 'GetObject'
> Code:800A01CE
> Source:Microsoft VBScript runtime error
>
> (Script with remote computer name)
> strComputer = "mis003"
> 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+4)
> Next
> --
> Regards,
> woon Ping


Is there a firewall between your system and the remote PC, or is a firewall
client running on the remote PC?  If so, read this:
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/connecting_through_windows_firewall.asp
Author
11 Aug 2005 6:45 AM
Woon Ping
My firewall is on that is the reason I cant remotely shut down the PC but I
only manage to shutdown some of the PC both running Windows 2000 Server but I
only manage to shutdown 1 and not the other. May I know whether Windows
Server 2000 might have other type of security that block the remote call.
Thank You.
--
Regards,
woon Ping


Show quote
"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
Author
23 Jan 2006 12:20 AM
TomKing
have you install latest SP for win? If you have that's the problem.
Read this may help you:
http://www.microsoft.com/technet/community/columns/scripts/sg1104.mspx

Show quote
"Woon Ping" wrote:

> My firewall is on that is the reason I cant remotely shut down the PC but I
> only manage to shutdown some of the PC both running Windows 2000 Server but I
> only manage to shutdown 1 and not the other. May I know whether Windows
> Server 2000 might have other type of security that block the remote call.
> Thank You.
> --
> Regards,
> woon Ping
>
>
> "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
Author
16 Oct 2007 9:51 AM
david
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 :D


Show quote
"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
Author
16 Oct 2007 10:16 AM
david
*i edit my post

Show quote
"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 :D
>
>
> "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
Author
17 Oct 2007 6:04 AM
Al Dunbar
Show quote
"david" <da***@discussions.microsoft.com> wrote in message
news:2F861449-FB9F-42C8-A124-D5214B196A30@microsoft.com...
> *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

Show quote
>> pls help... tks :D
>>
>>
>> "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

AddThis Social Bookmark Button