Skip to content

Commit 751f7c5

Browse files
revised help
1 parent 60fe978 commit 751f7c5

19 files changed

+1183
-270
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ You can use the menu or keyboard shortcut which will launch an input box.
202202

203203
The comment will be inserted at the current cursor location.
204204
In VS Code, access the command palette (Ctrl+Shift+P) and then "PowerShell: Show Additional Commands from PowerShell Modules". Select "Insert ToDo" from the list and you'll get the same input box. Note that this will only work for PowerShell files.
205+
205206
### Compatibility
206207
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.
207208

Utilities.ps1

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,7 @@
11

22

33
Function Get-PowerShellEngine {
4-
<#
5-
.Synopsis
6-
Get the path to the current PowerShell engine
7-
.Description
8-
Use this command to find the path to the PowerShell executable, or engine that is running your current session. The path for PowerShell 6 is different than previous versions.
94

10-
The default is to provide the path only. But you can also get detailed information
11-
.Parameter Detail
12-
Include additional information. Not all properties may have values depending on operating system and PowerShell version.
13-
.Example
14-
PS C:\> Get-PowerShellEngine
15-
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
16-
.Example
17-
PS C:\> Get-PowerShellEngine -detail
18-
19-
Path : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
20-
FileVersion : 10.0.15063.0 (WinBuild.160101.0800)
21-
PSVersion : 5.1.15063.502
22-
ProductVersion : 10.0.15063.0
23-
Edition : Desktop
24-
Host : Visual Studio Code Host
25-
Culture : en-US
26-
Platform :
27-
28-
Result from running in the Visual Studio Code integrated PowerShell terminal
29-
30-
.Example
31-
PS C:\> Get-PowerShellEngine -detail
32-
33-
Path : C:\Program Files\PowerShell\6.0.0-beta.5\powershell.exe
34-
FileVersion :
35-
PSVersion : 6.0.0-beta
36-
ProductVersion :
37-
Edition : Core
38-
Host : ConsoleHost
39-
Culture : en-US
40-
Platform : Win32NT
41-
42-
Result from running in a PowerShell 6 session on Windows 10
43-
44-
.Example
45-
PS /home/> get-powershellengine -Detail
46-
47-
Path : /opt/microsoft/powershell/6.0.0-beta.5/powershell
48-
FileVersion :
49-
PSVersion : 6.0.0-beta
50-
ProductVersion :
51-
Edition : Core
52-
Host : ConsoleHost
53-
Culture : en-US
54-
Platform : Unix
55-
56-
Result from running in a PowerShell session on Linux
57-
58-
.Link
59-
$PSVersionTable
60-
.Link
61-
$Host
62-
.Link
63-
Get-Process
64-
65-
.Outputs
66-
[string]
67-
[pscustomobject]
68-
#>
695
[CmdletBinding()]
706
Param([switch]$Detail)
717

@@ -89,46 +25,6 @@ Function Get-PowerShellEngine {
8925
}
9026

9127
Function Out-More {
92-
<#
93-
.Synopsis
94-
Send "pages" of objects to the pipeline.
95-
.Description
96-
This function is designed to display groups or "pages" of objects to the PowerShell pipeline. It is modeled after the legacy More.com command line utility.
97-
By default the command will write out objects out to the pipeline in groups of 50. You will be prompted after each grouping. Pressing M or Enter will get the next group. Pressing A will stop paging and display all of the remaining objects. Pressing N will display the next object. Press Q to stop writing anything else to the pipeline.
98-
.Parameter ClearScreen
99-
Clear the screen prior to writing data to the pipeline. This parameter has an alias of cls.
100-
.Parameter Count
101-
The number of objects to group together in a page. This parameter has an alias of i.
102-
.Example
103-
PS C:\> get-process | out-more -count 10
104-
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id SI ProcessName
105-
------- ------ ----- ----- ----- ------ -- -- -----------
106-
1031 75 122588 81092 841 31.30 1872 1 BoxSync
107-
57 3 488 968 12 0.02 1068 1 BoxSyncMonitor
108-
103 9 1448 4220 67 0.02 1632 0 BtwRSupportService
109-
80 9 3008 8588 ...27 21.00 5192 1 conhost
110-
40 5 752 2780 ...82 0.00 5248 0 conhost
111-
53 7 972 3808 ...07 0.02 6876 1 conhost
112-
482 17 1932 3692 56 0.91 708 0 csrss
113-
520 30 2488 134628 180 31.67 784 1 csrss
114-
408 18 6496 12436 ...35 0.56 1684 0 dasHost
115-
180 14 3348 6748 66 0.50 4688 0 devmonsrv
116-
[M]ore [A]ll [N]ext [Q]uit
117-
Display processes in groups of 10.
118-
.Example
119-
PS C:\> dir c:\work -file -Recurse | out-more -ClearScreen | tee -Variable work
120-
List all files in C:\Work and page them to Out-More using the default count, but after clearing the screen first.
121-
The results are then piped to Tee-Object which saves them to a variable.
122-
.Notes
123-
Learn more about PowerShell:
124-
http://jdhitsolutions.com/blog/essential-powershell-resources/
125-
.Link
126-
http://jdhitsolutions.com/blog/powershell/4707/a-better-powershell-more/
127-
.Inputs
128-
System.Object[]
129-
.Outputs
130-
System.Object
131-
#>
13228

13329
[cmdletbinding()]
13430
Param(

docs/Add-Border.md

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ Create a text border around a string.
1414

1515
### single (Default)
1616
```
17-
Add-Border [-Text] <String> [-Character <String>] [-InsertBlanks] [-Tab <Int32>]
17+
Add-Border [-Text] <String> [-Character <String>] [-InsertBlanks] [-Tab <Int32>] [<CommonParameters>]
1818
```
1919

2020
### block
2121
```
22-
Add-Border [-TextBlock] <String[]> [-Character <String>] [-InsertBlanks] [-Tab <Int32>]
22+
Add-Border [-TextBlock] <String[]> [-Character <String>] [-InsertBlanks] [-Tab <Int32>] [<CommonParameters>]
2323
```
2424

2525
## DESCRIPTION
@@ -28,25 +28,27 @@ You might use this to create a formatted text report or to improve the display o
2828

2929
## EXAMPLES
3030

31-
### Example 1
31+
### EXAMPLE 1
3232
```
3333
PS C:\> add-border "PowerShell Wins!"
3434
3535
********************
3636
* PowerShell Wins! *
3737
********************
3838
```
39-
### Example 2
39+
40+
### EXAMPLE 2
4041
```
4142
PS C:\> add-border "PowerShell Wins!" -tab 1
4243
4344
********************
4445
* PowerShell Wins! *
4546
********************
4647
```
47-
Note that this example may not format properly in the console.
4848

49-
### Example 3
49+
Note that this EXAMPLE may not format properly in the console.
50+
51+
### EXAMPLE 3
5052
```
5153
PS C:\> add-border "PowerShell Wins!" -character "-" -insertBlanks
5254
@@ -57,7 +59,7 @@ PS C:\> add-border "PowerShell Wins!" -character "-" -insertBlanks
5759
--------------------
5860
```
5961

60-
### Example 4
62+
### EXAMPLE 4
6163
```
6264
PS C:\> add-border -textblock (get-service win* | out-string).trim()
6365
@@ -70,10 +72,42 @@ PS C:\> add-border -textblock (get-service win* | out-string).trim()
7072
* Stopped WinRM Windows Remote Management (WS-Manag... *
7173
**********************************************************************
7274
```
75+
7376
Create a border around the output of a Get-Service command.
7477

7578
## PARAMETERS
7679

80+
### -Text
81+
A single line of text that will be wrapped in a border.
82+
83+
```yaml
84+
Type: String
85+
Parameter Sets: single
86+
Aliases:
87+
88+
Required: True
89+
Position: 1
90+
Default value: None
91+
Accept pipeline input: True (ByValue)
92+
Accept wildcard characters: False
93+
```
94+
95+
### -TextBlock
96+
A multiline block of text.
97+
You might want to trim blank lines from the beginning, end or both.
98+
99+
```yaml
100+
Type: String[]
101+
Parameter Sets: block
102+
Aliases:
103+
104+
Required: True
105+
Position: 1
106+
Default value: None
107+
Accept pipeline input: False
108+
Accept wildcard characters: False
109+
```
110+
77111
### -Character
78112
The character to use for the border. It must be a single character.
79113
@@ -119,42 +153,19 @@ Accept pipeline input: False
119153
Accept wildcard characters: False
120154
```
121155
122-
### -Text
123-
A single line of text that will be wrapped in a border.
124-
125-
```yaml
126-
Type: String
127-
Parameter Sets: single
128-
Aliases:
129-
130-
Required: True
131-
Position: 1
132-
Default value: None
133-
Accept pipeline input: True (ByValue)
134-
Accept wildcard characters: False
135-
```
136-
137-
### -TextBlock
138-
A multiline block of text.
139-
You might want to trim blank lines from the beginning, end or both.
140-
141-
```yaml
142-
Type: String[]
143-
Parameter Sets: block
144-
Aliases:
145-
146-
Required: True
147-
Position: 1
148-
Default value: None
149-
Accept pipeline input: False
150-
Accept wildcard characters: False
151-
```
156+
### CommonParameters
157+
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).
152158
153159
## INPUTS
160+
154161
### None
162+
155163
## OUTPUTS
164+
156165
### System.String
166+
157167
## NOTES
158168
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
169+
159170
## RELATED LINKS
160171

docs/Copy-Command.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Copy a PowerShell command.
1414

1515
```
1616
Copy-Command [-Command] <String> [[-NewName] <String>] [-IncludeDynamic] [-AsProxy] [-UseForwardHelp]
17+
[<CommonParameters>]
1718
```
1819

1920
## DESCRIPTION
@@ -23,21 +24,21 @@ For best results, run this in the PowerShell ISE of Visual Studio code, the copi
2324

2425
## EXAMPLES
2526

26-
### Example 1
27+
### EXAMPLE 1
2728
```
2829
PS C:\> Copy-Command Get-Process Get-MyProcess
2930
```
3031

3132
Create a copy of Get-Process called Get-MyProcess.
3233

33-
### Example 2
34+
### EXAMPLE 2
3435
```
3536
PS C:\> Copy-Command Get-Eventlog -asproxy -useforwardhelp
3637
```
3738

3839
Create a proxy function for Get-Eventlog and use forwarded help links.
3940

40-
### Example 3
41+
### EXAMPLE 3
4142
```
4243
PS C:\> Copy-Command Get-ADComputer Get-MyADComputer -includedynamic
4344
```
@@ -121,6 +122,9 @@ Accept pipeline input: False
121122
Accept wildcard characters: False
122123
```
123124
125+
### CommonParameters
126+
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).
127+
124128
## INPUTS
125129
126130
### None

docs/Format-Percent.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,29 @@ Format a value as a percentage.
1414

1515
### None (Default)
1616
```
17-
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>]
17+
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>] [<CommonParameters>]
1818
```
1919

2020
### String
2121
```
22-
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>] [-AsString]
22+
Format-Percent [-Value] <Object> [-Total] <Object> [-Decimal <Int32>] [-AsString] [<CommonParameters>]
2323
```
2424

2525
## DESCRIPTION
2626
This command calculates a percentage of a value from a total, with the formula (value/total)*100. The default is to return a value to 2 decimal places but you can configure that with -Decimal. There is also an option to format the percentage as a string which will include the % symbol.
2727

2828
## EXAMPLES
2929

30-
### Example 1
30+
### EXAMPLE 1
3131
```
3232
PS C:\> Format-Percent -value 1234.567 -total 5000 -decimal 4
3333
3434
24.6913
3535
```
36+
3637
Calculate a percentage from 1234.567 out of 5000 (i.e. 1234.567/5000) to 4 decimal points.
3738

38-
### Example 2
39+
### EXAMPLE 2
3940
```
4041
PS C:\> get-ciminstance win32_operatingsystem -computer chi-dc04 | select PSComputername,TotalVisibleMemorySize,@{Name="PctFreeMem";Expression={ Format-Percent $_.FreePhysicalMemory $_.TotalVisibleMemorySize}}
4142
@@ -44,14 +45,15 @@ PSComputerName TotalVisibleMemorySize PctFreeMem
4445
chi-dc04 1738292 23.92
4546
```
4647

47-
### Example 3
48+
### EXAMPLE 3
4849
```
4950
PS C:\> get-ciminstance win32_operatingsystem -computer chi-dc04 | select PSComputername,TotalVisibleMemorySize,@{Name="PctFreeMem";Expression={ Format-Percent $_.FreePhysicalMemory $_.TotalVisibleMemorySize -asString}}
5051
5152
PSComputerName TotalVisibleMemorySize PctFreeMem
5253
-------------- ---------------------- ----------
5354
chi-dc04 1738292 23.92%
5455
```
56+
5557
## PARAMETERS
5658

5759
### -Value
@@ -114,6 +116,9 @@ Accept pipeline input: False
114116
Accept wildcard characters: False
115117
```
116118
119+
### CommonParameters
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).
121+
117122
## INPUTS
118123
119124
### System.Object

0 commit comments

Comments
 (0)