Skip to content

Commit f5cfbed

Browse files
see changelog for v2.1.0
1 parent 6772b11 commit f5cfbed

File tree

10 files changed

+755
-21
lines changed

10 files changed

+755
-21
lines changed

PSScriptTools.psd1

56 Bytes
Binary file not shown.

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,26 @@ PS C:\> get-runspace | where ID -gt 1 | Remove-Runspace
664664

665665
Get all runspaces with an ID greater than 1, which is typically your session, and remove the runspace.
666666

667+
## [Get-ParameterInfo](docs/Get-ParameterInfo.md)
668+
669+
Using Get-Command, this function will return information about parameters for any loaded cmdlet or function. The common parameters like Verbose and ErrorAction are omitted. Get-ParameterInfo returns a custom object with the most useful information an administrator might need to know.
670+
671+
```powershell
672+
PS C:\> Get-ParameterInfo -Command Get-Counter -Parameter computername
673+
674+
675+
Name : computername
676+
Aliases : Cn
677+
Mandatory : False
678+
Position : Named
679+
ValueFromPipeline : False
680+
ValueFromPipelineByPropertyName : False
681+
Type : System.String[]
682+
ParameterSet : __AllParameterSets
683+
```
684+
667685
## Compatibility
668686

669687
Where possible these commands have been tested with PowerShell Core, but not every platform. If you encounter problems, have suggestions or other feedback, please post an issue.
670688

671-
*last updated 12 February 2019*
689+
*last updated 17 February 2019*

changelog.md

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

