Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: List all the files of specific extention on remote Cluster Node

HTVi
TV Discussion Newsgroups

List all the files of specific extention on remote Cluster Node
AKDN 5/10/2007 2:57:02 PM
Hi,

I have problem to run vbscript to list all the files of specific extention
on remote Cluster Node. I have about 20 cluser servers around the world I
want to find all the MP3 files on my servers. I am able to get result on some
servers but not on all. I get no error but my code list no file but I see
many file on the server.

I am useing this code

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'mp3'")

If colFiles.Count = 0 Then
Wscript.Quit
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("C:\Scripts\mp3.txt")

For Each objFile in colFiles
objTextFile.Write(objFile.Drive & objFile.Path & ",")
objTextFile.Write(objFile.FileName & "." & objFile.Extension & ",")
objTextFile.Write(objFile.FileSize & vbCrLf)
Next

objTextFile.Close


If some one have a vb.net code to search files on remote server (may be
cluster) then please share with me.

Thanks for any help.



Re: List all the files of specific extention on remote Cluster Node
"D.R." <a[ at ]b.c.d> 5/11/2007 6:19:15 PM
Hi AKDN,

Try adding these options to the end of your ExecQuery:
,"WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

...so that you have:
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'mp3'", _
"WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)


....and you'll also need two constants:
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20


N.B. You won't be able to use the ".count" property. You'll have to do your
own count incrementer.


Search the web for a description of why the above might work for you.

Regards,
Dave.



"AKDN" <AKDN[ at ]discussions.microsoft.com> wrote in message
news:8EE9C434-675F-4A68-B8AB-40FA0A592622[ at ]microsoft.com...
[Quoted Text]
> Hi,
>
> I have problem to run vbscript to list all the files of specific extention
> on remote Cluster Node. I have about 20 cluser servers around the world I
> want to find all the MP3 files on my servers. I am able to get result on
> some
> servers but not on all. I get no error but my code list no file but I see
> many file on the server.
>
> I am useing this code
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
>
> Set colFiles = objWMIService.ExecQuery _
> ("Select * from CIM_DataFile Where Extension = 'mp3'")
>
> If colFiles.Count = 0 Then
> Wscript.Quit
> End If
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objTextFile = objFSO.CreateTextFile("C:\Scripts\mp3.txt")
>
> For Each objFile in colFiles
> objTextFile.Write(objFile.Drive & objFile.Path & ",")
> objTextFile.Write(objFile.FileName & "." & objFile.Extension & ",")
> objTextFile.Write(objFile.FileSize & vbCrLf)
> Next
>
> objTextFile.Close
>
>
> If some one have a vb.net code to search files on remote server (may be
> cluster) then please share with me.
>
> Thanks for any help.
>
>
>


Re: List all the files of specific extention on remote Cluster Nod
AKDN 5/15/2007 6:57:02 AM
Hello,

Thanks for your help. But it gave me the same results. I think the volume is
so big as it is about 3 TB and I believe that on this 3 TB I have max 500 MP3
files. Do you have any other idea ??



"D.R." wrote:

[Quoted Text]
> Hi AKDN,
>
> Try adding these options to the end of your ExecQuery:
> ,"WQL", _
> wbemFlagReturnImmediately + wbemFlagForwardOnly)
>
> ...so that you have:
> Set colFiles = objWMIService.ExecQuery _
> ("Select * from CIM_DataFile Where Extension = 'mp3'", _
> "WQL", _
> wbemFlagReturnImmediately + wbemFlagForwardOnly)
>
>
> ....and you'll also need two constants:
> Const wbemFlagReturnImmediately = &H10
> Const wbemFlagForwardOnly = &H20
>
>
> N.B. You won't be able to use the ".count" property. You'll have to do your
> own count incrementer.
>
>
> Search the web for a description of why the above might work for you.
>
> Regards,
> Dave.
>
>
>
> "AKDN" <AKDN[ at ]discussions.microsoft.com> wrote in message
> news:8EE9C434-675F-4A68-B8AB-40FA0A592622[ at ]microsoft.com...
> > Hi,
> >
> > I have problem to run vbscript to list all the files of specific extention
> > on remote Cluster Node. I have about 20 cluser servers around the world I
> > want to find all the MP3 files on my servers. I am able to get result on
> > some
> > servers but not on all. I get no error but my code list no file but I see
> > many file on the server.
> >
> > I am useing this code
> >
> > strComputer = "."
> > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> >
> > Set colFiles = objWMIService.ExecQuery _
> > ("Select * from CIM_DataFile Where Extension = 'mp3'")
> >
> > If colFiles.Count = 0 Then
> > Wscript.Quit
> > End If
> >
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > Set objTextFile = objFSO.CreateTextFile("C:\Scripts\mp3.txt")
> >
> > For Each objFile in colFiles
> > objTextFile.Write(objFile.Drive & objFile.Path & ",")
> > objTextFile.Write(objFile.FileName & "." & objFile.Extension & ",")
> > objTextFile.Write(objFile.FileSize & vbCrLf)
> > Next
> >
> > objTextFile.Close
> >
> >
> > If some one have a vb.net code to search files on remote server (may be
> > cluster) then please share with me.
> >
> > Thanks for any help.
> >
> >
> >
>
>
>
Re: List all the files of specific extention on remote Cluster Nod
"D.R." <a[ at ]b.c.d> 5/16/2007 10:24:06 PM
Hi,

