Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista Tutorial - Powergadget : get-content of directory

Reply
 
Old 01-07-2008   #1 (permalink)
IT Staff
Guest


 
 

Powergadget : get-content of directory

I have a sub-folder that the application generates tens to hundreds of files
for hours.

Can powergadget create a *online* gadget the *count* the number of files, at
the same time, set max level . Once reach max level, it will send an email
to the user ?




My System SpecsSystem Spec
Old 01-07-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 
 

Re: Powergadget : get-content of directory

IT Staff wrote:
Quote:

> I have a sub-folder that the application generates tens to hundreds of files
> for hours.
>
> Can powergadget create a *online* gadget the *count* the number of files, at
> the same time, set max level . Once reach max level, it will send an email
> to the user ?
>
>
>
I'm not sure I'm exactly following you.

You can use a .ps1 script, and PowerGadgets' -refresh flag to have
PowerGadgets rerun the .ps1 script. That .ps1 script can pass along the
value to out-chart to draw the graph, *and* also have the logic to send
out an email when a value is reached.

Sound like what you want?

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-07-2008   #3 (permalink)
IT Staff
Guest


 
 

Re: Powergadget : get-content of directory

yes, and i tried the following :

1. i've already created a vertical gauge called "folder.pgt"

2. ps (with powergadget) > out-gauge -template
older.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh 0:0:2

I delete some files in my d:\fac\queue, but the gadget did not refresh

Why ?





"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:e4FyDTZUIHA.4092@xxxxxx
Quote:

> IT Staff wrote:
Quote:

>> I have a sub-folder that the application generates tens to hundreds of
>> files for hours.
>>
>> Can powergadget create a *online* gadget the *count* the number of files,
>> at the same time, set max level . Once reach max level, it will send an
>> email to the user ?
>>
>>
>>
>
> I'm not sure I'm exactly following you.
>
> You can use a .ps1 script, and PowerGadgets' -refresh flag to have
> PowerGadgets rerun the .ps1 script. That .ps1 script can pass along the
> value to out-chart to draw the graph, *and* also have the logic to send
> out an email when a value is reached.
>
> Sound like what you want?
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com

My System SpecsSystem Spec
Old 01-07-2008   #4 (permalink)
Marco Shaw [MVP]
Guest


 
 

Re: Powergadget : get-content of directory

IT Staff wrote:
Quote:

> yes, and i tried the following :
>
> 1. i've already created a vertical gauge called "folder.pgt"
>
> 2. ps (with powergadget) > out-gauge -template
> older.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh 0:0:2
>
> I delete some files in my d:\fac\queue, but the gadget did not refresh
>
> Why ?
That's not how refresh works. PowerGadgets will not recaculate the
count at the 20s refresh like you have the command written out above.

Post the code for folder.pgt, and tells us exactly what you're looking for.

Marco
My System SpecsSystem Spec
Old 01-07-2008   #5 (permalink)
IT Staff
Guest


 
 

Re: Powergadget : get-content of directory

Manage to get it work ...called it folder.ps1

(get-childitem z:\facsys\queue).count | out-gauge folder.pgt -refresh 0:0:1

1. my folder z:\facsys\queue currently contains greater 13000 files and will
generate more. When i 1st run folder.ps1, it takes some time to *take in*
data ...is there a *faster* command to substitute the get-childitem command
?

2. How can i put a text label machine name *into* my gauge ?

3. How can i make the chart display a *exact* number of files on the screen
via tooltip ? Currently the gauge shows an estimate value





"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:OL$2kfaUIHA.5516@xxxxxx
Quote:

> IT Staff wrote:
Quote:

>> yes, and i tried the following :
>>
>> 1. i've already created a vertical gauge called "folder.pgt"
>>
>> 2. ps (with powergadget) > out-gauge -template
>> lder.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh
>> 0:0:2
>>
>> I delete some files in my d:\fac\queue, but the gadget did not refresh
>>
>> Why ?
>
> That's not how refresh works. PowerGadgets will not recaculate the count
> at the 20s refresh like you have the command written out above.
>
> Post the code for folder.pgt, and tells us exactly what you're looking
> for.
>
> Marco

My System SpecsSystem Spec
Old 01-08-2008   #6 (permalink)
IT Staff
Guest


 
 

Re: Powergadget : get-content of directory

another questions

1. get-childitem z:\facsys\queue).count initial count = 14000 files
2. After x seconds refresh = 14010 files
3. But i check using windows explorer, the exact file count is about 14020

Why is there *slow* refresh exact count ?



"IT Staff" <jkklim@xxxxxx> wrote in message
news:OwjmQlaUIHA.4440@xxxxxx
Quote:

> Manage to get it work ...called it folder.ps1
>
> (get-childitem z:\facsys\queue).count | out-gauge folder.pgt -refresh
> 0:0:1
>
> 1. my folder z:\facsys\queue currently contains greater 13000 files and
> will generate more. When i 1st run folder.ps1, it takes some time to *take
> in* data ...is there a *faster* command to substitute the get-childitem
> command ?
>
> 2. How can i put a text label machine name *into* my gauge ?
>
> 3. How can i make the chart display a *exact* number of files on the
> screen via tooltip ? Currently the gauge shows an estimate value
>
>
>
>
>
> "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
> news:OL$2kfaUIHA.5516@xxxxxx
Quote:

>> IT Staff wrote:
Quote:

