Jump to content
Software FX Community

JuanC

Staff
  • Posts

    863
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by JuanC

  1. In the current public build when you only pass one element, a powergadgets chart will automatically "add" points every time the gadget is refreshed. Honestly we did not gave this a high priority because a chart with 1 bar might be better served by a gauge. We have just added a flag where you can use the DisableAuto to turn off this behavior, e.g. get-date -uformat "%S" | out-chart -refresh 0:0:1 -DisableAuto AddData This will result in a chart with one bar (showing the current number of seconds) but the chart will refresh the bar value instead of adding bars. This flag will be supported in build 2769. JuanC
  2. Note that the bug we fixed was related to using -refresh in PS1 scripts. Because of the way we parse the powershell execution info we were not saving correctly the command to be reexecuted. This would explain why the trace does not show a new InvokeRunspace. Please make sure you are using in fact the most recent version. You may also want to check if there are other PowerGadgets snapins in your GAC and somehow they are being used instead of the newer build. To check which versions of the PG snapins are on the GAC you can run the following command (Note that gacutil is only installed by the .NET SDK, e.g. it is installed by Visual Studio but not by the .NET runtime installer) gacutil /l powergadgets.commands If you do not have gacutil in your system you can use the ".NET Framework 2.0 Configuration" applet in Control Panel - Administrative Tools to check the Assembly Cache. You can also check the following registry key to check the snapin registered in Powershell HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\PowerGadgets\AssemblyName This key will show you the full assembly name that powershell will try to load. JuanC
  3. Note that the command you typed is one you would type in a Powershell console, when selecting PowerShell data from the PG creator you cannot call out-chart/out-gauge. I noticed you are trying to set the max to be a column from the database, this cannot be achieved in the UI so you will have to use the following trick Make sure your command run and gets the right data from a powershell console (note Cosmin comments where you have to add our snapin or run the shortcut labeled "Powershell with powergadgets" Run your command and with powergadgets selected as the active window press "Ctrl-C" Create a new gadget in PG creator and select "Edit-Paste" If desired remove the previous gadget At this point you should have a gadget where the data is already set and also the max in the mainscale should be bound to a column returned by your SQL. Now you should be able to customize how the gauge looks using our UI. JuanC
  4. Assuming you are NOT using a template with multiple needles. invoke-sql ... | out-gauge -value ColumnName1 -mainscale_indicators_add needle -mainscale_indicators_1_value {$_.Column2} Note that although most collection in PowerGadgets are automatically created when you access them (e.g. titles in out-chart), you have to add to the indicators collection because you can add needle as well as markers. If you have a template where you already configured multiple needles then you do not need to add, just set its value, e.g. invoke-sql ... | out-gauge -value ColumnName1 -template MyMultiNeedle.pgt -mainscale_indicators_1_value {$_.Column2} JuanC
  5. We have finally found and fixed the refresh issue. In an interim build we tried to fix an issue with a localized PowerShell version and we introduced a bug that affects refreshing on scripts. You can download an updated build from the same place you downloaded it before (check that the file date should be July 23rd or later before downloading). >> One correction to the blog post, last command has a typo "-legendbox_itemattributes_-series_visible false". Most probably you wanted to hide >> the totals in the "FreeSpace" in the Legend. I couldnt figure the syntax out It is not a typo. Although it is a weird syntax, it was the easiest way for us to expose a way to hide the series collection (regardles of how many series are plotted) from the legend box. Because this is definitely not a common scenario we thought the weirdness would not be too bad. JuanC
  6. We have finally found and fixed the refresh issue. In an interim build we tried to fix an issue with a localized PowerShell version and we introduced a bug that affects refreshing on scripts. You can download an updated build from the same place you downloaded it before (check that the file date should be July 23rd or later before downloading). JuanC
  7. We have finally found and fixed the refresh issue. In an interim build we tried to fix an issue with a localized PowerShell version and we introduced a bug that affects refreshing on scripts. You can download an updated build from the same place you downloaded it before (check that the file date should be July 23rd or later before downloading). JuanC
  8. I just tried the following send-mail -subject "Test Mail" -to "account1@domain.com;account2@hotmail.com" I also tried the "full" format supplying a display name send-mail -subject "Test Mail" -to "John Doe<account1@domain.com>;John Doe2<account2@hotmail.com" And both worked. I also checked the change history for our send-mail cmdlet and the last time we changed any code was way before build 2588. Can you check the version of your PowerGadgets.Commands.dll? JuanC
  9. Please check the following blog post, I think the combined approach will give you the exact chart you need. If you need an updated build please send an email to support at powergadgets dot com. JuanC
  10. Conditional attributes is a feature that allows you to create charts where the color of the markers depend on a certain condition. In the first PowerGadgets release build (1.0.2588) there are 2 different ways to setup these conditional attributes Static You can use this approach when you know in advance the ranges that should define the color of the markers, also this approach only works if the condition applies to the column/field being charted. For example if you wanted a bar chart showing the number of handles opened by each process, and you want to show processes with more than 600 Handles in red, processes with opened handles between 400 and 600 yellow and all others green you could write something like this ps | out-chart -values Handles -ConditionalAttributes_0_Condition_From 600 -ConditionalAttributes_0_Color Red -ConditionalAttributes_1_Condition_From 200 -ConditionalAttributes_1_Condition_To 600 -ConditionalAttributes_1_Color Yellow -Series_0_Color Green Note that ConditionalAttributes is a collection so we can create as many conditions as needed but to specify the condition you can only specify From and To values. Also note that besides color you can change other point attributes such as PointLabels, Borders, MarkerShape, MarkerSize, etc. An advantage of this approach is that you can set it up in a PGF or PGT using the PowerGadgets creator. If you are using PowerShell make sure you have our Tab Completion hooked up so that you can type -cond<TAB><TAB>_0_<TAB> and see all the properties you can modify. Dynamic (ScriptBlock using Powershell) Using this approach you can use the -condition parameter to specify a boolean piece of code you want to use as condition when coloring the markers. Note that you are free to use any existing property whether that is being charted or not, but you can only have 1 condition so you will end up with 2 sets of markers: the ones where your scriptblock evaluates to true will be applied any properties specified using the -condition_ attributes. The ones where your scriptblock evaluates to false will be untouched. For example, if you wanted a bar chart showing the available hard drive space in your machine but you want to see disks where the available space is less than 50% of the total size in a different color, you could type get-wmiobject -class Win32_LogicalDisk | out-chart -values FreeSpace -label DeviceID -condition {([double]$_.FreeSpace/$_.Size) -lt 0.5} -condition_Color LightGreen Because FreeSpace and Size are both UINT64 we have to cast one of them to double so that the division is defined. If your are trying to write the right condition I would recommend you start doing something like get-wmiobject -class Win32_LogicalDisk | select FreeSpace,DeviceId,{([double]$_.FreeSpace/$_.Size) -lt 0.5}, not using out-chart but just selecting the fields and condition will give you the chance to make sure the condition actually works. Note that although -condition_ allows you to set the same properties as the -ConditionalAttributes counterpart (MarkerSize, MarkerShape, etc.) you can only specify one condition (we do not support -condition_1_) Combined Feedback from some of our users showed that we need an approach where you can have the flexibility of writing your own condition using a scriptblock but you also need to specify multiple conditions. In build 2683 we implemented a new feature that supports this pattern. You specify as many conditionalattributes as you want but you do not have to set their conditions, only visual attributes such as color, markersize, etc. Then you make sure your scriptblock returns a number which we will use as an index for the condition you want to apply. E.g. if you want a chart where available hard drive space is plotted, but disks where available space is less than 50% of the total size should be yellow and disks where available space is less than 10% of the total size should be red. Obviously because we have far passed the human limit for a one-liner, you would create a script with the following $condition = { $perc = [double] $_.FreeSpace / $_.Size; if ($perc -lt 0.10) { 0; } else { if ($perc -lt 0.50) { 1; } else { 2; } } } get-wmiobject -class Win32_LogicalDisk | out-chart -label DeviceID -values FreeSpace -conditionalattributes_0_color red -conditionalattributes_1_color yellow -conditionalattributes_2_color green -condition $condition -legendbox_visible false To finish this chart we will add a legend explaining the colors, note that although you can assign a label to each conditional attribute, the chart will also show a label for the series. To hide the series items from the legend box we had to support a really strange syntax but it was the only way we could squeeze this change without affecting existing scripts get-wmiobject -class Win32_LogicalDisk | out-chart -label DeviceID -values FreeSpace -conditionalattributes_0_color red -conditionalattributes_1_color yellow -conditionalattributes_2_color green -condition $condition -conditionalattributes_0_text "Less than 10%" -conditionalattributes_1_text "Less than 50%" -conditionalattributes_2_text "More than 50%" -legendbox_itemattributes_-series_visible false Remember that in order to use the combined approach you need to install PowerGadgets build 2683 or later. JuanC
  11. Please check the following post http://community.softwarefx.com/blogs/powergadgets_team_blog/archive/2007/02/09/Scriptblock-support-in-chart-parameters.aspx Regards, JuanC
  12. Please send an email to support at powergadgets dot com and we will make an updated version available. JuanC
  13. Even if you are monitoring data that does not lend itself to drill down, you can use drilldown_script to invoke other applications or launching a browser to a specific URL. To show how to invoke other applications, let's write a script that collects information from multiple servers. We can use get-wmiobject to get information about the available space in the main hard drive of our servers as follows ServersDisk.ps1 $servers = "machine1.yourdomain.com", "machine2.yourdomain.com", "machine3.yourdomain.com" get-wmiobject -class Win32_LogicalDisk -computer $servers -credential yourdomain\Administrator -filter "DeviceID='C:'" | select __Server,FreeSpace A couple of notes about our script I am not running as a user that has administrative privileges in the server, so we have to use -credential We are using a feature in get-wmiobject that allows you to query information from more than 1 computer. The name of the computer returned by this cmdlet in __SERVER does not contain domain information Note that drilldown_script will simply invoke the specified string so you can supply a script name or the command you want to run, invoking the remote desktop client is very easy because the Remote Desktop app is located in the System32 folder so we just need its name. PS C:\Temp> ServersDisk | out-chart -drilldown_script mstsc -drilldown_parameter {"/v:"+$_.__SERVER} Now double click one of the bars, if you use the "Save Credentials" feature in the new remote desktop client you will get straight to the server in question. To show how to launch a URL we will create a chart with the CPU utilization of all the virtual machines running on a virtual server, double clicking on a bar will now open the VM in question using the browser based VRM client. VMCpu.ps1 get-wmiobject -class virtualmachine -namespace 'root/vm/virtualserver' -computername virtualserver.yourdomain.com | select Name,CPUUtilization Note that Internet Explorer is not normally in a folder in your PATH so we have to specify the full path PS C:\Temp> vmcpu | out-chart -drilldown_script 'C:\"Program Files"\"Internet Explorer"\iexplore' -drilldown_param {"http://virtualserver.yourdomain.com:1024/VirtualServer/VSWebApp.exe?view=3&vm="+$_.Name} This is a little more verbose but once you get it running, you can save it in a script for future use. Acknowledgement The URL portion of this post was inspired by Ben Pearce.
  14. It seems to be blocked but it was not intentional. I am attaching a Word document while we work on posting a new PDF. The original word documents was a DOCX but hopefully nothing was lost in translation. JuanC
  15. We have a dummy stored procedure that takes 2 parameters and returns the records for which a particular column is between those 2 parameters. I started doing the following PS C:\Temp> $data = invoke-sql -server myserver -database testdb -sql "execute spGetData1 42,48"PS C:\Temp> $data ProductA : BValue1 : 45Date : 11/10/2006 12:00:00 AMValue2 : 256677Quarter : Q1 PS D:\Dev\PowerGadgets\Release\Bin\Debug> $data | get-member TypeName: System.Data.DataRow Name MemberType Definition---- ---------- ----------AcceptChanges Method System.Void AcceptChanges()... (Other DataRow members here)Date Property System.DateTime Date {get;set;}ProductA Property System.String ProductA {get;set;}Quarter Property System.String Quarter {get;set;}Value1 Property System.Int32 Value1 {get;set;}Value2 Property System.Int32 Value2 {get;set;} Note that each of the columns the SP returns are surfaced as properties, this means you can now write a script as follows $data1 = invoke-sql -server myserver1 -database testdb -sql "execute spGetData1 42,48"$data2 = invoke-sql -server myserver2 -database testdb -sql "execute spGetData1 42,48"$data3 = invoke-sql -server myserver3 -database testdb -sql "execute spGetData1 42,48"$data4 = invoke-sql -server myserver4 -database testdb -sql "execute spGetData1 42,48"$data1.Value1 + $data2.Value1 + $data3.Value1 + $data4.Value1 If you name this script SumMultipleDB.ps1 you can now invoke it from powershell PS C:\Temp> .\SumMultipleDB.ps1 | out-gauge If you are using PowerGadgets creator you can create a gadget with a gauge, select PowerShell as your data Source and either paste the contents of the script or the fully qualified name of the PS1 if you want to reuse the script somewhere else. JuanC
  16. Have you tried using $processed.Delta instead of $_.Delta? If this does not work I would recommend you do $processed | get-member, this will let you know if the results of your T-SQL are being returned as you expect to the powershell variable. JuanC
  17. To avoid doing this on each of your powershell sessions you can 1) Execute a shortcut we create in the Start Menu PowerGadgets. This points to a PSC1 file that will add the powergadgets snapin to the session. 2) Temporarily add this line to your profile.ps1 (<Documents>\WindowsPowerShell folder). This will apply to all sessions including if you run the PowerShell created shortcut. JuanC
  18. If you are creating a chart with only 1 series (i.e. if you are reading only one numerical column from SQL) you can control the spacing by modifying the AllSeries.Volume property. A value of 100 would leave no space between the bars, a value of 50 would result on space between the bars equal to the width of the bars. If you have a multiple series chart (i.e. multiple numerical columns) unfortunately we do not support controlling the separation between the different series for the same point. The AllSeries.Volume property will still control the percentage used for the bars. The easiest way to see the effect of this property is to play with both a single-series chart and a multi-series chart on Creator and modify this property. If you are using PowerShell you can control this property doing something like 10,12,8 | out-chart -allseries_volume 100 JuanC
  19. You will have to write a powershell script that returns an object with 2 (or more) properties, the value you want in the main gauge and the one for the inner gauge. You can find a sample of this technique here Your script will be similar to RandomData.ps1 and you will invoke it in a very similar way to the second-to-last sample in that blog post. e.g. .\randomdata.ps1 | out-gauge -value Sales -InnerGauges_Add Digital -InnerGauges_0_Layout_Target AnchorPoint -InnerGauges_0_Layout_AnchorPoint 0,-0.5 -InnerGauges_0_DigitalPanel_Value {$_.PrevSales} Note that setting the LayoutTarget and the AnchorPoint properties is used to position the inner gauge. Unfortunately it is not possible to achieve this (bind the inner gauge value or for that fact any other property but the main value) using PowerGadgets Creator but there is a trick you can use. Once you have your script returning the data you want and the gauge reading that data from powershell, you can press Ctrl-C when the gadget is the active window and then press Ctrl-V inside Creator. You will not be able to change the "binding" for the innergauge value property but you will be able to customize everything else using creator instead of typing the commands in the console window. Hope this helps. JuanC
  20. 1) The reason for both behaviors is that - normally - the points attributes are either non-existent (in a multi-series chart) or data dependent. We understand this is a serious limitation and will try to provide a workaround. 2) Can you include screenshots and provide more information about the data passed to the gadget? Is it possible it had null values? Did this happen on a refreshed chart? 3) We have tested PowerGadgets in multi-monitor displays and I recently tried to duplicate this issue but was unable to do so. Can you expand on your configuration and how to duplicate this issue. 4) If you pass datetime information to the X axis then TimeFormat (or custom) should work as expected. Please provide more information about the data feeding the gadget. Regards, JuanC
  21. We have fixed an issue related specifically to SQL Server 2005 that may prevent us from connecting, it seems to be related to permissions and the default database. It is NOT related to specific characters in the password. We have an interim build that fixes the issue, please contact us at support at powergadgets dot com for details on how to get it. Regards, JuanC
  22. Can you post more details about your web service, e.g. return value, parameters, etc. Also please specify if you are using the PowerGadgets creator or using invoke-webservice from PowerShell. Regards, JuanC
  23. What do you mean when you say "I can connect if I use sa, but I can't then issue commands", do you get a valid DB list when using SA? Are you able to execute a simple SELECT query? >> when I try using a username and password the list of DB comes back empty Have you tried with more than 1 user/pwd combination? I do not think the non-alpha characters should be a problem but just in case can you clarify which kind of non-alpha characters are you using? If you do not want to post this info feel free to send an email to support at powergadgets dot com. Regards, JuanC
  24. Given the fact that we use Team System to manage the PowerGadgets development process, it was only obvious that we would test our gadgets by connecting to the work item store and display our project information in the Vista sidebar or desktop. Although PowerGadgets is primarily targeted to IT professionals and DB administrators, we hope other developers may find this post useful. Although there are several blog posts with scripts talking directly to the TFS API, we chose to develop a cmdlet as it is more portable than a collection of scripts and although the cmdlet code is relatively simple, debugging a cmdlet is easier than debugging a script. To install this snapin simply unzip the files to any folder in your machine and run InstallUtil passing the path to PowerGadgets.TFSCmdlet.dll as a parameter. InstallUtils is located in the .NET Framework folder which is typically at C:\Windows\Microsoft.NET\Framework\v2.0.50727. This snapin does not depends on any PowerGadgets assemblies so you can use it even if you do not have PowerGadgets installed in your machine. get-workitem This is probably the main cmdlet in our snapin and it returns a collection of work items, it supports the following parameters: Server: Server name hosting the TFS Web Services, e.g. tfserver.company.com Port: Port used by TFS Web Services (defaults to 8080) Project: Project Name or All (defaults to All) Type: Bug, Task, ... or All (defaults to Bug) State: Active, Resolved, ... or All (defaults to Active) CreatedBy: User Name, me or All (defaults to All, more on how User names are handled later) Priority: Priority number or -1 for all priorities (defaults to -1) Reason: Fixed, New ... or All (defaults to All) AssignedTo: User Name, me or All (defaults to @me, more on how User names are handled later) The first 3 parameters are supported in all our TFS cmdlets and can be set in a config file located in the same folder as our snapin, there is a lot of information in the TFS store but we chose to return the following work item info: ID, Title, Type, State, Reason, Priority, CreatedBy, CreatedDate, ResolvedBy, ResolvedDate, AssignedTo, Project and Description. Note that most of the parameters are used to filter the number of work items returned by the TFS web service to the cmdlet, you can also filter using the where cmdlet but this will result in more information sent from the server. This is similar to filtering at the WMI level against piping get-wmiobject cmdlet to a where cmdlet. get-changeset Returns a collection of change sets and it supports the following parameters From: Specifies the starting date for which to return changesets LastBuild: A switch parameter that allows you to see the changesets since the last build Owner: User Name to filter the changesets. This cmdlet returns the following changeset info: ID, Comment, Owner, Date and the associated Work Items. get-build Returns a list of builds for the specified project, we couldn't find a way to limit the output of the native TFS web service so no extra parameters are supported, you can always use the where parameter to get a subset. This cmdlet returns the following build info: BuildMachine, DropLocation, BuildStatus, StartTime, BuildType, RequestedBy, TeamProject, BuildNumber, BuildQuality, BuildUri, FinishTime, LogLocation, LastChangedBy, LastChangedOn and BuildStatusId add-build We wrote this cmdlet because we currently use a homegrown build and test system and we chose not to migrate to Team Build yet. As part of our build process we want to send emails to interested parties (PM, testers, etc.) as soon as a build is finished letting them know which work items were associated with the build including changesets comments. get-warehouse This is an in-progress cmdlet that talks to the TFS Warehouse instead of using the web services. The idea is that this cmdlet will contain a prebuilt number of MDX statements and will also you to run your own. If the MDX returns 1 or dimensions you can output those to the console (or to a chart) but when returning more than 2 dimensions something else is needed. We have modified our out-chart cmdlet to understand OLAP cubes and it allows you to slice and dice from all the dimensions in the MDX. This code is still in a very early stage and it is being done in our development branch. If somebody is interested in exploring OLAP (TFS or any other cube) in a gadget we can make a pre-release version available. We will write a blog post including some OLAP gadget screenshots in the following weeks. With this cmdlets we have used several gadgets internally including the following, note that this assumes you modified the config file and selected a default server: A radial gauge showing the number of total active workitems/bugs/tasks in a specific project get-workitem -project PowerGadgets -type All | measure-object | out-gauge -type radial A chart showing the number of total active workitems grouped by type assigned to me get-workitem -project PowerGadgets -type All -assignedto me | group Type | select Count,Name | out-chart A digital panel displaying the number of open bugs assigned to me get-workitem -project PowerGadgets -assignedto me | measure-object | out-gauge A gauge showing the revision (3rd number in the version which normally identifies the day) for the last build (get-build -project PowerGadgets| select -last 1).BuildNumber.Split('.')[2] | out-gauge A line chart displaying the number of workitems resolved by day get-workitem -project PowerGadgets -state Resolved | select @{Expression={$_.ResolvedDate.Date};Name="Date"},Id | group Date | select Name,Count | out-chart -gallery lines This gadget is aggregating by date using $_.ResolvedDate.Date and is also doing an extra select before piping to out-chart, this is because out-chart has a built-in functionality where double clicking on a group shows details for the groups but in this case double click was not required. A gauge showing the number of work items created by me fixed the last 30 days get-workitem -project PowerGadgets -state Resolved -createdby me | where {([datetime]::now-$_.resolveddate).TotalDays -lt 30} | measure-object About user name handling: TFS seems to use 3 different name conventions, some APIs will return the login name (e.g. JonhS), others will return a domain qualified name (e.g. YOURCOMPANY\JohnS) and yet others will return a full name (e.g. John Smith). Because of this we tried to standardize on using the login name and the config file allows you to specify the conversion between login name and full name. About PG creator: If you want to create a gadget using one or more cmdlets in this snapin you can do so, note that you will select PowerShell as the data source and you have to press the snapins button in the PowerShell configuration wizard to add the snapin. About 64bits: the .NET assemblies that implement the connection to the TFS web services are marked as x86, this means that if you want to create some of these gadgets in a 64bits machine you will have to run the x86 PowerShell. This also means that it is not possible to host these gadgets in a 64bits machine sidebar as this process is always a 64bits process. If you need help setting this up please let us know. JuanC
  25. There is an optimization in invoke-sql that could be causing problems, please try something like invoke-sql -server SQLServer1 -database TestDB -sql "SELECT Purchased,InUse,ProductName FROM Table" | select Purchased,InUse,ProductName | out-chart ... The extra select cmdlet between invoke-sql and out-chart might fix this issue. If it does not help please post the SQL statement you are writing and some information about the table where these values are stored. JuanC
×
×
  • Create New...