When "*" is used in:
"Select * from CIM_DataFile where Extension = 'mp3'"

....it means return all properties of each file. You could reducing the
resource load of the query by only requesting the attributes/properties that
you really need, e.g.:
"Select Drive,Extension,FileName,FileSize,Path from CIM_DataFile
where Extension = 'mp3'"

....i.e. selecting only five of the many attributes available, as listed
here:
http://msdn2.microsoft.com/en-us/library/aa387236.aspx

You could reducing it even more to just FileSize and Path.

Regards,
Dave.



"AKDN" <AKDN[ at ]discussions.microsoft.com> wrote in message
news:46DFED41-4587-4934-A8CB-F2092C33F0E3[ at ]microsoft.com...
[Quoted Text]
> Hello,
>
> Thanks for your help. But it gave me the same results. I think the volume
> is
> so big as it is about 3 TB and I believe that on this 3 TB I have max 500
> MP3
> files. Do you have any other idea ??
>
>
>
> "D.R." wrote:
>
>> Hi AKDN,
>>
>> Try adding these options to the end of your ExecQuery:
>> ,"WQL", _
>> wbemFlagReturnImmediately + wbemFlagForwardOnly)
>>
>> ...so that you have:
>> Set colFiles = objWMIService.ExecQuery _
>> ("Select * from CIM_DataFile Where Extension = 'mp3'", _
>> "WQL", _
>> wbemFlagReturnImmediately + wbemFlagForwardOnly)
>>
>>
>> ....and you'll also need two constants:
>> Const wbemFlagReturnImmediately = &H10
>> Const wbemFlagForwardOnly = &H20
>>
>>
>> N.B. You won't be able to use the ".count" property. You'll have to do
>> your
>> own count incrementer.
>>
>>
>> Search the web for a description of why the above might work for you.
>>
>> Regards,
>> Dave.
>>
>>
>>
>> "AKDN" <AKDN[ at ]discussions.microsoft.com> wrote in message
>> news:8EE9C434-675F-4A68-B8AB-40FA0A592622[ at ]microsoft.com...
>> > Hi,
>> >
>> > I have problem to run vbscript to list all the files of specific
>> > extention
>> > on remote Cluster Node. I have about 20 cluser servers around the world
>> > I
>> > want to find all the MP3 files on my servers. I am able to get result
>> > on
>> > some
>> > servers but not on all. I get no error but my code list no file but I
>> > see
>> > many file on the server.
>> >
>> > I am useing this code
>> >
>> > strComputer = "."
>> > Set objWMIService = GetObject("winmgmts:\\" & strComputer &
>> > "\root\cimv2")
>> >
>> > Set colFiles = objWMIService.ExecQuery _
>> > ("Select * from CIM_DataFile Where Extension = 'mp3'")
>> >
>> > If colFiles.Count = 0 Then
>> > Wscript.Quit
>> > End If
>> >
>> > Set objFSO = CreateObject("Scripting.FileSystemObject")
>> > Set objTextFile = objFSO.CreateTextFile("C:\Scripts\mp3.txt")
>> >
>> > For Each objFile in colFiles
>> > objTextFile.Write(objFile.Drive & objFile.Path & ",")
>> > objTextFile.Write(objFile.FileName & "." & objFile.Extension & ",")
>> > objTextFile.Write(objFile.FileSize & vbCrLf)
>> > Next
>> >
>> > objTextFile.Close
>> >
>> >
>> > If some one have a vb.net code to search files on remote server (may be
>> > cluster) then please share with me.
>> >
>> > Thanks for any help.
>> >
>> >
>> >
>>
>>
>>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen