Jump to content
Software FX Community

Dastari

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Dastari

  1. Thanks for the help, Those solutions did work however I got the powershell console flashfor a quick second every time the refresh happened. In the mean time I had aplay around with the sidebar packaging tool and just pasted my code into thatas the data source. This actually worked phenomenally well and gave me a sidebar gadget to boot. *stares dreamily at his new sidebar gadget*
  2. Hey guys, I'v just got the trial of PowerGadgets to see what I can do with it and have my first question. I am trying to monitor hard drive space on a remote server that is firewalled except for port 80. What I am doing is running a batch file on the server every minute that dumps the result of a "dir" into a text file on the web folder so I can read it remotly. As an example I wrote this quick function to give you an idea: function GetBytesFree(){ $Url = "http://www.somewebsite.com/dir.txt" $WebClient = New-Object System.Net.WebClient $Random = New-Object system.random $DirResult = $WebClient.DownloadString($Url+"?t="+$Random.nextdouble()) $BytesFree = $DirResult | find "bytes free" $BytesFree = $BytesFree.split(" ")[17] return [double]$BytesFree} PS C:\> GetBytesFree55153283072 Running this from the powershell console returns a double with the bytes free. It is correct and works fine. Now if i do a: PS C:\> GetBytesFree | out-gauge -type digital -floating I get a nice digital display with the number in it, this works fine. But what I want to be able to do is update this every minute. However when I try to do a: PS C:\> GetBytesFree | out-gauge -type digital -floating -refresh 0:1:0 I get the output the first time, but when 1 minute passes I get the following error from the gauge: Failed to connect to Data "The term 'GetBytesFree' is not recognised as a cmdlet, function, operable program, or script file. Verify the term and try again.' I realise that this is probalby not a PowerGadgets problem, but can anyone suggest a solution? Is it possible to put the function somewhere so it is exposed to the PowerGadget? Edit: After hunting around a bit more on the forums I found a post that mentioned when the -refresh is triggered a new instance of the Gadget with it's own runspace is created. I will have a play around and see what I can work out. Thanks in advance.
×
×
  • Create New...