Jump to content
Software FX Community

SAPIENScripter

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SAPIENScripter

  • Rank
    Member
  1. 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
  2. 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
  3. 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. Veri
  4. I updated my script to create objects. Now when run in PowerShell it gives pretty good information. #Get-Uptime.ps1 [int]$secup=(Get-WmiObject -class Win32_PerfFormattedData_PerfOS_System).SystemUptime[int]$days=([system.math]::Truncate($secup/86400))[int]$Hours=($secup/3600)%24[int]$Mins=($secup/60)%60[int]$secs=$secup%60#create new object to hold values$obj = New-Object System.ObjectAdd-Member -inputobject $obj -membertype NoteProperty -Name Days -value $daysAdd-Member -inputobject $obj -membertype NoteProperty -Name Hours -value $HoursAdd-Member -inputobject $obj -membertype NotePropert
  5. I was going down that same path. I couldn't get past the script block for the inner gauge. I knew I was close. Thanks. 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
  6. Man, that's a lot of typing [], but it gets the job done.
  7. Boy was this harder than I thought it was going to be. If I understood, you wanted something to display the uptime in a format like DD:HH:MM:SS. Well I made my first gadget to display that information. I've attached the pgf file. 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
  8. I have to start using PowerGadgets more. This is pretty slick. This is what works for me: (ps).count | out-gauge -type digital -float -style 10 -refresh 0:0:2 -size 64,64 There's no reason to use Get-WMIObject for the local system. I just wish there was a way to have the gauge float but still be able to add text somewhere so I can remember what the gauge is showing.
  9. Even better, how about a PowerGadget cmdlet that can check for new updates! []
  10. The main point is that you have to supply a password at some point, ideally interactively. If the original post was intended to arrive at an "unattended" solution, then creating secure string and storing it in a file is probably the only way to go. But even this, from a security perspective, is dangerous. In essence you've still hard coded a password which is a security no-no. Granted it is encrypted and I might not know what account it goes with, but if I do, then I can use that credential in my own PowerShell session to do just about anything I want. I know it sounds cliche, but just bec
  11. Ok, maybe I figured this out. I think I was able to manually create a PSCredential object. I think you need to pass it the parameters when you create it. $pwd=read-host -assecurestring $cred=new-object -typename System.Management.Automation.PSCredential -argumentlist "domain\username",$pwd When you pipe $cred to Get-Member you should see this: TypeName: System.Management.Automation.PSCredentialName MemberType Definition---- ---------- ----------Equals Method System.Boolean Equals(Object obj)GetHashCode Method System.Int32 GetHashCode()GetNetworkCredential Method Sys
  12. I take it you don't want to be prompted to enter a password or that you're trying to do something in an unattended fashion. Theoretically what you are trying to do is manually create a PSCredential object. However, (probably for security), I think the only way you can do that is with the Get-Credential cmdlet. If you try using New-Object and specifying PSCredential or even System.Management.Automation.PSCredential as the type, you'll get an error about constructor not found which leads me to believe the PowerShell team didn't want you to be able to do this, at least easily.
  13. As much as I dislike the idea, I think you have to give the user the option to be insecure. There are shops where security sometimes takes a back seat to getting something done. The best you can do is provide an option and highlight the potential consequences. This really should only be an issue for a scheduled PowerShell task, which isn't such a widespread activity right now.
  14. I think the challenge is password security. You certainly never want to hard code a password into a script. The Get-Credential cmdlet appears to be only for Windows authentication. Which would probably work fine if you needed to authenticate using domain credentials. However, it my scenario where you might have to authenticate to a Yahoo SMTP server that probably won't work. You may not have many options other than letting the user enter username and password strings in clear-text, with the understanding that they are not secure. It might be a revealing exercise to look at how a mail client
  15. The output format isn't really the issue, although I'm surprised nobody wants a jpg format. My comment was that since the cmdlet supports multiple file formats, I'd like to be able to specify the format when piping to send-mail.
×
×
  • Create New...