Tom
Fri Mar 14 11:55:33 CDT 2008
On Mar 14, 10:30 am, "requ...@gmail.com" <requ...@gmail.com> wrote:
> On Mar 14, 8:53 am, "requ...@gmail.com" <requ...@gmail.com> wrote:
>
>
>
> > On Mar 14, 8:46 am, "Richard Mueller [MVP]" <rlmueller-
>
> > nos...@ameritech.nospam.net> wrote:
> > > <requ...@gmail.com> wrote in message
>
> > >news:0ca7c656-331f-47d0-8bed-db672d0bae1d@d62g2000hsf.googlegroups.com...
>
> > > >I have the following script running (snippet from full script) on a
> > > > Windows XP box with no errors. When I move the script to a Windows
> > > > 2000 box (production) I receive an error 80041017 on line with For,
> > > > character 1. All I've found online is that some of the winmgmt objects
> > > > are named differently in Win2K but I cant seem to find mine as a
> > > > problem. Does anyone see my problem?
>
> > > > sSomefolder = filepath
> > > > 'sPathSpec = Replace(Mid(Dir, 3) & "\", "\", "\\")
> > > > sComputer = "." ' local machine
> > > > 'Queries the sSomefolder to find any files like the name in ivrpins.
> > > > 'This is necessary since the last characters before the extension are
> > > > different
> > > > Set qWMISrv = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
> > > > Set aFiles = qWMISrv.ExecQuery("Select * from CIM_Datafile Where "_
> > > > & "Drive = 'C:' AND Path = '" & Dir1 & "' AND FileName Like '" _
> > > > & stamp_file & sqldate & "%'", , 48)
>
> > > > For Each File In aFiles
>
> > > > msgbox file.FileName
>
> > > The error means the query was invalid. Notice that Dir1, stamp_file, and
> > > sqldate have no values, and sSomefilder and filepath are not used. Also, the
> > > path (value of Dir1) should be similar to "\\Scripts\\MyFolder\\". Also, the
> > > FileName property does not include the extension.
>
> > > --
> > > Richard Mueller
> > > Microsoft MVP Scripting and ADSI
> > > Hilltop Lab -
http://www.rlmueller.net
> > > --- Hide quoted text -
>
> > > - Show quoted text -
>
> > This is only a piece of my code, all values are filled in and work
> > properly on a Win XP Pro machine. It's when I move this to a 2000
> > Server that the script breaks.- Hide quoted text -
>
> > - Show quoted text -
>
> Here's a new example that's a little more complete:
>
> strComputer = "."
> Set objSWbemServices = _
> GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
>
> Dir1 = "\\TransferTemp\\"
> stamp_file = "ABC_FILES"
> Set colServices = _
> objSWbemServices.ExecQuery("Select * from CIM_Datafile Where "_
> & "Drive = 'C:' AND Path = '" & Dir1 & "' AND FileName Like '" _
> & stamp_file & "%'", , 48)
>
> For Each objService In colServices
> msgbox objService
> Next
>
> The directory C:\TransferTemp has 3 files named:
>
> ABC_FILES_20080306.TXT
> ABC_FILES_20080310.TXT
> ABC_FILES_20080312.TXT
>
> I want the script to pick these up and put them into an array so I can
> parse them out, but when I take this code out and put it into a
> seperate file, I receive an error on line 12 0x80041017 is the error
> code. Again this works on my Win XP machine and the directory
> structure/files are identicle.
>
> When I put the query into a msgbox to see what's output I receive:
>
> Select * from CIM_Datafile Where Drive = 'C:' AND Path = '\
> \TransferTemp\\' AND FileName Like 'ABC_FILES%'
I just remembered that the LIKE phase is not supported in Win 2K
queries.
I don't know of a workaround.
Tom Lavedas
===========