3+
## v2.1.0
4+
5+
+ Added parameter to allow user to specify a type name with `New-PSFormatXML` (Issue #26)
6+
+ Added `Get-ParameterInfo` command with an alias of `gpi`
7+
+ Updated help for `Optimize-Text`
8+
+ Help updates
9+
+ Updated `README.md`
10+
311
## v2.0.0
412

513
+ Added `New-PSFormatXml` and its alias `nfx`

docs/Get-ParameterInfo.md

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Get-ParameterInfo
9+
10+
## SYNOPSIS
11+
12+
Retrieve command parameter information.
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Get-ParameterInfo [-Command] <String> [-Parameter <String>] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
Using Get-Command, this function will return information about parameters for any loaded cmdlet or function. The common parameters like Verbose and ErrorAction are omitted. Get-ParameterInfo returns a custom object with the most useful information an administrator might need to know. See examples.
23+
24+
## EXAMPLES
25+
26+
### EXAMPLE 1
27+
28+
```powershell
29+
PS C:\> get-parameterinfo get-service
30+
31+
32+
Name : Name
33+
Aliases : ServiceName
34+
Mandatory : False
35+
Position : 0
36+
ValueFromPipeline : True
37+
ValueFromPipelineByPropertyName : True
38+
Type : System.String[]
39+
ParameterSet : Default
40+
41+
Name : ComputerName
42+
Aliases : Cn
43+
Mandatory : False
44+
Position : Named
45+
ValueFromPipeline : False
46+
ValueFromPipelineByPropertyName : True
47+
Type : System.String[]
48+
ParameterSet : __AllParameterSets
49+
50+
Name : DependentServices
51+
Aliases : DS
52+
Mandatory : False
53+
Position : Named
54+
ValueFromPipeline : False
55+
ValueFromPipelineByPropertyName : False
56+
Type : System.Management.Automation.SwitchParameter
57+
ParameterSet : __AllParameterSets
58+
59+
Name : RequiredServices
60+
Aliases : SDO,ServicesDependedOn
61+
Mandatory : False
62+
Position : Named
63+
ValueFromPipeline : False
64+
ValueFromPipelineByPropertyName : False
65+
Type : System.Management.Automation.SwitchParameter
66+
ParameterSet : __AllParameterSets
67+
68+
Name : DisplayName
69+
Aliases :
70+
Mandatory : True
71+
Position : Named
72+
ValueFromPipeline : False
73+
ValueFromPipelineByPropertyName : False
74+
Type : System.String[]
75+
ParameterSet : DisplayName
76+
77+
Name : Include
78+
Aliases :
79+
Mandatory : False
80+
Position : Named
81+
ValueFromPipeline : False
82+
ValueFromPipelineByPropertyName : False
83+
Type : System.String[]
84+
ParameterSet : __AllParameterSets
85+
86+
Name : Exclude
87+
Aliases :
88+
Mandatory : False
89+
Position : Named
90+
ValueFromPipeline : False
91+
ValueFromPipelineByPropertyName : False
92+
Type : System.String[]
93+
ParameterSet : __AllParameterSets
94+
95+
Name : InputObject
96+
Aliases :
97+
Mandatory : False
98+
Position : Named
99+
ValueFromPipeline : True
100+
ValueFromPipelineByPropertyName : False
101+
Type : System.ServiceProcess.ServiceController[]
102+
ParameterSet : InputObject
103+
```
104+
105+
Return parameter information for Get-Service
106+
107+
### EXAMPLE 2
108+
109+
```powershell
110+
PS C:\> get-parameterinfo mkdir | Select Name,Type,Position,parameterset
111+
112+
Name Type Position ParameterSet
113+
---- ---- -------- ------------
114+
Path System.String[] 0 pathSet
115+
Path System.String[] 0 nameSet
116+
Name System.String Named nameSet
117+
Value System.Object Named __AllParameterSets
118+
Force System.Management.Automation.SwitchParameter Named __AllParameterSets
119+
Credential System.Management.Automation.PSCredential Named __AllParameterSets
120+
UseTransaction System.Management.Automation.SwitchParameter Named __AllParameterSets
121+
```
122+
123+
Get selected parameter information for the mkdir command.
124+
125+
### EXAMPLE 3
126+
127+
```powershell
128+
PS C:\> get-parameterinfo get-ciminstance | sort parameterset | format-table -GroupBy ParameterSet -Property Name,Mandatory,Alias,Position,Type
129+
130+
ParameterSet: __AllParameterSets
131+
132+
Name Mandatory Alias Position Type
133+
---- --------- ----- -------- ----
134+
OperationTimeoutSec False Named System.UInt32
135+
136+
137+
ParameterSet: CimInstanceComputerSet
138+
139+
Name Mandatory Alias Position Type
140+
---- --------- ----- -------- ----
141+
ResourceUri False Named System.Uri
142+
InputObject True 0 Microsoft.Management.Infrastructure.CimInstance
143+
ComputerName False Named System.String[]
144+
145+
146+
ParameterSet: CimInstanceSessionSet
147+
148+
Name Mandatory Alias Position Type
149+
---- --------- ----- -------- ----
150+
CimSession True Named Microsoft.Management.Infrastructure.CimSession[]
151+
InputObject True 0 Microsoft.Management.Infrastructure.CimInstance
152+
ResourceUri False Named System.Uri...
153+
```
154+
155+
Get all parameters from Get-CimInstance and display details as a formatted table.
156+
157+
### Example 4
158+
159+
```powershell
160+
PS C:\> Get-ParameterInfo -Command Get-Counter -Parameter computername
161+
162+
163+
Name : computername
164+
Aliases : Cn
165+
Mandatory : False
166+
Position : Named
167+
ValueFromPipeline : False
168+
ValueFromPipelineByPropertyName : False
169+
Type : System.String[]
170+
ParameterSet : __AllParameterSets
171+
```
172+
173+
Get details on the Computername parameter of the Get-Counter cmdlet.
174+
175+
## PARAMETERS
176+
177+
### -Command
178+
179+
The name of a cmdlet or function. The parameter has an alias of Name.
180+
181+
```yaml
182+
Type: String
183+
Parameter Sets: (All)
184+
Aliases: name
185+
186+
Required: True
187+
Position: 1
188+
Default value: None
189+
Accept pipeline input: True (ByPropertyName, ByValue)
190+
Accept wildcard characters: False
191+
```
192+
193+
### -Parameter
194+
195+
{{Fill Parameter Description}}
196+
197+
```yaml
198+
Type: String
199+
Parameter Sets: (All)
200+
Aliases:
201+
202+
Required: False
203+
Position: Named
204+
Default value: None
205+
Accept pipeline input: False
206+
Accept wildcard characters: False
207+
```
208+
209+
### CommonParameters
210+
211+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
212+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
213+
214+
## INPUTS
215+
216+
### [string]
217+
218+
## OUTPUTS
219+
220+
### custom object
221+
222+
## NOTES
223+
224+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
225+
226+
## RELATED LINKS
227+
228+
[Get-Command]()

docs/New-PSFormatXML.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Create or modify a format.ps1xml file
1414
## SYNTAX
1515

1616
```yaml
17-
New-PSFormatXML [-InputObject] <Object> [[-Properties] <String[]>] [[-FormatType] <String>]
18-
[[-ViewName] <String>] [-Path] <String> [-Append] [-Passthru] [-WhatIf] [-Confirm] [<CommonParameters>]
17+
New-PSFormatXML [-InputObject] <Object> [[-Properties] <String[]>] [-Typename <String>]
18+
[[-FormatType] <String>] [[-ViewName] <String>] [-Path] <String> [-Append] [-Passthru] [-WhatIf] [-Confirm]
19+
[<CommonParameters>]
1920
```
2021

2122
## DESCRIPTION
@@ -236,10 +237,25 @@ Accept pipeline input: False
236237
Accept wildcard characters: False
237238
```
238239
240+
### -Typename
241+
242+
Specify the object typename. If you don't, then the command will use the detected object type from the Inputobject.
243+
244+
```yaml
245+
Type: String
246+
Parameter Sets: (All)
247+
Aliases:
248+
249+
Required: False
250+
Position: Named
251+
Default value: None
252+
Accept pipeline input: False
253+
Accept wildcard characters: False
254+
```
255+
239256
### CommonParameters
240257
241-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
242-
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
258+
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).
243259
244260
## INPUTS
245261

docs/Optimize-Text.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: PSScriptTools-help.xml
3-
Module Name: psscripttools
3+
Module Name: PSScriptTools
44
online version:
55
schema: 2.0.0
66
---
@@ -13,7 +13,7 @@ Clean and optimize text input.
1313

1414
## SYNTAX
1515

16-
### Default (Default)
16+
### default (Default)
1717

1818
```yaml
1919
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-Ignore <String>] [-ToUpper] [<CommonParameters>]
@@ -22,7 +22,7 @@ Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-Ignore <String>] [-ToUppe
2222
### object
2323

2424
```yaml
25-
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-PropertyName <String>] [-Ignore <String>] [-ToUpper]
25+
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>][-Ignore <String>] [-ToUpper] [-PropertyName <String>]
2626
[<CommonParameters>]
2727
```
2828

@@ -49,7 +49,7 @@ srv1
4949
dc01
5050
5151
app02
52-
52+
5353
5454
5555
PS C:\> get-content c:\scripts\computers.txt | optimize-text
@@ -74,7 +74,6 @@ srv1
7474
quark
7575
dc01
7676
app02
77-
7877
```
7978

8079
Using the same text file, the command creates a custom object using the Computername property.
@@ -134,7 +133,19 @@ The text to be optimized. Typically read in from a file.
134133

135134
```yaml
136135
Type: String[]
137-
Parameter Sets: (All)
136+
Parameter Sets: default
137+
Aliases:
138+
139+
Required: False
140+
Position: 1
141+
Default value: None
142+
Accept pipeline input: True (ByValue)
143+
Accept wildcard characters: False
144+
```
145+
146+
```yaml
147+
Type: String[]
148+
Parameter Sets: object
138149
Aliases:
139150

140151
Required: False
@@ -211,8 +222,7 @@ Accept wildcard characters: False
211222
212223
### CommonParameters
213224
214-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
215-
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
225+
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).
216226
217227
## INPUTS
218228

0 commit comments

Comments
 (0)