Skip to content

Commit 2f57bd8

Browse files
2.0.0 updates
1 parent 83b9e21 commit 2f57bd8

13 files changed

+1544
-291
lines changed

README.md

Lines changed: 116 additions & 34 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log for PSScriptTools
22

3+
## v2.0.0
4+
5+
+ Added `New-PSFormatXml` and its alias `nfx`
6+
+ Raised minimum PowerShell version to 5.1
7+
+ Modified manifest to support both `Desktop` and `Core`
8+
+ Added `Remove-Runspace`
9+
+ Modified `ConvertTo-WPFGrid` to autosize the display and support an automatic refresh
10+
+ Modified `ConvertTo-WPFGrid` to use a runspace (Issue #22)
11+
+ Updated `README.md`
12+
+ Updated help documentation
13+
+ Raised version number to reflect a number of potentially breaking changes.
14+
315
## v1.8.1
416

517
+ minor corrections to `Compare-Module` (Issue #21)

docs/ConvertTo-WPFGrid.md

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: PSScriptTools-help.xml
33
Module Name: PSScriptTools
4-
online version:
4+
online version:
55
schema: 2.0.0
66
---
77

@@ -13,28 +13,28 @@ Send command output to an interactive WPF-based grid.
1313

1414
## SYNTAX
1515

16-
```powershell
17-
ConvertTo-WPFGrid [[-InputObject] <PSObject>] [[-Title] <String>] [[-Timeout] <Int32>] [[-Width] <Int32>]
18-
[[-Height] <Int32>] [-CenterScreen] [<CommonParameters>]
16+
```yaml
17+
ConvertTo-WPFGrid [[-InputObject] <PSObject>] [[-Title] <String>] [[-Timeout] <Int32>] [-Refresh]
18+
[<CommonParameters>]
1919
```
2020

2121
## DESCRIPTION
2222

23-
This command is an alternative to Out-Gridview. It works much the same way. Run a PowerShell command and pipe it to this command. The output will be displayed in a data grid. You can click on column headings to sort. You can resize columns and you can re-order columns.
23+
This command is an alternative to Out-Gridview. It works much the same way. Run a PowerShell command and pipe it to this command. The output will be displayed in an autosized data grid. You can click on column headings to sort. You can resize columns and you can re-order columns. You will want to be selective about which properties you pipe through to this command. See examples.
2424

25-
You will want to be selective about which properties you pipe through to this command. See examples.
25+
You can specify a timeout value which will automatically close the form. If you specify a timeout and the Refresh parameter, then the contents of the datagrid will automatically refreshed using the timeout value as an integer. This will only work when you pipe a PowerShell expression to ConvertTo-WPFGrid.
2626

27-
Unlike Out-Gridview, your PowerShell prompt will be blocked until the WPF-based grid is closed.
27+
This command runs the WPF grid in a new runspace so your PowerShell prompt will not be blocked. However, after closing the form you may be left with the runspace. You can use Remove-Runspace to clean up or wait until you restart PowerShell.
2828

2929
## EXAMPLES
3030

3131
### EXAMPLE 1
3232

3333
```powershell
34-
PS C:\ Get-Service -computername Server1 | Select Name,Status,Displayname,StartType,Machinename | ConvertTo-WPFGrid -centerscreen
34+
PS C:\> get-process | sort-object WS -Descending | Select -first 20 ID,Name,WS,VM,PM,Handles,StartTime | Convertto-WPFGrid -Refresh -timeout 20 -Title "Top Processes"
3535
```
3636

37-
Get all services from Server1 and display selected properties in a grid which will be centered on the screen.
37+
Get the top 20 processes based on the value of the WorkingSet property and display selected properties in the WPF Grid. The contents will automatically refresh every 20 seconds. You will need to manually close the form.
3838

3939
### EXAMPLE 2
4040

@@ -43,10 +43,10 @@ PS C:\> $vmhost = "CHI-HVR2"
4343
PS C:\> Get-VM -computername $VMHost | Select Name,State,Uptime,
4444
@{Name="AssignedMB";Expression={$_.MemoryAssigned/1mb -as \[int\]}},
4545
@{Name="DemandMB";Expression={$_.MemoryDemand/1mb -as \[int\]}} |
46-
ConvertTo-WPFGrid -title "VM Report $VMHost" -Width 500 -height 200 -timeout 20
46+
ConvertTo-WPFGrid -title "VM Report $VMHost" -timeout 20
4747
```
4848

49-
Get Hyper-V virtual machine information and display in a resized grid for 20 seconds.
49+
Get Hyper-V virtual machine information and display for 20 seconds before automatically closing.
5050

5151
## PARAMETERS
5252

@@ -85,7 +85,7 @@ Accept wildcard characters: False
8585
### -Timeout
8686
8787
By default the grid will remain displayed until you manually close it. But you can specify a timeout interval in seconds.
88-
The minimum accepted value is 5 seconds. Because the timer ticks in 5 second intervals it is recommended that your time out value also be a multiple of 5.
88+
The minimum accepted value is 5 seconds. If you use this parameter with -Refresh, then the datagrid will be refreshed with results of the PowerShell expression you piped to ConvertTo-WPFGrid.
8989
9090
```yaml
9191
Type: Int32
@@ -99,41 +99,9 @@ Accept pipeline input: False
9999
Accept wildcard characters: False
100100
```
101101
102-
### -Width
103-
104-
Specify a width in pixels for your form.
105-
106-
```yaml
107-
Type: Int32
108-
Parameter Sets: (All)
109-
Aliases:
110-
111-
Required: False
112-
Position: 4
113-
Default value: 1024
114-
Accept pipeline input: False
115-
Accept wildcard characters: False
116-
```
117-
118-
### -Height
102+
### -Refresh
119103
120-
Specify a height in pixels for your form.
121-
122-
```yaml
123-
Type: Int32
124-
Parameter Sets: (All)
125-
Aliases:
126-
127-
Required: False
128-
Position: 5
129-
Default value: 768
130-
Accept pipeline input: False
131-
Accept wildcard characters: False
132-
```
133-
134-
### -CenterScreen
135-
136-
Windows will display the form in the center of your screen.
104+
If you specify this parameter and a Timeout value, this command will refresh the datagrid with the PowerShell expression piped into ConvertTo-WPFGrid. This will only work if you are using this command at the end of a pipelined expression. See examples.
137105
138106
```yaml
139107
Type: SwitchParameter
@@ -142,15 +110,14 @@ Aliases:
142110

143111
Required: False
144112
Position: Named
145-
Default value: False
113+
Default value: None
146114
Accept pipeline input: False
147115
Accept wildcard characters: False
148116
```
149117
150118
### CommonParameters
151119
152-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
153-
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
120+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
154121
155122
## INPUTS
156123

0 commit comments

Comments
 (0)