Skip to content

Commit

Permalink
see changelog for v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Feb 17, 2019
1 parent 6772b11 commit f5cfbed
Show file tree
Hide file tree
Showing 10 changed files with 755 additions and 21 deletions.
Binary file modified PSScriptTools.psd1
Binary file not shown.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,26 @@ PS C:\> get-runspace | where ID -gt 1 | Remove-Runspace

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

## [Get-ParameterInfo](docs/Get-ParameterInfo.md)

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.

```powershell
PS C:\> Get-ParameterInfo -Command Get-Counter -Parameter computername
Name : computername
Aliases : Cn
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.String[]
ParameterSet : __AllParameterSets
```

## Compatibility

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.

*last updated 12 February 2019*
*last updated 17 February 2019*
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log for PSScriptTools

## v2.1.0

+ Added parameter to allow user to specify a type name with `New-PSFormatXML` (Issue #26)
+ Added `Get-ParameterInfo` command with an alias of `gpi`
+ Updated help for `Optimize-Text`
+ Help updates
+ Updated `README.md`

## v2.0.0

+ Added `New-PSFormatXml` and its alias `nfx`
Expand Down
228 changes: 228 additions & 0 deletions docs/Get-ParameterInfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
---
external help file: PSScriptTools-help.xml
Module Name: PSScriptTools
online version:
schema: 2.0.0
---

# Get-ParameterInfo

## SYNOPSIS

Retrieve command parameter information.

## SYNTAX

```yaml
Get-ParameterInfo [-Command] <String> [-Parameter <String>] [<CommonParameters>]
```

## DESCRIPTION

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.

## EXAMPLES

### EXAMPLE 1

```powershell
PS C:\> get-parameterinfo get-service
Name : Name
Aliases : ServiceName
Mandatory : False
Position : 0
ValueFromPipeline : True
ValueFromPipelineByPropertyName : True
Type : System.String[]
ParameterSet : Default
Name : ComputerName
Aliases : Cn
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : True
Type : System.String[]
ParameterSet : __AllParameterSets
Name : DependentServices
Aliases : DS
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.Management.Automation.SwitchParameter
ParameterSet : __AllParameterSets
Name : RequiredServices
Aliases : SDO,ServicesDependedOn
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.Management.Automation.SwitchParameter
ParameterSet : __AllParameterSets
Name : DisplayName
Aliases :
Mandatory : True
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.String[]
ParameterSet : DisplayName
Name : Include
Aliases :
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.String[]
ParameterSet : __AllParameterSets
Name : Exclude
Aliases :
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.String[]
ParameterSet : __AllParameterSets
Name : InputObject
Aliases :
Mandatory : False
Position : Named
ValueFromPipeline : True
ValueFromPipelineByPropertyName : False
Type : System.ServiceProcess.ServiceController[]
ParameterSet : InputObject
```

Return parameter information for Get-Service

### EXAMPLE 2

```powershell
PS C:\> get-parameterinfo mkdir | Select Name,Type,Position,parameterset
Name Type Position ParameterSet
---- ---- -------- ------------
Path System.String[] 0 pathSet
Path System.String[] 0 nameSet
Name System.String Named nameSet
Value System.Object Named __AllParameterSets
Force System.Management.Automation.SwitchParameter Named __AllParameterSets
Credential System.Management.Automation.PSCredential Named __AllParameterSets
UseTransaction System.Management.Automation.SwitchParameter Named __AllParameterSets
```

Get selected parameter information for the mkdir command.

### EXAMPLE 3

```powershell
PS C:\> get-parameterinfo get-ciminstance | sort parameterset | format-table -GroupBy ParameterSet -Property Name,Mandatory,Alias,Position,Type
ParameterSet: __AllParameterSets
Name Mandatory Alias Position Type
---- --------- ----- -------- ----
OperationTimeoutSec False Named System.UInt32
ParameterSet: CimInstanceComputerSet
Name Mandatory Alias Position Type
---- --------- ----- -------- ----
ResourceUri False Named System.Uri
InputObject True 0 Microsoft.Management.Infrastructure.CimInstance
ComputerName False Named System.String[]
ParameterSet: CimInstanceSessionSet
Name Mandatory Alias Position Type
---- --------- ----- -------- ----
CimSession True Named Microsoft.Management.Infrastructure.CimSession[]
InputObject True 0 Microsoft.Management.Infrastructure.CimInstance
ResourceUri False Named System.Uri...
```

Get all parameters from Get-CimInstance and display details as a formatted table.

### Example 4

```powershell
PS C:\> Get-ParameterInfo -Command Get-Counter -Parameter computername
Name : computername
Aliases : Cn
Mandatory : False
Position : Named
ValueFromPipeline : False
ValueFromPipelineByPropertyName : False
Type : System.String[]
ParameterSet : __AllParameterSets
```

Get details on the Computername parameter of the Get-Counter cmdlet.

## PARAMETERS

### -Command

The name of a cmdlet or function. The parameter has an alias of Name.

```yaml
Type: String
Parameter Sets: (All)
Aliases: name

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -Parameter
{{Fill Parameter Description}}
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
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).
## INPUTS
### [string]
## OUTPUTS
### custom object
## NOTES
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
[Get-Command]()
24 changes: 20 additions & 4 deletions docs/New-PSFormatXML.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ Create or modify a format.ps1xml file
## SYNTAX

```yaml
New-PSFormatXML [-InputObject] <Object> [[-Properties] <String[]>] [[-FormatType] <String>]
[[-ViewName] <String>] [-Path] <String> [-Append] [-Passthru] [-WhatIf] [-Confirm] [<CommonParameters>]
New-PSFormatXML [-InputObject] <Object> [[-Properties] <String[]>] [-Typename <String>]
[[-FormatType] <String>] [[-ViewName] <String>] [-Path] <String> [-Append] [-Passthru] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -236,10 +237,25 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Typename
Specify the object typename. If you don't, then the command will use the detected object type from the Inputobject.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
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).
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).
## INPUTS
Expand Down
26 changes: 18 additions & 8 deletions docs/Optimize-Text.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
external help file: PSScriptTools-help.xml
Module Name: psscripttools
Module Name: PSScriptTools
online version:
schema: 2.0.0
---
Expand All @@ -13,7 +13,7 @@ Clean and optimize text input.

## SYNTAX

### Default (Default)
### default (Default)

```yaml
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-Ignore <String>] [-ToUpper] [<CommonParameters>]
Expand All @@ -22,7 +22,7 @@ Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-Ignore <String>] [-ToUppe
### object

```yaml
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>] [-PropertyName <String>] [-Ignore <String>] [-ToUpper]
Optimize-Text [[-Text] <String[]>] [-Filter <Regex>][-Ignore <String>] [-ToUpper] [-PropertyName <String>]
[<CommonParameters>]
```

Expand All @@ -49,7 +49,7 @@ srv1
dc01
app02
PS C:\> get-content c:\scripts\computers.txt | optimize-text
Expand All @@ -74,7 +74,6 @@ srv1
quark
dc01
app02
```

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

```yaml
Type: String[]
Parameter Sets: (All)
Parameter Sets: default
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
```yaml
Type: String[]
Parameter Sets: object
Aliases:

Required: False
Expand Down Expand Up @@ -211,8 +222,7 @@ Accept wildcard characters: False
### CommonParameters
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).
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).
## INPUTS
Expand Down
Loading

0 comments on commit f5cfbed

Please sign in to comment.