Skip to content

Commit c415530

Browse files
v2.18.0
1 parent dcd5e6f commit c415530

33 files changed

+742
-152
lines changed

PSScriptTools.psd1

152 Bytes
Binary file not shown.

README.md

+121-9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,55 @@ Please post any questions, problems or feedback in [Issues](https://github.com/j
2828

2929
## General Tools
3030

31+
### [Get-PSScriptTools](docs/Get-PSScriptTools.md)
32+
33+
You can use this command to get a summary list of functions in this module.
34+
35+
```powershell
36+
37+
PS C:\> Get-PSScriptTools
38+
39+
40+
Verb: Add
41+
42+
Name Alias Synopsis
43+
---- ----- --------
44+
Add-Border Create a text border around a string.
45+
46+
47+
Verb: Compare
48+
49+
Name Alias Synopsis
50+
---- ----- --------
51+
Compare-Module cmo Compare PowerShell module versions.
52+
53+
54+
Verb: Convert
55+
56+
Name Alias Synopsis
57+
---- ----- --------
58+
Convert-CommandtoHashtable Convert a PowerShell expression into a hashtable.
59+
Convert-EventLogRecord clr Convert EventLogRecords to structured objects
60+
Convert-HashtableString Convert a hashtable string into a hashtable object.
61+
Convert-HashTableToCode Convert a hashtable to a string representation.
62+
...
63+
```
64+
65+
Here's another way you could use this command to list functions with defined aliases in the PSScriptTools module.
66+
67+
```powershell
68+
PS C:\> Get-PSScriptTools | Where-object alias | Select-Object Name,alias,Synopsis
69+
70+
Name Alias Synopsis
71+
---- ----- --------
72+
Compare-Module cmo Compare PowerShell module versions.
73+
Convert-EventLogRecord clr Convert EventLogRecords to structured objects
74+
ConvertFrom-Text cft Convert structured text to objects.
75+
ConvertFrom-UTCTime frut Convert a datetime value from universal
76+
ConvertTo-LocalTime clt Convert a foreign time to local
77+
...
78+
```
79+
3180
### [Convert-EventLogRecord](docs/Convert-EventLogRecord.md)
3281

3382
When you use [Get-WinEvent](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent?view=powershell-7&WT.mc_id=ps-gethelp), the results are objects you can work with in PowerShell.
@@ -115,13 +164,43 @@ This example compares modules and send results to `Out-Gridview`. Use `Out-Gridv
115164
This is a PowerShell version of the `winver.exe` utility. This command uses PowerShell remoting to query the registry on a remote machine to retrieve Windows version information.
116165

117166
```powershell
118-
PS C:\> get-windowsversion -Computername srv1,srv2,win10 -Credential company\artd
167+
Computername: WIN10
168+
169+
ProductName EditionID ReleaseID Build InstalledUTC
170+
----------- --------- --------- ----- ------------
171+
Windows 10 Enterprise EnterpriseEval 1903 18362 2/6/2020 5:28:34 PM
172+
Evaluation
173+
174+
175+
Computername: SRV1
176+
177+
ProductName EditionID ReleaseID Build InstalledUTC
178+
----------- --------- --------- ----- ------------
179+
Windows Server 2016 Standard ServerStandardEval 1607 14393 2/6/2020 5:27:42 PM
180+
Evaluation
181+
182+
183+
Computername: SRV2
184+
185+
ProductName EditionID ReleaseID Build InstalledUTC
186+
----------- --------- --------- ----- ------------
187+
Windows Server 2016 Standard ServerStandardEval 1607 14393 2/6/2020 5:28:13 PM
188+
Evaluation
189+
```
190+
191+
The output has a default table view but there are other properties you might want to use.
192+
193+
```powershell
194+
PS C:\> get-windowsversion | Select-object *
195+
119196
120-
ProductName EditionID ReleaseId Build InstalledUTC Computername
121-
----------- --------- --------- ----- ------------ ------------
122-
Windows Server 2016 Standard ServerStandardEval 1607 14393.2273 12/26/2018 4:07:25 PM SRV1
123-
Windows Server 2016 Standard ServerStandardEval 1607 14393.2273 12/26/2018 4:08:07 PM SRV2
124-
Windows 10 Enterprise Evaluat EnterpriseEval 1703 15063.1387 12/26/2018 4:08:11 PM WIN10
197+
ProductName : Windows 10 Pro
198+
EditionID : Professional
199+
ReleaseID : 1909
200+
Build : 18363.657
201+
Branch : 19h1_release
202+
InstalledUTC : 7/5/2019 10:54:49 PM
203+
Computername : BOVINE320
125204
```
126205

127206
#### [Get-WindowsVersionString](docs/Get-WindowsVersionString.md)
@@ -130,7 +209,7 @@ This command is a variation of `Get-WindowsVersion` that returns a formatted str
130209

131210
```powershell
132211
PS C:\> Get-WindowsVersionString
133-
BOVINE320 Windows 10 Pro Version Professional (OS Build 17763.253)
212+
BOVINE320 Windows 10 Pro Version Professional (OS Build 18363.657)
134213
135214
```
136215

@@ -317,7 +396,24 @@ The example is piping objects to ForEach-Object so that Remove-Item can use the
317396

318397
### [Get-FolderSizeInfo](docs/Get-FolderSizeInfo.md)
319398

320-
Use this command to quickly get the size of a folder. You also have an option to include hidden files. The command will measure all files in all subdirectories. The command includes a format file with additional view to display the total size in MB or GB.
399+
Use this command to quickly get the size of a folder. You also have an option to include hidden files. The command will measure all files in all subdirectories.
400+
401+
```powershell
402+
PS C:\> get-foldersizeinfo c:\work
403+
404+
Computername Path TotalFiles TotalSize
405+
------------ ---- ---------- ---------
406+
BOVINE320 C:\work 931 137311146
407+
408+
409+
PS C:\> get-foldersizeinfo c:\work -Hidden
410+
411+
Computername Path TotalFiles TotalSize
412+
------------ ---- ---------- ---------
413+
BOVINE320 C:\work 1375 137516856
414+
```
415+
416+
The command includes a format file with additional view to display the total size in KB, MB or GB.
321417

322418
```powershell
323419
PS C:\> Get-Childitem D:\ -Directory | Get-FolderSizeInfo -Hidden | Where-Object TotalSize -gt 1gb | Sort-Object TotalSize -Descending | format-table -View gb
@@ -336,6 +432,22 @@ BOVINE320 D:\blog 21804
336432
BOVINE320 D:\pstranscripts 122092 1.0914
337433
```
338434

435+
Or you can use the `name` view.
436+
437+
```powershell
438+
PS C:\> Get-Childitem c:\work -Directory | Get-FolderSizeInfo -Hidden | Where-Object {$_.totalsize -ge 2mb} | Format-Table -view name
439+
440+
441+
Path: C:\work
442+
443+
Name TotalFiles TotalKB
444+
---- ---------- -------
445+
A 20 5843.9951
446+
keepass 15 5839.084
447+
PowerShellBooks 26 4240.3779
448+
sunday 47 24540.6523
449+
```
450+
339451
### [Optimize-Text](docs/Optimize-Text.md)
340452

341453
Use this command to clean and optimize content from text files. Sometimes text files have blank lines or the content has trailing spaces. These sorts of issues can cause problems when passing the content to other commands.
@@ -1168,4 +1280,4 @@ You will need to manually install the file.
11681280

11691281
Where possible these commands have been tested with PowerShell 7, but not every platform. If you encounter problems, have suggestions or other feedback, please post an issue. It is assumed you will __not__ be running this commands on any edition of PowerShell Core or any beta releases of PowerShell 7.
11701282

1171-
Last Updated *2020-02-26 15:10:48Z UTC*
1283+
Last Updated *2020-02-27 16:34:43Z UTC*

changelog.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Change Log for PSScriptTools
22

3+
## v2.18.0
4+
5+
+ Fixed missing `ReleaseID` property in `Get-WindowsVersion` (Issue #67)
6+
+ Added `BuildBranch` property to `Get-WindowsVersion`
7+
+ Updated `windowsversion.format.ps1xml` to include new properties and not use Autosize
8+
+ Added `Name` property to output from `Get-FolderSizeInfo` (Issue #66)
9+
+ Added a new table view called `name` for `Get-FolderSizeInfo`
10+
+ Added `Get-PSScriptTools` function to display summary information about commands in this module
11+
+ Added `psscripttools.format.ps1xml` to define a default table view for `Get-PSScriptTools`
12+
+ Help updates
13+
+ Added online help link for `Test-EmptyFolder`
14+
+ Updated `README.md`
15+
316
## v2.17.0
417

518
+ Updated `Get-FolderSizeInfo` to handle directory names like `[data]` (Issue #65)

docs/Convert-EventLogRecord.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Convert EventLogRecords to structured objects
12+
Convert EventLogRecords to structured objects.
1313

1414
## SYNTAX
1515

docs/ConvertFrom-LexicalTimespan.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Convert a lexical timespan into a PowerShell timespan
12+
Convert a lexical timespan into a PowerShell timespan.
1313

1414
## SYNTAX
1515

docs/ConvertFrom-UTCTime.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Convert a datetime value from universal
12+
Convert a datetime value from universal.
1313

1414
## SYNTAX
1515

docs/Convertto-LocalTime.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Convert a foreign time to local
12+
Convert a foreign time to local.
1313

1414
## SYNTAX
1515

docs/Find-CimClass.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Search CIM for a class
12+
Search CIM for a class.
1313

1414
## SYNTAX
1515

docs/Get-FileItem.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
A PowerShell version of the Where CLI command
12+
A PowerShell version of the Where CLI command.
1313

1414
## SYNTAX
1515

docs/Get-FolderSizeInfo.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Get folder size information
12+
Get folder size information.
1313

1414
## SYNTAX
1515

@@ -38,7 +38,6 @@ BOVINE320 D:\temp 48
3838
```powershell
3939
PS C:\> Get-FolderSizeInfo -Path d:\temp -hidden
4040
41-
4241
Computername Path TotalFiles TotalSize
4342
------------ ---- ---------- ---------
4443
BOVINE320 D:\temp 146 125655552
@@ -64,11 +63,28 @@ BOVINE320 D:\BackTemp 2
6463
BOVINE320 D:\rip 3 11.1546
6564
BOVINE320 D:\logs 134 3.9517
6665
BOVINE320 D:\2016 5 1.5608
67-
6866
```
6967

7068
Get the top level directories from D and pipe them to Get-FolderSizeInfo. Items with a total size of greater an 1MB are sorted on the total size and then formatted as a table using a built-in view called MB which formats the total size in MB. There is also a view called GB.
7169

70+
### Example 4
71+
72+
```powershell
73+
PS C:\> Get-Childitem c:\work -Directory | Get-FolderSizeInfo -Hidden | Where-Object {$_.totalsize -ge 2mb} | Format-Table -view name
74+
75+
76+
Path: C:\work
77+
78+
Name TotalFiles TotalKB
79+
---- ---------- -------
80+
A 20 5843.9951
81+
keepass 15 5839.084
82+
PowerShellBooks 26 4240.3779
83+
sunday 47 24540.6523
84+
```
85+
86+
Get all sub-folders under C:\work greater than 2MB in size and display using the Name table view.
87+
7288
## PARAMETERS
7389

7490
### -Hidden
@@ -124,6 +140,6 @@ http://jdhitsolutions.com/blog/essential-powershell-resources/
124140
125141
[Test-EmptyFolder]()
126142
127-
[Get-Childitem]()
143+
[Get-ChildItem]()
128144
129-
[Measure-Object]()
145+
[Measure-Object]()

docs/Get-MyTimeInfo.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Display a time settings for a collection of locations
12+
Display a time settings for a collection of locations.
1313

1414
## SYNTAX
1515

docs/Get-MyVariable.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ schema: 2.0.0
99

1010
## SYNOPSIS
1111

12-
Get all user defined variables
12+
Get all user defined variables.
1313

1414
## SYNTAX
1515

0 commit comments

Comments
 (0)