Skip to content

Commit 81978ed

Browse files
v2.15.0
1 parent d2bac44 commit 81978ed

18 files changed

+1008
-330
lines changed

PSScriptTools.psd1

232 Bytes
Binary file not shown.

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ User : BOVINE320\Jeff
215215
Elevated : True
216216
Computername : BOVINE320
217217
OperatingSystem : Microsoft Windows 10 Pro [64-bit]
218-
OSVersion : 10.0.17763
219-
PSVersion : 5.1.17763.134
218+
OSVersion : 10.0.18363
219+
PSVersion : 5.1.18362.145
220220
Edition : Desktop
221221
PSHost : ConsoleHost
222222
WSMan : 3.0
223223
ExecutionPolicy : RemoteSigned
224-
Culture : en-US
224+
Culture : English (United States)
225225
```
226226

227227
### [Find-CimClass](docs/Find-CimClass.md)
@@ -294,6 +294,27 @@ Results will vary depending on whether you are running PowerShell on Windows nor
294294

295295
## File Tools
296296

297+
### [Get-FolderSizeInfo](docs/Get-FolderSizeInfo.md)
298+
299+
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.
300+
301+
```powershell
302+
PS C:\> Get-Childitem D:\ -Directory | Get-FolderSizeInfo -Hidden | Where-Object TotalSize -gt 1gb | Sort-Object TotalSize -Descending | format-table -View gb
303+
304+
Computername Path TotalFiles TotalSizeGB
305+
------------ ---- ---------- -----------
306+
BOVINE320 D:\Autolab 159 137.7192
307+
BOVINE320 D:\VMDisks 18 112.1814
308+
BOVINE320 D:\ISO 17 41.5301
309+
BOVINE320 D:\FileHistory 104541 36.9938
310+
BOVINE320 D:\Vagrant 13 19.5664
311+
BOVINE320 D:\Vms 83 5.1007
312+
BOVINE320 D:\2016 1130 4.9531
313+
BOVINE320 D:\video 125 2.592
314+
BOVINE320 D:\blog 21804 1.1347
315+
BOVINE320 D:\pstranscripts 122092 1.0914
316+
```
317+
297318
### [Optimize-Text](docs/Optimize-Text.md)
298319

299320
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.
@@ -1082,6 +1103,10 @@ Runtime : 40.21:12:01
10821103

10831104
If you run this command within VS Code and specify `-Passthru`, the resulting file will be opened in your editor.
10841105

1106+
### [Test-IsPSWindows](docs/Test-IsPSWindows.md)
1107+
1108+
PowerShell Core introduced the `$IsWindows` variable. However it is not available on Windows PowerShell. Use this command to perform a simple test if the computer is either running Windows or using the Desktop PSEdition. The command returns True or False.
1109+
10851110
### [Write-Detail](docs/Write-Detail.md)
10861111

10871112
This command is designed to be used within your functions and scripts to make it easier to write a detailed message that you can use as verbose output. The assumption is that you are using an advanced function with a Begin, Process and End scriptblocks. You can create a detailed message to indicate what part of the code is being executed. The output can be configured to include a datetime stamp or just the time.
@@ -1122,4 +1147,4 @@ You will need to manually install the file.
11221147

11231148
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.
11241149

1125-
Last Updated *2020-01-29 15:38:42Z UTC*
1150+
Last Updated *2020-01-29 20:06:54Z UTC*

changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log for PSScriptTools
22

3+
## v2.15.0
4+
5+
+ Added `Get-FolderSizeInfo` and its alias `gsi` along with a corresponding format.ps1xml file.
6+
+ Fixed IsWindows bug in `New-WPFMessageBox` (Issue #59)
7+
+ Fixed IsWindows bug in `Convertto-WPFGrid`, `Find-CimClass`, `Test-ExpressionForm`, `Get-WindowsVersion`,`Get-WindowsVersionString` and `Invoke-InputBox` by using a new function `Test-IsPSWindows`
8+
+ Updated `Get-PSWho` to better work cross-platform
9+
+ Help updates
10+
+ Updated `README.md`
11+
312
## v2.14.1
413

514
+ Fixed bug in `Save-GitSetup` that relies on `$IsWindows` (Issue #58). Now this command should work on Windows PowerShell 5.1 as well.

docs/Get-FolderSizeInfo.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Get-FolderSizeInfo
9+
10+
## SYNOPSIS
11+
12+
Get folder size information
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Get-FolderSizeInfo [-Path] <String[]> [-Hidden] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
This command is an alternative to discovering the size of a folder, or at least an easier method. Use the -Hidden parameter to include hidden files in the output. The measurement will include all files in all subfolders.
23+
24+
## EXAMPLES
25+
26+
### Example 1
27+
28+
```powershell
29+
PS C:\> Get-FolderSizeInfo -Path d:\temp
30+
31+
Computername Path TotalFiles TotalSize
32+
------------ ---- ---------- ---------
33+
BOVINE320 D:\temp 48 121824451
34+
```
35+
36+
### Example 2
37+
38+
```powershell
39+
PS C:\> Get-FolderSizeInfo -Path d:\temp -hidden
40+
41+
42+
Computername Path TotalFiles TotalSize
43+
------------ ---- ---------- ---------
44+
BOVINE320 D:\temp 146 125655552
45+
```
46+
47+
Include hidden files.
48+
49+
### Example 3
50+
51+
```powershell
52+
PS C:\> Get-ChildItem d:\ -Directory | Get-FolderSizeInfo | Where-Object TotalSize -gt 1MB | Sort-Object TotalSize -Descending | Format-Table -View mb
53+
54+
Computername Path TotalFiles TotalSizeMB
55+
------------ ---- ---------- -----------
56+
BOVINE320 D:\VMDisks 18 114873.7246
57+
BOVINE320 D:\ISO 17 42526.8204
58+
BOVINE320 D:\SQLServer2017Media 1 710.8545
59+
BOVINE320 D:\officeViewers 4 158.9155
60+
BOVINE320 D:\Temp 48 116.1809
61+
BOVINE320 D:\Sysinternals 153 59.6169
62+
BOVINE320 D:\blog 41 21.9948
63+
BOVINE320 D:\BackTemp 2 21.6734
64+
BOVINE320 D:\rip 3 11.1546
65+
BOVINE320 D:\logs 134 3.9517
66+
BOVINE320 D:\2016 5 1.5608
67+
68+
```
69+
70+
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.
71+
72+
## PARAMETERS
73+
74+
### -Hidden
75+
76+
Include hidden directories
77+
78+
```yaml
79+
Type: SwitchParameter
80+
Parameter Sets: (All)
81+
Aliases:
82+
83+
Required: False
84+
Position: Named
85+
Default value: None
86+
Accept pipeline input: False
87+
Accept wildcard characters: False
88+
```
89+
90+
### -Path
91+
92+
Enter a file system path like C:\Scripts.
93+
94+
```yaml
95+
Type: String[]
96+
Parameter Sets: (All)
97+
Aliases: PSPath
98+
99+
Required: True
100+
Position: 0
101+
Default value: None
102+
Accept pipeline input: True (ByPropertyName, ByValue)
103+
Accept wildcard characters: False
104+
```
105+
106+
### CommonParameters
107+
108+
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).
109+
110+
## INPUTS
111+
112+
### System.String[]
113+
114+
## OUTPUTS
115+
116+
### FolderSizeInfo
117+
118+
## NOTES
119+
120+
Learn more about PowerShell:
121+
http://jdhitsolutions.com/blog/essential-powershell-resources/
122+
123+
## RELATED LINKS
124+
125+
[Get-Childitem]()
126+
127+
[Measure-Object]()

docs/Get-PSWho.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@ User : BOVINE320\Jeff
3434
Elevated : True
3535
Computername : BOVINE320
3636
OperatingSystem : Microsoft Windows 10 Pro [64-bit]
37-
OSVersion : 10.0.17763
38-
PSVersion : 5.1.17763.134
37+
OSVersion : 10.0.18363
38+
PSVersion : 5.1.18362.145
3939
Edition : Desktop
4040
PSHost : ConsoleHost
4141
WSMan : 3.0
4242
ExecutionPolicy : RemoteSigned
43-
Culture : en-US
43+
Culture : English (United States)
4444
```
4545