>>> yes, and i tried the following :
>>>
>>> 1. i've already created a vertical gauge called "folder.pgt"
>>>
>>> 2. ps (with powergadget) > out-gauge -template
>>> der.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh
>>> 0:0:2
>>>
>>> I delete some files in my d:\fac\queue, but the gadget did not refresh
>>>
>>> Why ?
>>
>> That's not how refresh works. PowerGadgets will not recaculate the count
>> at the 20s refresh like you have the command written out above.
>>
>> Post the code for folder.pgt, and tells us exactly what you're looking
>> for.
>>
>> Marco
>
>

My System SpecsSystem Spec
Old 01-08-2008   #7 (permalink)
Kirk Munro [MVP]
Guest


 
 

Re: Powergadget : get-content of directory

Are there hidden files? Use Get-ChildItem -Force to retrieve all child
items (including hidden ones).

--
Kirk Munro [MVP]
Poshoholic
http://poshoholic.com


"IT Staff" <jkklim@xxxxxx> wrote in message
news:eIUmbMdUIHA.536@xxxxxx
Quote:

> another questions
>
> 1. get-childitem z:\facsys\queue).count initial count = 14000 files
> 2. After x seconds refresh = 14010 files
> 3. But i check using windows explorer, the exact file count is about 14020
>
> Why is there *slow* refresh exact count ?
>
>
>
> "IT Staff" <jkklim@xxxxxx> wrote in message
> news:OwjmQlaUIHA.4440@xxxxxx
Quote:

>> Manage to get it work ...called it folder.ps1
>>
>> (get-childitem z:\facsys\queue).count | out-gauge folder.pgt -refresh
>> 0:0:1
>>
>> 1. my folder z:\facsys\queue currently contains greater 13000 files and
>> will generate more. When i 1st run folder.ps1, it takes some time to
>> *take in* data ...is there a *faster* command to substitute the
>> get-childitem command ?
>>
>> 2. How can i put a text label machine name *into* my gauge ?
>>
>> 3. How can i make the chart display a *exact* number of files on the
>> screen via tooltip ? Currently the gauge shows an estimate value
>>
>>
>>
>>
>>
>> "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
>> news:OL$2kfaUIHA.5516@xxxxxx
Quote:

>>> IT Staff wrote:
>>>> yes, and i tried the following :
>>>>
>>>> 1. i've already created a vertical gauge called "folder.pgt"
>>>>
>>>> 2. ps (with powergadget) > out-gauge -template
>>>> er.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh
>>>> 0:0:2
>>>>
>>>> I delete some files in my d:\fac\queue, but the gadget did not refresh
>>>>
>>>> Why ?
>>>
>>> That's not how refresh works. PowerGadgets will not recaculate the
>>> count at the 20s refresh like you have the command written out above.
>>>
>>> Post the code for folder.pgt, and tells us exactly what you're looking
>>> for.
>>>
>>> Marco
>>
>>
>
>

My System SpecsSystem Spec
Old 01-08-2008   #8 (permalink)
IT Staff
Guest


 
 

Re: Powergadget : get-content of directory

no hidden files.

instead i use : {[system.io.directory]::getfiles("d:\fac\queue")} which is
much faster than using get-childitem or dir.



"Kirk Munro [MVP]" <sorry@xxxxxx> wrote in message
news:e9i5B7jUIHA.1184@xxxxxx
Quote:

> Are there hidden files? Use Get-ChildItem -Force to retrieve all child
> items (including hidden ones).
>
> --
> Kirk Munro [MVP]
> Poshoholic
> http://poshoholic.com
>
>
> "IT Staff" <jkklim@xxxxxx> wrote in message
> news:eIUmbMdUIHA.536@xxxxxx
Quote:

>> another questions
>>
>> 1. get-childitem z:\facsys\queue).count initial count = 14000 files
>> 2. After x seconds refresh = 14010 files
>> 3. But i check using windows explorer, the exact file count is about
>> 14020
>>
>> Why is there *slow* refresh exact count ?
>>
>>
>>
>> "IT Staff" <jkklim@xxxxxx> wrote in message
>> news:OwjmQlaUIHA.4440@xxxxxx
Quote:

>>> Manage to get it work ...called it folder.ps1
>>>
>>> (get-childitem z:\facsys\queue).count | out-gauge folder.pgt -refresh
>>> 0:0:1
>>>
>>> 1. my folder z:\facsys\queue currently contains greater 13000 files and
>>> will generate more. When i 1st run folder.ps1, it takes some time to
>>> *take in* data ...is there a *faster* command to substitute the
>>> get-childitem command ?
>>>
>>> 2. How can i put a text label machine name *into* my gauge ?
>>>
>>> 3. How can i make the chart display a *exact* number of files on the
>>> screen via tooltip ? Currently the gauge shows an estimate value
>>>
>>>
>>>
>>>
>>>
>>> "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
>>> news:OL$2kfaUIHA.5516@xxxxxx
>>>> IT Staff wrote:
>>>>> yes, and i tried the following :
>>>>>
>>>>> 1. i've already created a vertical gauge called "folder.pgt"
>>>>>
>>>>> 2. ps (with powergadget) > out-gauge -template
>>>>> r.pgt -MainIndicator_Value (dir d:\fac\queue\*.*).count -refresh
>>>>> 0:0:2
>>>>>
>>>>> I delete some files in my d:\fac\queue, but the gadget did not refresh
>>>>>
>>>>> Why ?
>>>>
>>>> That's not how refresh works. PowerGadgets will not recaculate the
>>>> count at the 20s refresh like you have the command written out above.
>>>>
>>>> Post the code for folder.pgt, and tells us exactly what you're looking
>>>> for.
>>>>
>>>> Marco
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can not get content of some directory PowerShell
How Can I Display the Content of the Directory Stack? PowerShell
Powergadget version PowerShell
Powergadget - Out-Line PowerShell
Weirdness with get-content | replace | set-content - file content is deleted!! PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46