Jump to content
Software FX Community

Function not recognized


Recommended Posts

I'm trying to get the refresh option to work but not having any luck. Here's a short example of what I have and what I'm trying to do.  In my profile script I have this function defined:

Function Get-LogStamp {(get-date).toString('yyyMMddhhmmss')}

In Powershell it works fine.  I see it listed in Function: and generally it appears to be available. But when I do something like this:

get-logstamp | out-gauge -type digital -refresh 0:0:10

 When the refresh period comes around I get an error:

The term 'get-logstamp' is not recognized as a cmdlet, function, operable program or script file. Verify the term and try again.

I know it's a valid function name. Why the error? 

Jeffery HicksSAPIEN Technologies - Scripting, Simplified. www.SAPIEN.comVBScript & Windows PowerShell Training - www.ScriptingTraining.com/classes.aspWindows PowerShell? - www.SAPIENPress.com/powershell.aspblog: http://blog.SAPIEN.comblog: http://jdhitsolutions.blogspot.com 

EFF-Perception_Chart.zip

Link to comment
Share on other sites

In order to refresh independently from the PowerShell session that created the gadget (so that you can close it and keep the gadget alive) we are hosting powershell and it seems we are not loading the functions in your profile. We will check if we can fix this bug in our next service pack.

In the meantime you will have to create a script that returns the required data, e.g.

Contents of logstamp.ps1


(get-date).toString('yyyMMddhhmmss')

To make this workaround independent of your folder location you may also have to save this ps1 in a directory in your path. We apologize for the inconvenience.

 JuanC

Link to comment
Share on other sites

I should have realized that. Using a script works just fine. Loading the profile would be helpful, or at least have the option. With PowerShell Community Extensions and other snapins becoming more popular, it makes sense that people will want to leverage those with PowerGadgets.

 

Jeffery HicksSAPIEN Technologies - Scripting, Simplified. www.SAPIEN.comVBScript & Windows PowerShell Training - www.ScriptingTraining.com/classes.aspWindows PowerShell? - www.SAPIENPress.com/powershell.aspblog: http://blog.SAPIEN.comblog: http://jdhitsolutions.blogspot.com 

Link to comment
Share on other sites

Thought you might like to know what I was working on:

http://blog.sapien.com/current/2007/3/21/powershell-temperature.html

 

Jeffery HicksSAPIEN Technologies - Scripting, Simplified. www.SAPIEN.comVBScript & Windows PowerShell Training - www.ScriptingTraining.com/classes.aspWindows PowerShell? - www.SAPIENPress.com/powershell.aspblog: http://blog.SAPIEN.comblog: http://jdhitsolutions.blogspot.com 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...