4646
### EXAMPLE 2
4747

4848
```powershell
4949
PS /home/jhicks> Get-PSWho
5050
51-
User : jhicks
51+
User : jeff
5252
Elevated : NA
5353
Computername : Bovine320
54-
OperatingSystem : Linux 4.4.0-17763-Microsoft #253-Microsoft Mon Dec 31 17:49:00 PST 2018
55-
OSVersion : Ubuntu 18.04.2 LTS
56-
PSVersion : 6.1.2
54+
OperatingSystem : Linux 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019
55+
OSVersion : Ubuntu 18.04.3 LTS
56+
PSVersion : 7.0.0-rc.2
5757
Edition : Core
5858
PSHost : ConsoleHost
5959
WSMan : 3.0
6060
ExecutionPolicy : Unrestricted
61-
Culture : en-US-POSIX
61+
Culture : Invariant Language (Invariant Country)
6262
```
6363

6464
### EXAMPLE 3
@@ -69,14 +69,14 @@ PS C:\> Get-PSWho
6969
User : BOVINE320\Jeff
7070
Elevated : True
7171
Computername : BOVINE320
72-
OperatingSystem : Microsoft Windows 10 Pro \[64-bit\]
73-
OSVersion : 10.0.16299
74-
PSVersion : 6.1.0
72+
OperatingSystem : Microsoft Windows 10 Pro [64-bit]
73+
OSVersion : 10.0.18363
74+
PSVersion : 7.0.0-rc.2
7575
Edition : Core
7676
PSHost : ConsoleHost
7777
WSMan : 3.0
7878
ExecutionPolicy : RemoteSigned
79-
Culture : en-US
79+
Culture : English (United States)
8080
```
8181

8282
### EXAMPLE 4

docs/Test-IsPSWindows.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Test-IsPSWindows
9+
10+
## SYNOPSIS
11+
12+
Test if running PowerShell on a Windows platform
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Test-IsPSWindows [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
PowerShell Core introduced the $IsWindows variable. However it is not available on Windows PowerShell. Use this command to perform a simple test if the computer is either running Windows or using the Desktop PSEdition.
23+
24+
## EXAMPLES
25+
26+
### Example 1
27+
28+
```powershell
29+
PS C:\> Test-IsPSWindows
30+
True
31+
```
32+
33+
## PARAMETERS
34+
35+
### CommonParameters
36+
37+
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).
38+
39+
## INPUTS
40+
41+
### None
42+
43+
## OUTPUTS
44+
45+
### System.Boolean
46+
47+
## NOTES
48+
49+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
50+
51+
## RELATED LINKS

0 commit comments

Comments
 (0)