![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | WMI Question Good evening! I have a question: I know enough about WMI to know that adding the ", 48" to WMI scripts is a good thing! However, I am having an issue when I add this to the following script: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Option Explicit Dim objWMIService, colServices, objFSO, objFile, objService Dim strComputer strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where State = 'Paused' and StartMode = 'Auto'", 48) Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile("c:\resume-paused.txt") For Each objService in colServices objService.ResumeService() objFile.WriteLine objService.displayName Next ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ It gives me the following: c:\scripts>c:\scripts\scriptname.vbs (16,1) (null): 0x80041018. If I remove the , 48 at the end of the Query then everything runs without issue. If I am not mistaken, the 0x80041018 = "query syntax is not valid". What is wrong with my query syntax? BTW - I also get it if I leave off the "Option Explicit" and DIM blah blah! at the top.... Thanks, Cary |
My System Specs![]() |
| | #2 (permalink) |
| | Re: WMI Question Cary Shultz wrote: Quote: > I have a question: I know enough about WMI to know that adding the ", 48" > to WMI scripts is a good thing! However, I am having an issue when I add > this to the following script: > > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > Option Explicit > > Dim objWMIService, colServices, objFSO, objFile, objService > Dim strComputer > > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Set colServices = objWMIService.ExecQuery _ > ("Select * from Win32_Service Where State = 'Paused' and StartMode = > 'Auto'", 48) > > Set objFSO = CreateObject("Scripting.FileSystemObject") > Set objFile = objFSO.CreateTextFile("c:\resume-paused.txt") > > For Each objService in colServices > objService.ResumeService() > objFile.WriteLine objService.displayName > Next > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > It gives me the following: c:\scripts>c:\scripts\scriptname.vbs (16,1) > (null): 0x80041018. > > If I remove the , 48 at the end of the Query then everything runs without > issue. If I am not mistaken, the 0x80041018 = "query syntax is not > valid". What is wrong with my query syntax? BTW - I also get it if I > leave off the "Option Explicit" and DIM blah blah! at the top.... > > Thanks, blank: Set colServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where State = 'Paused' and StartMode = 'Auto'", ,48) -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: WMI Question Auch, Du Schande!!!!!!! I missed a comma! I spent two hours trying to figure that out. I guess that I should not admit to that in public, huh? I should have known that one! Thank you! "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:O5tHK6ytJHA.4452@xxxxxx Quote: > Cary Shultz wrote: > Quote: >> I have a question: I know enough about WMI to know that adding the ", >> 48" to WMI scripts is a good thing! However, I am having an issue when I >> add this to the following script: >> >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> Option Explicit >> >> Dim objWMIService, colServices, objFSO, objFile, objService >> Dim strComputer >> >> strComputer = "." >> Set objWMIService = GetObject("winmgmts:" _ >> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") >> >> Set colServices = objWMIService.ExecQuery _ >> ("Select * from Win32_Service Where State = 'Paused' and StartMode = >> 'Auto'", 48) >> >> Set objFSO = CreateObject("Scripting.FileSystemObject") >> Set objFile = objFSO.CreateTextFile("c:\resume-paused.txt") >> >> For Each objService in colServices >> objService.ResumeService() >> objFile.WriteLine objService.displayName >> Next >> >> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> >> It gives me the following: c:\scripts>c:\scripts\scriptname.vbs (16,1) >> (null): 0x80041018. >> >> If I remove the , 48 at the end of the Query then everything runs without >> issue. If I am not mistaken, the 0x80041018 = "query syntax is not >> valid". What is wrong with my query syntax? BTW - I also get it if I >> leave off the "Option Explicit" and DIM blah blah! at the top.... >> >> Thanks, > The flag, 48, should be the third parameter, with the second parameter > blank: > > Set colServices = objWMIService.ExecQuery _ > ("Select * from Win32_Service Where State = 'Paused' and StartMode = > 'Auto'", ,48) > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: WMI Question "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:O5tHK6ytJHA.4452@xxxxxx Quote: > Cary Shultz wrote: > Quote: >> I have a question: I know enough about WMI to know that adding the ", >> 48" to WMI scripts is a good thing! However, I am having an issue when I >> add this to the following script: >> >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> Option Explicit >> >> Dim objWMIService, colServices, objFSO, objFile, objService >> Dim strComputer >> >> strComputer = "." >> Set objWMIService = GetObject("winmgmts:" _ >> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") >> >> Set colServices = objWMIService.ExecQuery _ >> ("Select * from Win32_Service Where State = 'Paused' and StartMode = >> 'Auto'", 48) >> >> Set objFSO = CreateObject("Scripting.FileSystemObject") >> Set objFile = objFSO.CreateTextFile("c:\resume-paused.txt") >> >> For Each objService in colServices >> objService.ResumeService() >> objFile.WriteLine objService.displayName >> Next >> >> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> >> It gives me the following: c:\scripts>c:\scripts\scriptname.vbs (16,1) >> (null): 0x80041018. >> >> If I remove the , 48 at the end of the Query then everything runs without >> issue. If I am not mistaken, the 0x80041018 = "query syntax is not >> valid". What is wrong with my query syntax? BTW - I also get it if I >> leave off the "Option Explicit" and DIM blah blah! at the top.... >> >> Thanks, > The flag, 48, should be the third parameter, with the second parameter > blank: > > Set colServices = objWMIService.ExecQuery _ > ("Select * from Win32_Service Where State = 'Paused' and StartMode = > 'Auto'", ,48) > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > http://msdn.microsoft.com/en-us/library/aa393866.aspx -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #5 (permalink) |
| | Re: WMI Question Yes, I remember that one. Torgier showed me a few years ago. I simply - in my haste - overlooked the missing comma (position). Thank you for the link, though. I have saved it as a favorite! I will not make this mistake again! Cary "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:evpbiAztJHA.5664@xxxxxx Quote: > > "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in > message news:O5tHK6ytJHA.4452@xxxxxx Quote: >> Cary Shultz wrote: >> Quote: >>> I have a question: I know enough about WMI to know that adding the ", >>> 48" to WMI scripts is a good thing! However, I am having an issue when >>> I add this to the following script: >>> >>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> Option Explicit >>> >>> Dim objWMIService, colServices, objFSO, objFile, objService >>> Dim strComputer >>> >>> strComputer = "." >>> Set objWMIService = GetObject("winmgmts:" _ >>> & "{impersonationLevel=impersonate}!\\" & strComputer & >>> "\root\cimv2") >>> >>> Set colServices = objWMIService.ExecQuery _ >>> ("Select * from Win32_Service Where State = 'Paused' and StartMode = >>> 'Auto'", 48) >>> >>> Set objFSO = CreateObject("Scripting.FileSystemObject") >>> Set objFile = objFSO.CreateTextFile("c:\resume-paused.txt") >>> >>> For Each objService in colServices >>> objService.ResumeService() >>> objFile.WriteLine objService.displayName >>> Next >>> >>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >>> >>> It gives me the following: c:\scripts>c:\scripts\scriptname.vbs (16,1) >>> (null): 0x80041018. >>> >>> If I remove the , 48 at the end of the Query then everything runs >>> without issue. If I am not mistaken, the 0x80041018 = "query syntax is >>> not valid". What is wrong with my query syntax? BTW - I also get it if >>> I leave off the "Option Explicit" and DIM blah blah! at the top.... >>> >>> Thanks, >> The flag, 48, should be the third parameter, with the second parameter >> blank: >> >> Set colServices = objWMIService.ExecQuery _ >> ("Select * from Win32_Service Where State = 'Paused' and StartMode = >> 'Auto'", ,48) >> >> -- >> Richard Mueller >> MVP Directory Services >> Hilltop Lab - http://www.rlmueller.net >> -- >> > See this link: > > http://msdn.microsoft.com/en-us/library/aa393866.aspx > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| IE8 Question | Vista General | |||
| escape character question - hopefully an easy question | PowerShell | |||
| vista genral question and ultimate question | Vista General | |||
| Dual boot system question and family deal discount question | Vista General | |||
| RC1 Cd Key Question | Vista installation & setup | |||