Jump to content
Software FX Community

sstranger

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by sstranger

  1. Hi Marco, Yes that could do, but it would be nicer if it was just one gauge. And would this work for Vista Sidebar Gadget? Regards, Stefan Stranger http://weblog.stranger.nl
  2. Hi Marco, Are the dates dynamic? Regards, Stefan Stranger http://weblog.stranger.nl WebApplication1.zip
  3. Would it be possible to have dates in out-gauge horizontal? Like: 01-01-2007 02-01-2007 12-31-2007 Regards, Stefan Stranger http://weblog.stranger.nl
  4. Hi JuanC, I just wanted to know if it would be possible to have more lines in the out-gauge digital panel. Like: this is line one this is line two In one digital panel. Regards, Stefan
  5. Hi Marco, Pitty ;-( Thanks for your fast response. Regards, Stefan Stranger http://weblog.stranger.nl
  6. Is it possible to have multiple lines with out-gauge? Regards, Stefan Stranger http://weblog.stranger.nl
  7. Hi Marco, I also posted a question about Inkscape and creating a SVG but still waiting for a answer. Maybe you can download the eval version of Illustrator CS2? http://download.adobe.com/pub/adobe/illustrator/win/cs2/Illustrator_CS2_ue_TryOut.exe Regards, Stefan Stranger http://weblog.stranger.nl
  8. I am still looking how I can group a text object with a shape in Inkscape. But there is a Inkscape for Adobe Illustrator Users Appendix in the Inkscape User Manual. http://www.angelfire.com/mi/kevincharles/inkscape/pa-illustrator.html Still working on how and if Inkscape can be used for creating svg images to use in PowerGadgets... Regards, Stefan Stranger http://weblog.stranger.nl ChartAutoResize.zip
  9. Hi Marco, I'm at the moment trying to use Inkscape (www.inkscape.org) to create a SVG image to use within PowerGadgets. But it's not that easy to get a hang of using these illustrator tools. I'll create a howto for using Inkscape if I'm succesful ;-) Regards, Stefan Stranger http://weblog.stranger.nl
  10. Marco, I've announced it in the 'cool scripts' forum. http://community.softwarefx.com/forums/t/9105.aspx Regards, Stefan Stranger http://weblog.stranger.nl
  11. Hi there, I've created with the help of Marco Shaw and Juan an OpsMgr 2007 Alerts Sidebar Gadget. I've written a complete howto. Have fun writting PowerShell with PowerGadgets! Regards, Stefan Stranger http://weblog.stranger.nl
  12. It took a little longer than expected but I've published a blog about how to create an OpsMgr 2007 Alerts Sidebar Gadget. Kudo's to JuanC and Marco Shaw for their help. Regards, Stefan Stranger http://weblog.stranger.nl
  13. Hi Ivan, If I already created an new object in my script. ==== $record = new-object -typename system.object $record | add-member -membertype noteproperty -name count -value 0 [void]$foreach.movenext() $record | add-member -membertype noteproperty -name name -value $level $listing+=$record ===== And also create a new object for the current date. Like: ===== $datetime = get-date $obj = new-object System.object add-member -inputobject $obj -membertype NoteProperty -Name DateTime -value $datetime ===== How do I get the right result in the Chart PowerGadget? Do I need to use the -dataobject property? | out-chart -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -titles_0_Text "OpsMgr 2007 Alerts" -titles_1_Text {$_.DateTime} -refresh 0:0:5 Regards, Stefan Stranger
  14. Marco, This is what I got when I tried your suggestion. Result: PS D:\Scripts> .\PromptOpsMgrAlerts3.ps1 Please enter your Root OpsMgr Server name: 192.168.0.3 Please enter your domain\username account for accessing the Root OpsMgr Server: opsmgr2007demo\administrator Count Name ----- ---- 5 Error Debug1 Debug2 Debug3 Debug4 Debug5 Debug6 0 0 information Debug7 Method invocation failed because [system.Management.Automation.PSObject] doesn't contain a method named 'op_Addition'. At D:\Scripts\PromptOpsMgrAlerts3.ps1:45 char:15 + $listing+=$ <<<< record Debug8 Script: # Count the number of Alerts per Severity and refreshes every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name $listing=@() $listing=get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name write-host "Debug1" $states=@() write-host "Debug2" $listing|%{$states+=$_.name} write-host "Debug3" $levels=@("information","warning","error") foreach ($level in $levels){ if(!($states -contains $level)){ $record = new-object -typename system.object write-host "Debug4" $record | add-member -membertype noteproperty -name count -value 0 write-host "Debug5" [void]$foreach.movenext() write-host "Debug6" $record $record | add-member -membertype noteproperty -name name -value $level $record write-host "Debug7" $listing+=$record write-host "Debug8" }} Regards,Stefan
  15. Hi Juan, I tried to implement choice but it's more difficult than I thought [:@] # Count the number of Alerts per Severity and refreshes every minute#$getAlerts = get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Name, Count$getAlerts = get-alert | group-object severity | sort-object name | select Name, Count# For the GetColor function to work the result must always return 3 items (Error, Warning and Information)$color = @{"Error"="0"; "Warning"="0"; "Information"="0"}$n=0 foreach ($i in $getAlerts) #(Error, Information, Warning) { if ($getAlerts[$n].Name -eq 'Error') { Write-host "Error exists" $n = $n + 1 } else { Write-host "Error does not exists" } if ($getAlerts[$n].Name -eq 'Information') { Write-host "Information exists" $n = $n + 1 } else { Write-host "Information does not exists" } if ($getAlerts[$n].Name -eq 'Warning') { Write-host "Warning does exists" $n = $n + 1 } else { Write-host "Warning does not exists" } if ($n -le "3") { #Write-host "test" $n = $n + 1 } } But this does not do the job. Output. PS D:\Scripts> .\PromptOpsMgrAlerts2.ps1Please enter your Root OpsMgr Server name: 192.168.0.3 Please enter your domain\username account for accessing the Root OpsMgr Server: opsmgr2007demo\administrator Error exists Information exists Warning does exists Error does not exists Information does not exists Warning does not exists Error does not exists Information does not exists Warning does not existsPS Microsoft.EnterpriseManagement.OperationsManager.Client\OperationsManagerMonitoring::192.168.0.3> Better ideas? Regards,Stefan
  16. Juan, I tried to use your getColor function but I've trouble getting it to work. This is what I did. (I added some debugging info) PromptOpsMgrAlertsChart2.ps1: ==================== param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$account = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) if (get-pssnapin | where {$_.Name -eq "PowerGadgets"}) {} else {add-pssnapin "PowerGadgets"} function getColor { if ($args[0] -eq 'Error') { return 'Red' Write-host $args[0] } Write-host "Not Red" if ($args[0] -eq 'Warning') { return 'Yellow' } Write-host "Not Yellow" if ($args[0] -eq 'Information') { return 'Green' } return 'Black' } $items = d:\scripts\PromptOpsMgrAlerts.ps1 -serverName $serverName -account $account $clr0 = getColor $items[0].Name Write-host "clr0" $clr0 $clr1 = getColor $items[1].Name $clr2 = getColor $items[2].Name $items | out-chart -allseries_multiplecolors true -points_0_color $clr0 -points_1_color $clr1 -points_2_color $clr2 -Title "OpsMgr 2007 Alerts" -refresh 0:1:0 ========================== First I got the next error: Unable to index into an object of type System.Management.Automation.PSObject. At D:\Scripts\PromptOpsMgrAlertsChart2.ps1:31 char:25 + $clr0 = getColor $items[0 <<<< ].Name Unable to index into an object of type System.Management.Automation.PSObject. At D:\Scripts\PromptOpsMgrAlertsChart2.ps1:32 char:25 + $clr1 = getColor $items[1 <<<< ].Name Unable to index into an object of type System.Management.Automation.PSObject. At D:\Scripts\PromptOpsMgrAlertsChart2.ps1:33 char:25 + $clr2 = getColor $items[2 <<<< ].Name WARNING: -points_1_color is not a valid value for Int32. So I did a get-member. Results: PS D:\Scripts> .\PromptOpsMgrAlerts.ps1 | gm TypeName: System.Management.Automation.PSCustomObject Name MemberType Definition ---- ---------- ---------- Equals Method System.Boolean Equals(Object obj) GetHashCode Method System.Int32 GetHashCode() GetType Method System.Type GetType() ToString Method System.String ToString() Count NoteProperty System.Int32 Count=5 Name NoteProperty System.String Name=Error Results from PromptOpsMgrAlerts.ps1.: PS D:\Scripts> .\PromptOpsMgrAlerts.ps1 Please enter your Root OpsMgr Server name: 192.168.0.3 Please enter your domain\username account for accessing the Root OpsMgr Server: opsmgr2007demo\administrator Count Name ----- ---- 4 Error Regards, Stefan Stranger http://weblog.stranger.nl
  17. Juan, You are a hero! [Y]Thanks with all the help you gave! I've learned a lot thanks to all your great help. The refresh is now working. For all those interested here are the scripts: PromptOpsMgrAlertsChart.ps1: ======================== param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$account = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) if (get-pssnapin | where {$_.Name -eq "PowerGadgets"}) {} else {add-pssnapin "PowerGadgets"} d:\scripts\PromptOpsMgrAlerts.ps1 -serverName $serverName -account $account | out-chart -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -Title "OpsMgr 2007 Alerts" ========================= PromptOpsMgrAlerts.ps1: ========================= # Description: OpsMgr 2007 Sidebar Gadget for Remotely Retrieve OpsMgr Alerts # Date: 20-02-2007 # Author: Stefan Stranger # Explanation: You can use this PowerShell script for creating a PowerGadget OpsMgr 2007 Sidebar Gadget for Vista param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$account = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) # Add OpsMgr Cmdlets if (get-pssnapin | where {$_.Name -eq "Microsoft.EnterpriseManagement.OperationsManager.Client"}) {} else {add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"} set-location "OperationsManagerMonitoring::"; # Connect to Root Management Server. $obj = new-managementGroupConnection -ConnectionString:$serverName -Credential (get-credential $account); set-location $serverName; # Count the number of Alerts per Severity and refreshes every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name ================================ I'll publish an article on my weblog explaining all the steps in getting this PowerGadget running. Regards, Stefan Stranger http://weblog.stranger.nl
  18. Hi Juan, Yes it's possible that there are no alerts but that's not the case now [] Here is the output from the PromptOpsMgrAlerts.ps1 Windows PowerShell Copyright © 2006 Microsoft Corporation. All rights reserved. PS C:\Users\sstranger> d: PS D:\> cd Scripts PS D:\Scripts> .\PromptOpsMgrAlerts.ps1 -serverName 192.168.0.3 -account "opsmgr2007demo\administrato PathName : ManagementGroup : OpsMgr Demo ManagementServerName : 192.168.0.3 Drives : Count Name ----- ---- 6 Error PS Microsoft.EnterpriseManagement.OperationsManager.Client\OperationsManagerMonitoring::192.168.0.3> This is exactly the same result as running my first script (OpsMgr2007_SidebarGadget.ps1) that did work. But not if I added the refresh option. Result from PromptOpsMgrAlertsChart.ps1 Script: OpsMgr2007_SidebarGadget.ps1 ============================================ # Description: OpsMgr 2007 Sidebar Gadget for Remotely Retrieve OpsMgr Alerts # Date: 20-02-2007 # Author: Stefan Stranger # Explanation: You can use this PowerShell script for creating a PowerGadget OpsMgr 2007 Sidebar Gadget for Vista param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$cred = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) # Add OpsMgr and PowerGadgets Cmdlets add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"; add-pssnapin "PowerGadgets"; set-location "OperationsManagerMonitoring::"; # Connect to Root Management Server. new-managementGroupConnection -ConnectionString:$serverName -Credential (get-credential $cred); set-location $serverName; # Count the number of Alerts per Severity and refreshes every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name | out-chart -refresh 0:1:0 -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -Title "OpsMgr 2007 Alerts" ================================================ Results from above script (OpsMgr2007_SidebarGadget.ps1): PS D:\Scripts> .\OpsMgr2007_SidebarGadget.ps1 Please enter your Root OpsMgr Server name: 192.168.0.3 Please enter your domain\username account for accessing the Root OpsMgr Server: opsmgr2007demo\adminis Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.EnterpriseManagement.OperationsManager. is already added. Verify the name of the snap-in and try again. At D:\Scripts\OpsMgr2007_SidebarGadget.ps1:10 char:13 + add-pssnapin <<<< "Microsoft.EnterpriseManagement.OperationsManager.Client"; Add-PSSnapin : Cannot add Windows PowerShell snap-in PowerGadgets because it is already added. Verify nap-in and try again. At D:\Scripts\OpsMgr2007_SidebarGadget.ps1:11 char:13 + add-pssnapin <<<< "PowerGadgets"; PathName : ManagementGroup : OpsMgr Demo ManagementServerName : 192.168.0.3 Drives : PS Microsoft.EnterpriseManagement.OperationsManager.Client\OperationsManagerMonitoring::192.168.0.3> Ignore the add-snappin errors because those were already loaded from the first script. See added images for the error after the refresh. Screenshot of the Results from the OpsMgr2007_SidebarGadget.ps1 script. Regards, Stefan Stranger http://weblog.stranger.nl
  19. Hi Juan, I'm getting there, but now I get no data available []. This is what I've done. 1. Separated the script (as suggested in your post) into to parts. 2. Used arguments for servername and username. Script PromptOpsMgrAlertsChart.ps1: =================================================== param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$account = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) if (get-pssnapin | where {$_.Name -eq "PowerGadgets"}) {} else {add-pssnapin "PowerGadgets"} d:\scripts\PromptOpsMgrAlerts.ps1 -serverName $serverName -account $account | out-chart -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -Title "OpsMgr 2007 Alerts" ==================================================== And PromptOpsMgrAlerts.ps1: ==================================================== # Description: OpsMgr 2007 Sidebar Gadget for Remotely Retrieve OpsMgr Alerts # Date: 20-02-2007 # Author: Stefan Stranger # Explanation: You can use this PowerShell script for creating a PowerGadget OpsMgr 2007 Sidebar Gadget for Vista param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$account = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) # Add OpsMgr Cmdlets if (get-pssnapin | where {$_.Name -eq "Microsoft.EnterpriseManagement.OperationsManager.Client"}) {} else {add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"} set-location "OperationsManagerMonitoring::"; # Connect to Root Management Server. new-managementGroupConnection -ConnectionString:$serverName -Credential (get-credential $account); set-location $serverName; # Count the number of Alerts per Severity and refreshes every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name ==================================================== If I run the OpsMgrAlertsChart.ps1, I'm asked for the servername and accountname. But the result is an "no data available" PowerGadget. But the refresh option seems to work. Because when I manually refresh (the no data available) PowerGadget I'm prompted again (as supposed) for the servername and username. And when refreshing again I'm not prompted for those. So that's a step in the right direction[]. But now I've to solve the "no data available" issue. I tried to change the out-chart pipe to a simple "out-chart" but that resulted in the same "no data available" Do I've to use the dataobject property? And how do I use that, because that's not completely clear to me. Any ideas? Regards, Stefan Stranger http://weblog.stranger.nl
  20. I've created the next script. It works but haven't tested it to pipe it to out-chart. Let you know. ================ # Description: OpsMgr 2007 Sidebar Gadget for Remotely Retrieve OpsMgr Alerts # Date: 22-02-2007 # Author: Stefan Stranger # Version: 0.3 # Explanation: You can use this PowerShell script for creating a PowerGadget OpsMgr 2007 Sidebar Gadget for Vista $serverName = "servername" $pwd = cat d:\scripts\EncryptedPwd.txt | convertto-securestring $cred=new-object -typename System.Management.Automation.PSCredential -argumentlist "domain\account",$pwd # Add OpsMgr and PowerGadgets Cmdlets. You also use an alias "asnp" add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"; add-pssnapin "PowerGadgets"; set-location "OperationsManagerMonitoring::"; # Connect to Root Management Server. new-managementGroupConnection -ConnectionString:$serverName -Credential (get-credential $cred); set-location $serverName; # Count the number of Alerts per Severity and refreshes every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name =========================== Regards, Stefan Stranger http://weblog.stranger.nl
  21. Or is there an issue with the refresh? According to info on the forum about refresh (http://community.softwarefx.com/forums/t/9227.aspx) which states that there are issues with variables. There are some subtleties on what type of variables we support but in the simple case it will just work. But I don't use any variables on the commandline which calls the out-chart from PowerGadgets. And if I understand the refresh option correctly refresh will execute the entire PowerShell command pipe. In my case: "get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name | out-chart -refresh 0:1:0 -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -Title "OpsMgr 2007 Alerts"" Am I correct? So what can be the problem? Regards, Stefan Stranger http://weblog.stranger.nl
  22. Sorry, I should've searched the forum better. http://community.softwarefx.com/forums/t/9215.aspx Regards, Stefan Stranger http://weblog.stranger.nl
  23. I'm using PowerGadgets right from the version I got on TechEd-IT forum and I think it's a great product. But besides that it can be used in the Enterprise also some home users will appreciate PowerGadgets. But there is no version for the home-user is there? The only version a home-user can use is the PowerGadgets Creator which costs $299. Can there not be a home-users edition for PowerGadgets? Regards, Stefan Stranger http://weblog.stranger.nl
  24. Juan, Thanks for your help with the out-chart problem I had. It's working almost the way I want except for the refresh option. This is the script I've written in PowerShell to create the PowerGadget. ==================================== # Description: OpsMgr 2007 Sidebar Gadget for Remotely Retrieve OpsMgr Alerts # Date: 20-02-2007 # Author: Stefan Stranger # Explanation: You can use this PowerShell script for creating a PowerGadget OpsMgr 2007 Sidebar Gadget for Vista param ([string]$serverName = $(read-host "Please enter your Root OpsMgr Server name"), [string]$cred = $(read-host "Please enter your domain\username account for accessing the Root OpsMgr Server")) # Add OpsMgr and PowerGadgets Cmdlets add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"; add-pssnapin "PowerGadgets"; set-location "OperationsManagerMonitoring::"; # Connect to Root Management Server. new-managementGroupConnection -ConnectionString:$serverName -Credential (get-credential $cred); set-location $serverName; # Count the number of Alerts per Severity and refresh every minute get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name | out-chart -refresh 0:1:0 -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow -Title "OpsMgr 2007 Alerts" ================================== At first I get the chart I want, but after a minute I get an error "Failed to connect to Data" Does the refresh option means that the whole script is executed again? If so there is already an connection with the remote datasource and should this be disconnected? But I don't want to supply the credentials every 1 minute. Any ideas I also looked at the Get-Credential thread in the discussion forum. http://community.softwarefx.com/forums/t/9056.aspx. But I'm not sure if this is the issue I've. Regards, Stefan Stranger http://weblog.stranger.nl
  25. Juan, Thanks your help. I solved the order of my data by sorting it by object name. If I'm correct than the first item will be Error, the next Information and the last Warning. Correct? get-alert | where {$_.ResolutionState -eq "0"} | group-object severity | sort-object name | select Count, Name | out-chart -datasourcesettings_style +Transpose -series_0_color Red -series_1_color Blue -series_2_color Yellow Regards, Stefan Stranger http://weblog.stranger.nl
×
×
  • Create New...