Skip to content

Commit a702180

Browse files
updated README with TOC
1 parent 301d422 commit a702180

2 files changed

Lines changed: 82 additions & 62 deletions

File tree

README.md

Lines changed: 81 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22

33
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSScripttools.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSScripttools/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSScripttools.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSScripttools/)
44

5-
This module contains a collection of functions, variables and format files that you can use to enhance your PowerShell scripting work. Or get more done from a PowerShell prompt with less typing. Most of the commands are designed to work cross-platform.
6-
7-
## Current Release
5+
This module contains a collection of functions, variables and format files that you can use to enhance your PowerShell scripting work. Or get more done from a PowerShell prompt with less typing. Most of the commands are designed to work cross-platform. Please post any questions, problems or feedback in [Issues](https://github.com/jdhitsolutions/PSScriptTools/issues). Any input is greatly appreciated.
6+
7+
## Table of Contents
8+
9+
+ [Installation](#Installation)
10+
+ [GeneralTools](#General%20Tools)
11+
+ [File Tools](#File%20Tools)
12+
+ [ToDo](#ToDo)
13+
+ [Graphical Tools](#Graphical%20Tools)
14+
+ [HashTable Tools](#HashTable%20Tools)
15+
+ [Select Functions](#Select%20Functions)
16+
+ [Time Functions](#Time%20Functions)
17+
+ [Console Utilities](#Console%20Utilities)
18+
+ [Format-Functions](#Format-Functions)
19+
+ [Scripting Tools](#Scripting%20Tools)
20+
+ [Other](#Other)
21+
+ [Related Modules](#Related%20Modules)
22+
+ [Compatibility](#Compatibility)
23+
24+
## Installation
825

926
You can get the current release from this repository or install this the PowerShell Gallery:
1027

@@ -18,14 +35,17 @@ or in PowerShell 7:
1835
Install-Module PSScriptTools [-scope CurrentUser]
1936
```
2037

21-
Starting in v2.2.0, the module was restructured to better support `Desktop` and `Core` editions. But starting with version 2.13.0, the module design has reverted. All commands will be exported. Anything that is platform specific should be handled on a per command basis. It is assumed you will be running this module in Windows PowerShell 5.1 or PowerShell 7.
38+
> Starting in v2.2.0, the module was restructured to better support `Desktop` and `Core` editions. But starting with version 2.13.0, the module design has reverted. All commands will be exported. Anything that is platform specific should be handled on a per command basis. It is assumed you will be running this module in Windows PowerShell 5.1 or PowerShell 7.
39+
40+
### Uninstall the Module
41+
42+
To remove the module from your system you can uninstall it.
2243

2344
```powershell
45+
Get-Module PSScriptTools | Remove-Module
2446
Uninstall-Module PSScriptTools -allversions
2547
```
2648

27-
Please post any questions, problems or feedback in [Issues](https://github.com/jdhitsolutions/PSScriptTools/issues). Any input is greatly appreciated.
28-
2949
## General Tools
3050

3151
### [Get-ModuleCommand](docs/Get-ModuleCommand.md)
@@ -614,61 +634,6 @@ The comment will be inserted at the current cursor location.
614634

615635
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.
616636

617-
## [Test-Expression](docs/Test-Expression.md)
618-
619-
The primary command can be used to test a PowerShell expression or scriptblock for a specified number of times and calculate the average runtime, in milliseconds, over all the tests.
620-
621-
### Why
622-
623-
When you run a single test with `Measure-Command` the result might be affected by any number of factors. Likewise, running multiple tests may also be influenced by things such as caching. The goal in this module is to provide a test framework where you can run a test repeatedly with either a static or random interval between each test. The results are aggregated and analyzed. Hopefully, this will provide a more meaningful or realistic result.
624-
625-
### Examples
626-
627-
The output will also show the median and trimmed values as well as some metadata about the current PowerShell session.
628-
629-
```powershell
630-
PS C:\> $cred = Get-credential globomantics\administrator
631-
PS C:\> Test-Expression {param($cred) get-wmiobject win32_logicaldisk -computer chi-dc01 -credential $cred } -argumentList $cred
632-
633-
Tests : 1
634-
TestInterval : 0.5
635-
AverageMS : 1990.6779
636-
MinimumMS : 1990.6779
637-
MaximumMS : 1990.6779
638-
MedianMS : 1990.6779
639-
TrimmedMS :
640-
PSVersion :5.1.17763.134
641-
OS : Microsoft Windows 10 Pro
642-
```
643-
644-
You can also run multiple tests with random time intervals.
645-
646-
```powershell
647-
PS C:\>Test-Expression {param([string[]]$Names) get-service $names} -count 5 -IncludeExpression -argumentlist @('bits','wuauserv','winrm') -RandomMinimum .5 -RandomMaximum 5.5
648-
649-
Tests : 5
650-
TestInterval : Random
651-
AverageMS : 1.91406
652-
MinimumMS : 0.4657
653-
MaximumMS : 7.5746
654-
MedianMS : 0.4806
655-
TrimmedMS : 0.51
656-
PSVersion : 5.1.17763.134
657-
OS : Microsoft Windows 10 Pro
658-
Expression : param([string[]]$Names) get-service $names
659-
Arguments : {bits, wuauserv, winrm}
660-
```
661-
662-
For very long running tests, you can run them as a background job.
663-
664-
### Graphical Testing
665-
666-
The module also includes a graphical command called `Test-ExpressionForm`. This is intended to serve as both an entry and results form.
667-
668-
![Test Expression](images/testexpressionform.png)
669-
670-
When you quit the form the last result will be written to the pipeline including all metadata, the scriptblock and any arguments.
671-
672637
## Graphical Tools
673638

674639
### [Invoke-InputBox](docs/Invoke-InputBox.md)
@@ -1245,6 +1210,61 @@ TotalMemGB FreeMemGB PctFree
12451210

12461211
## Scripting Tools
12471212

1213+
### [Test-Expression](docs/Test-Expression.md)
1214+
1215+
The primary command can be used to test a PowerShell expression or scriptblock for a specified number of times and calculate the average runtime, in milliseconds, over all the tests.
1216+
1217+
#### Why
1218+
1219+
When you run a single test with `Measure-Command` the result might be affected by any number of factors. Likewise, running multiple tests may also be influenced by things such as caching. The goal in this module is to provide a test framework where you can run a test repeatedly with either a static or random interval between each test. The results are aggregated and analyzed. Hopefully, this will provide a more meaningful or realistic result.
1220+
1221+
#### Examples
1222+
1223+
The output will also show the median and trimmed values as well as some metadata about the current PowerShell session.
1224+
1225+
```powershell
1226+
PS C:\> $cred = Get-credential globomantics\administrator
1227+
PS C:\> Test-Expression {param($cred) get-wmiobject win32_logicaldisk -computer chi-dc01 -credential $cred } -argumentList $cred
1228+
1229+
Tests : 1
1230+
TestInterval : 0.5
1231+
AverageMS : 1990.6779
1232+
MinimumMS : 1990.6779
1233+
MaximumMS : 1990.6779
1234+
MedianMS : 1990.6779
1235+
TrimmedMS :
1236+
PSVersion :5.1.17763.134
1237+
OS : Microsoft Windows 10 Pro
1238+
```
1239+
1240+
You can also run multiple tests with random time intervals.
1241+
1242+
```powershell
1243+
PS C:\>Test-Expression {param([string[]]$Names) get-service $names} -count 5 -IncludeExpression -argumentlist @('bits','wuauserv','winrm') -RandomMinimum .5 -RandomMaximum 5.5
1244+
1245+
Tests : 5
1246+
TestInterval : Random
1247+
AverageMS : 1.91406
1248+
MinimumMS : 0.4657
1249+
MaximumMS : 7.5746
1250+
MedianMS : 0.4806
1251+
TrimmedMS : 0.51
1252+
PSVersion : 5.1.17763.134
1253+
OS : Microsoft Windows 10 Pro
1254+
Expression : param([string[]]$Names) get-service $names
1255+
Arguments : {bits, wuauserv, winrm}
1256+
```
1257+
1258+
For very long running tests, you can run them as a background job.
1259+
1260+
#### Graphical Testing
1261+
1262+
The module also includes a graphical command called `Test-ExpressionForm`. This is intended to serve as both an entry and results form.
1263+
1264+
![Test Expression](images/testexpressionform.png)
1265+
1266+
When you quit the form the last result will be written to the pipeline including all metadata, the scriptblock and any arguments.
1267+
12481268
### [Copy-HelpExample](docs/Copy-HelpExample.md)
12491269

12501270
This command is designed to make it (slightly) easier to copy code snippets from help examples. Specify the name of a function or cmdlet, presumably one with documented help examples, and you will be offered a selection of code snippets to copy to the clipboard. Code snippets have been trimmed of blank lines, most prompts, and comments. Many examples include output. You will have to manually remove what you don't want after pasting.

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Change Log for PSScriptTools
1+
# ChangeLog for PSScriptTools
22

33
## v2.26.0
44

0 commit comments

Comments
 (0)