Skip to content

Commit 8c45102

Browse files
v3.1.0 updates
1 parent 03b248e commit 8c45102

43 files changed

Lines changed: 1556 additions & 873 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PSScriptTools.psd1

190 Bytes
Binary file not shown.

PSScriptTools.psm1

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ if ($psEditor) {
115115
Register-EditorCommand @rParams
116116

117117
Write-Verbose 'Adding Set-LocationToFile'
118+
# 8 July 2026 Revised to only support VS Code
119+
#set location to directory of current file
118120
Function Set-LocationToFile {
119-
#set location to directory of current file
120121
[CmdletBinding()]
121122
[alias('sd', 'jmp')]
122123
[OutputType('none')]
123124
Param ()
124125

125126
if ($host.name -match 'Code') {
126-
127127
$context = $psEditor.GetEditorContext()
128128
$ThisPath = $context.CurrentFile.Path
129129
$target = Split-Path -Path $ThisPath
@@ -138,24 +138,23 @@ if ($psEditor) {
138138
}
139139
}
140140
} #VSCode
141-
elseif ($psISE) {
142-
Write-Verbose 'Defining ISE additions'
143-
144-
if ($psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.DisplayName -NotContains 'ToDo') {
145-
146-
$action = {
147-
$prompt = 'What do you need to do?'
148-
$title = 'To Do'
149-
$item = Invoke-InputBox -Title $title -Prompt $prompt
150-
$todo = "# [$(Get-Date)] TODO: $item"
151-
$psISE.CurrentFile.Editor.InsertText($todo)
152-
#jump cursor to the end
153-
$psISE.CurrentFile.editor.SetCaretPosition($psISE.CurrentFile.Editor.CaretLine, $psISE.CurrentFile.Editor.CaretColumn)
154-
}
155-
#add the action to the Add-Ons menu
156-
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('ToDo', $Action, 'Ctrl+Alt+2' ) | Out-Null
141+
elseif ($psISE) {
142+
Write-Verbose 'Defining ISE additions'
143+
144+
if ($psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.DisplayName -NotContains 'ToDo') {
145+
146+
$action = {
147+
$prompt = 'What do you need to do?'
148+
$title = 'To Do'
149+
$item = Invoke-InputBox -Title $title -Prompt $prompt
150+
$todo = "# [$(Get-Date)] TODO: $item"
151+
$psISE.CurrentFile.Editor.InsertText($todo)
152+
#jump cursor to the end
153+
$psISE.CurrentFile.editor.SetCaretPosition($psISE.CurrentFile.Editor.CaretLine, $psISE.CurrentFile.Editor.CaretColumn)
154+
}
155+
#add the action to the Add-Ons menu
156+
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('ToDo', $Action, 'Ctrl+Alt+2' ) | Out-Null
157157
}
158-
159158
Function Set-LocationToFile {
160159
[cmdletbinding()]
161160
[alias('sd', 'jmp')]

README.md

Lines changed: 88 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ User Jeff C:\Program Files (x86)\Vale\ True
606606
...
607607
```
608608

609+
Paths that no longer exist will be displayed in red. This command has an alias of `Get-Path`.
610+
609611
## File Tools
610612

611613
### [Get-LastModifiedFile](docs/Get-LastModifiedFile.md)
@@ -1536,7 +1538,7 @@ Set the title bar of the current PowerShell console window.
15361538
```powershell
15371539
if (Test-IsAdministrator) {
15381540
Set-ConsoleTitle "Administrator: $($PSVersionTable.PSVersion)"
1539-
}
1541+
}
15401542
```
15411543

15421544
### [Add-Border](docs/Add-Border.md)
@@ -1764,6 +1766,51 @@ System.Int32 width
17641766
System.Int32 height
17651767
```
17661768

1769+
### [Show-HiddenMember](docs/Show-HiddenMember.md)
1770+
1771+
By design, PowerShell will hide parts of an object that have very little relevance to scripting or interactive PowerShell use. Often, these are .NET properties and methods that are automatically added. You can see them using Get-Member -Force. This command is designed to simplify the process.
1772+
1773+
```dos
1774+
PS C:\> "powershell" | Show-HiddenMember
1775+
1776+
Type: System.String
1777+
1778+
Name MemberType
1779+
---- ----------
1780+
pstypenames CodeProperty
1781+
psadapted MemberSet
1782+
psbase MemberSet
1783+
psextended MemberSet
1784+
psobject MemberSet
1785+
get_Chars Method
1786+
get_Length Method
1787+
```
1788+
1789+
This command is especially useful with custom commands.
1790+
1791+
```dos
1792+
PS C:\> Get-PSWorkItem | Show-HiddenMember -MemberType Property
1793+
1794+
Type: PSWorkItem
1795+
1796+
Name MemberType
1797+
---- ----------
1798+
TaskID Property
1799+
```
1800+
1801+
The `Get-PSWorkItem` command is from the [PSWorkItem](https://github.com/jdhitsolutions/PSWorkitem)module. It uses a custom class. `Show-HiddenMember` reveals a hidden property. Once you know the name, you can use it.
1802+
1803+
```dos
1804+
PS C:\> Get-PSWorkItem | Select-Object TaskID,Due
1805+
1806+
TaskID Due
1807+
------ ---
1808+
4bad9e29-a5a9-4a16-aa9b-f180995e298a 12/31/2025 5:00:00 PM
1809+
d8fdba1f-e046-429a-8225-9cbbe927e366 6/18/2026 7:26:08 AM
1810+
226022de-4c91-4014-985e-34ee18ce0eda 6/26/2026 6:40:00 AM
1811+
...
1812+
```
1813+
17671814
### [New-PSDynamicParameter](docs/New-PSDynamicParameter.md)
17681815

17691816
This command will create the code for a dynamic parameter that you can insert into your PowerShell script file. You need to specify a parameter name and a condition. The condition value is code that would run inside an If statement. Use a value like $True if you want to add it later in your scripting editor.
@@ -2070,6 +2117,8 @@ Copy-HelpExample Stop-Service -UseGridView
20702117

20712118
If you are running this in the PowerShell ISE this is the default behavior, even if you don't specify the parameter.
20722119

2120+
> _This command makes its best guess at identifying code samples in the help content. If the help is malformed or deviates from the expected norm, you might not see any help examples._
2121+
20732122
### [Get-GitSize](docs/Get-GitSize.md)
20742123

20752124
Use this command to determine how much space the hidden `.git` folder is consuming.
@@ -2129,20 +2178,17 @@ When writing PowerShell commands, sometimes the culture you are running under be
21292178

21302179
```dos
21312180
PS C:\> Test-WithCulture fr-fr -Scriptblock {
2132-
Get-winEvent -log system -max 500 |
2133-
Select-Object -Property TimeCreated,ID,OpCodeDisplayName,Message |
2134-
Sort-Object -property TimeCreated |
2135-
Group-Object {$_.TimeCreated.ToShortDateString()} -NoElement}
2181+
Get-winEvent -log system -max 500 |
2182+
Select-Object -Property TimeCreated,ID,OpCodeDisplayName,Message |
2183+
Sort-Object -property TimeCreated |
2184+
Group-Object {$_.TimeCreated.ToShortDateString()} -NoElement
2185+
}
21362186
21372187
Count Name
21382188
----- ----
2139-
165 10/07/2024
2140-
249 11/07/2024
2141-
17 12/07/2024
2142-
16 13/07/2024
2143-
20 14/07/2024
2144-
26 15/07/2024
2145-
7 16/07/2024
2189+
22 06/07/2026
2190+
371 07/07/2026
2191+
107 08/07/2026
21462192
```
21472193

21482194
### [Copy-Command](docs/Copy-Command.md)
@@ -2188,7 +2234,7 @@ The custom object looks like this by default:
21882234
PS C:\> $obj
21892235
21902236
Name : Jeff
2191-
Date : 2/10/2024 8:49:10 PM
2237+
Date : 2/10/2026 8:49:10 PM
21922238
Computername : BOVINE320
21932239
OS : Microsoft Windows 10 Pro
21942240
Runtime : 40.20:49:43.9205882
@@ -2224,7 +2270,7 @@ PS C:\> $obj
22242270
22252271
Name Date Computername Operating System
22262272
---- ---- ------------ ----------------
2227-
Jeff 2/10/2024 8:49:10 PM BOVINE320 Microsoft Windows 10 Pro
2273+
Jeff 2/10/2026 8:49:10 PM BOVINE320 Microsoft Windows 10 Pro
22282274
22292275
PS C:\> $obj | Format-Table -View runtime
22302276
@@ -2236,7 +2282,7 @@ PS C:\> $obj | Format-List
22362282
22372283
22382284
Name : Jeff
2239-
Date : Sunday, February 10, 2024
2285+
Date : Sunday, February 10, 2026
22402286
Computername : BOVINE320
22412287
OperatingSystem : Microsoft Windows 10 Pro
22422288
Runtime : 40.21:12:01
@@ -2292,7 +2338,13 @@ PS C:\> Save-GitSetup -Path c:\work -PassThru
22922338
22932339
Mode LastWriteTime Length Name
22942340
---- ------------- ------ ----
2295-
-a--- 1/23/2024 4:31 PM 46476880 Git-2.25.0-64-bit.exe
2341+
-a--- 7/8/2026 11:49 AM 65449488 Git-2.55.0.2-64-bit.exe
2342+
```
2343+
2344+
You can also opt to download the ARM64 standalone installer.
2345+
2346+
```powershell
2347+
Save-GitSetup -Path D:\temp -ARM64
22962348
```
22972349

22982350
You will need to manually install the file. Or you can try something like this:
@@ -2350,7 +2402,7 @@ Root\PEH
23502402

23512403
### [Get-CimClassList](docs/Get-CimClassList.md)
23522404

2353-
Sometimes `Get-CimClass` is overkill when all you want is a list of class names under a given namespace. `Get-CimClassList` is designed to quickly give you a list of class names. You can filter by name and exclude.
2405+
Sometimes `Get-CimClass` is overkill when all you want is a list of class names under a given namespace. `Get-CimClassList` is designed to quickly give you a list of class names. You can filter by name and exclude names.
23542406

23552407
```dos
23562408
PS C:\> Get-CimClassListing *usb* -Exclude cim*
@@ -2462,7 +2514,7 @@ read True Boolean EnableOverride, ToSubclass
24622514

24632515
## ANSI Tools
24642516

2465-
Note: ANSI tools related to the filesystem are not loaded on computers where `PSStyle` is detected.
2517+
Note: ANSI tools related to the filesystem are not loaded on computers when `$PSStyle` is detected.
24662518

24672519
This module includes several custom format files for common objects like services. You can run `Get-Service` and pipe it to the custom table view.
24682520

@@ -2750,13 +2802,13 @@ You also have new script properties
27502802
PS C:\> Get-ChildItem C:\Scripts\SharedProfileDefault.ps1 | Select-Object Name,Size,SizeKB,SizeMB,Created,CreatedAge,Modified,ModifiedAge
27512803
27522804
Name : SharedProfileDefault.ps1
2753-
Size : 3288
2754-
SizeKB : 3.21
2805+
Size : 4424
2806+
SizeKB : 4.32
27552807
SizeMB : 0
2756-
Created : 8/17/2023 8:47:13 AM
2757-
CreatedAge : 586.05:33:54.5461727
2758-
Modified : 3/21/2025 9:29:40 AM
2759-
ModifiedAge : 4.04:51:27.6225204
2808+
Created : 4/6/2025 6:02:07 PM
2809+
CreatedAge : 457.21:18:59.7209014
2810+
Modified : 3/13/2026 5:08:16 PM
2811+
ModifiedAge : 116.22:12:50.2662403
27602812
```
27612813

27622814
There is also a custom property set.
@@ -2766,9 +2818,9 @@ PS C:\> Get-ChildItem C:\Scripts\SharedProfileDefault.ps1 | Select-Object AgeInf
27662818
27672819
Directory : C:\Scripts
27682820
Name : SharedProfileDefault.ps1
2769-
Size : 3288
2770-
LastWriteTime : 3/21/2025 9:29:40 AM
2771-
ModifiedAge : 4.04:52:29.3136140
2821+
Size : 4424
2822+
LastWriteTime : 3/13/2026 5:08:16 PM
2823+
ModifiedAge : 116.22:13:10.6561017
27722824
```
27732825

27742826
#### System.Diagnostics.Process
@@ -2788,7 +2840,7 @@ Select-Object -first 5 -Property ID,Name,Runtime
27882840
820 csrss 20:44:44.7760844
27892841
```
27902842

2791-
The Idle process will have a null value for this property.
2843+
The Idle process will have a null value for the Runtime property.
27922844

27932845
#### Microsoft.PowerShell.Commands.GenericMeasureInfo
27942846

@@ -2844,10 +2896,15 @@ I've created a PDF version of this document which I thought you might find usefu
28442896

28452897
## Deprecated Commands
28462898

2847-
The following commands have been removed as of v2.50.0.
2899+
The following commands have been removed as of v2.50.0:
2900+
2901+
- Set-ConsoleColor
2902+
- Out-ConditionalColor
2903+
- ConvertTo-ASCIIArt
2904+
2905+
The following commands have been removed as of v3.1.0:
28482906

2849-
- [Set-ConsoleColor](docs/Set-ConsoleColor.md)
2850-
- [Out-ConditionalColor](docs/Out-ConditionalColor.md)
2907+
- Write-Detail
28512908

28522909
## Related Modules
28532910

File renamed without changes.
Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,5 @@ Function Write-Detail {
3737

3838
} #close Write-Detail
3939

40-
Function Out-VerboseTee {
41-
[CmdletBinding()]
42-
[alias("tv", "Tee-Verbose")]
43-
Param(
44-
[Parameter(Mandatory, ValueFromPipeline)]
45-
[object]$Value,
46-
[Parameter(Position = 0, Mandatory)]
47-
[string]$Path,
48-
[System.Text.Encoding]$Encoding,
49-
[switch]$Append
50-
)
51-
Begin {
52-
#turn on verbose pipeline since if you are running this command you intend for it to be on
53-
$VerbosePreference = "continue"
54-
}
55-
Process {
56-
#only run if Verbose is turned on
57-
if ($VerbosePreference -eq "continue") {
58-
$Value | Out-String | Write-Verbose
59-
[void]$PSBoundParameters.Remove("Append")
60-
if ($Append) {
61-
Add-Content @PSBoundParameters
62-
}
63-
else {
64-
Set-Content @PSBoundParameters
65-
}
66-
}
67-
}
68-
End {
69-
$VerbosePreference = "SilentlyContinue"
70-
}
71-
} #close Out-VerboseTee
40+
7241

archive/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Files that are no longer part of the module
1+
Files that are no longer part of the module but retained for reference or historical purposes.

changelog.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ This file contains the most recent change history for the PSScriptTools module.
44

55
## [Unreleased]
66
### Added
7+
- Added an alias of `Get-Path` to `Get-PathVariable`.
8+
- Added a parameter to `Get-ParameterInfo` to show parameters by parameter set.
9+
- Added command `Show-HiddenMember`.
710
- Added the parameter `NoComments` to `New-PSFormatXml` to suppress the default helper comments.
811
- Added a parameter alias `Property` for `Properties` in `New-PSFormatXML`.
9-
- Added a parameter alias `Property` for `Properties` in `New-PSFormatXML`.
1012
- Added alias `isAdmin` to `Test-IsElevated`.
1113

1214
### Changed
13-
- Updated `Convert-CommandToHashTable` to better handle a hashtable as a paremeter value.
15+
- Updated formatting for `Get-PathVariable` to highlight paths that don't exist in red.
16+
- Updates to sample script files.
17+
- Updated `Save-GitSetup` to support downloading the ARM64 standalone setup file.
18+
- Updated warning in `Get-TypeConstructor` to use type full name.
19+
- Minor formatting update for `Get-TypeConstructor`.
20+
- Updated `Convert-CommandToHashTable` to better handle a hashtable as a parameter value.
1421
- Updated `ConvertTo-Hashtable` to using PSObject` to get property names.
1522
- Updated `ConvertTo-Hashtable` to make an alphabetically sorted hashtable an ordered hashtable.
1623
- Updated `Convert-HashtableToCode` to accept a standard or ordered hashtable as input.
@@ -28,9 +35,15 @@ This file contains the most recent change history for the PSScriptTools module.
2835
- Help updates.
2936
- Replaced bit.ly online help links.
3037

38+
### Removed
39+
- Marked `Write-Detail` as deprecated and archived. __This might be a breaking change__
40+
3141
### Fixed
42+
- Updated `Copy-HelpExample` to better handle changes in PowerShell 7 help.
43+
- Corrected download link in `Save-GitSetup`.
44+
- Fixed bug in formatting output from `Get-TypeConstructor`.
3245
- Fixed bug in `Get-ModuleCommand` that failed to retrieve all command aliases.
33-
- Fixed error in DirectoryStat sizeKB format view that wasn't showing values in KB
46+
- Fixed error in DirectoryStat sizeKB format view that wasn't showing values in KB.
3447

3548
## [3.0.0] - 2025-03-26
3649

docs/Copy-HelpExample.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Copy-HelpExample [-Name] <String> [-Path <String>] [-UseGridView]
2222

2323
This command is intended to make it easier to copy code snippets from help examples to the clipboard. You can select one or more examples which have been trimmed of comments, blank lines and most prompts. Some code examples contain the output or have several lines of code. You will need to manually delete what you don't want. If this command is run on a Windows system you have a dynamic parameter to use Out-GridView to display your choices. When prompted enter a comma-separated list of the examples you wish to copy. Otherwise, the command will display a console-based menu. Note that if you are using the PowerShell ISE you will be forced to use Out-GridView.
2424

25+
This command makes its best guess at identifying code samples in the help content. If the help is malformed or deviates from the expected norm, you might not see any help examples
26+
2527
## EXAMPLES
2628

2729
### Example 1

0 commit comments

Comments
 (0)