Skip to content

Commit b345e01

Browse files
2.49.0 updates
1 parent 05d50b0 commit b345e01

34 files changed

+3875
-761
lines changed

PSScriptTools.psd1

1.18 KB
Binary file not shown.

PSScriptTools.psm1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if ($MyInvocation.line -match '-verbose') {
55
Write-Verbose 'Loading public functions'
66

77
#exclude files that have special requirements
8-
Get-ChildItem -Path $PSScriptRoot\functions\*.ps1 -Exclude 'Get-MyCounter.ps1', 'Get-FileExtensionInfo.ps1' |
8+
Get-ChildItem -Path $PSScriptRoot\functions\*.ps1 -Exclude 'Get-MyCounter.ps1', 'Get-FileExtensionInfo.ps1','CimMember.ps1' |
99
ForEach-Object -Process {
1010
Write-Verbose $_.FullName
1111
. $_.FullName
@@ -14,6 +14,7 @@ ForEach-Object -Process {
1414
Write-Verbose 'Loading Windows-specific commands'
1515
if ($IsWindows -OR ($PSEdition -eq 'Desktop')) {
1616
. "$PSScriptRoot\functions\Get-MyCounter.ps1"
17+
. "$PSScriptRoot\functions\CimMember.ps1"
1718
}
1819

1920
if ($IsCoreCLR) {

README.md

Lines changed: 322 additions & 121 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,34 @@
22

33
This file contains the most recent change history for the PSScriptTools module.
44

5-
## v2.48.0
5+
## [Unreleased]
6+
7+
### Added
8+
9+
- Modified `ConvertTo-Markdown` to use `Property`and `Value` headings when converting to a list.
10+
- Added CimMember functions `Get-CimNamespace`,`Get-CimClassMethod`, `Get-CimClassProperty`,`Get-CimClassPropertyQualifier`, `Get-CimClassName` and `Get-CimMember`. ([Issue #137](https://github.com/jdhitsolutions/PSScriptTools/issues/137))
11+
- Added custom formatting for `Get-CimClassName`.
12+
- Added the module `ThreadJob` as a module dependency to the manifest.
13+
14+
### Changed
15+
16+
- Updated `Get-ParameterInfo` to recognize `ProgressAction` as a common parameter. This parameter was add in PowerShell 7.
17+
- Updated the default table view for output from `Get-ModuleCommand` to include the module version number.
18+
- Modified `Show-Tree` to better handle multi-string and binary values in the registry.
19+
- Modified `Show-Tree` to use `PSStyle.FileInfo` for color information if detected. ([Issue #147](https://github.com/jdhitsolutions/PSScriptTools/issues/147))
20+
- Updated `README.md`
21+
- Revised `Get-FolderSizeInfo` to be more consistent between PowerShell versions. The command will skip counting all reparse points. **This may be a breaking change**. ([Issue #145](https://github.com/jdhitsolutions/PSScriptTools/issues/145))
22+
- Re-wrote `Find-CimClass` to use `CimSession`.
23+
- Revised `Get-ParameterInfo` to sort output by default using ParameterSet,Position, and Name
24+
- Help updates.
25+
26+
### Fixed
27+
28+
- Revised `Get-WindowsVersion` to handle non-English cultures. ([Issue #142](https://github.com/jdhitsolutions/PSScriptTools/issues/142))
29+
- Fixed bug in `Convert-EventLogRecord` that failed on duplicate property name `ID`. ([Issue #143](https://github.com/jdhitsolutions/Scripts/issues/143))
30+
31+
32+
## [v2.48.0] - 2023-07-28
633

734
### Added
835

@@ -15,7 +42,7 @@ This file contains the most recent change history for the PSScriptTools module.
1542
- Added `EnumOnly` parameter to `Get-TypeMember` [Issue #135](https://github.com/jdhitsolutions/PSScriptTools/issues/135)
1643
- Help updates
1744

18-
## v2.47.0
45+
## [v2.47.0] - 2023-05-25
1946

2047
### Changed
2148

@@ -27,7 +54,7 @@ This file contains the most recent change history for the PSScriptTools module.
2754
- Updated format file for `Get-TypeMember` to highlight enum properties.
2855
- Updated `README.md`.
2956

30-
## v2.46.0
57+
## [v2.46.0] - 2023-03-03
3158

3259
### Changed
3360

@@ -55,7 +82,7 @@ This file contains the most recent change history for the PSScriptTools module.
5582

5683
- Marked `Out-ConditionalColor` and `Set-ConsoleColor` as deprecated. They will be removed in a future release.
5784

58-
## v2.45.0
85+
## [v2.45.0] - 2022-09-16
5986

6087
- Fixed help typo for `Get-PSUnique` [PR 133](https://github.com/jdhitsolutions/PSScriptTools/pull/133). Thank you @fiala-sns.
6188
- Updated `Get-WindowsVersion` to include `DisplayVersion`, e.g. `22H2`.
@@ -64,13 +91,13 @@ This file contains the most recent change history for the PSScriptTools module.
6491
- Help updates.
6592
- Updated `README.md`.
6693

67-
## v2.44.0
94+
## [v2.44.0] -
6895

6996
- Updated `Show-ANSISequence` to fix a bug where foreground samples where included when specifying background. [Issue #130](https://github.com/jdhitsolutions/PSScriptTools/issues/130)
7097
- Updated contributing guidelines.
7198
- Updated `README.md`.
7299

73-
## v2.43.0
100+
## [v2.43.0] - 2022-04-04
74101

75102
- Fixed VSCode snippets to run in a PowerShell 7 integrated console. [Issue #124](https://github.com/jdhitsolutions/PSScriptTools/issues/124)
76103
- Updated `Show-AnsiSequence` to fix a display bug that was dropping values. [Issue #125](https://github.com/jdhitsolutions/PSScriptTools/issues/125)
@@ -84,3 +111,10 @@ This file contains the most recent change history for the PSScriptTools module.
84111
## Archive
85112

86113
If you need to see older change history, look at the [Archive ChangeLog](https://github.com/jdhitsolutions/PSScriptTools/blob/master/Archive-ChangeLog.md) online.
114+
115+
[Unreleased]: https://github.com/jdhitsolutions/PSScriptTools/compare/..HEAD
116+
[v2.48.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.47.0..v2.48.0
117+
[v2.47.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.46.0..v2.47.0
118+
[v2.46.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.45.0..v2.46.0
119+
[v2.45.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.44.0..v2.45.0
120+
[v2.44.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.43.0..v2.44.0

docs/ConvertTo-Markdown.md

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ConvertTo-Markdown [[-InputObject] <Object>] [-Title <String>] [-PreContent <Str
3434

3535
## DESCRIPTION
3636

37-
This command is designed to accept pipelined output and create a generic markdown document. The pipeline output will formatted as a text block or you can specify a table. The AsList parameter technically still create a table, but it is two columns with the property namd and value.
37+
This command is designed to accept pipelined output and create a generic markdown document. The pipeline output will formatted as a text block or you can specify a table. The AsList parameter technically still create a table, but it is two columns with the property name and value.
3838

3939
You can optionally define a title, content to appear before the output, and content to appear after the output. Best efforts have been made to produce markdown output that meets basic standards.
4040

@@ -46,83 +46,64 @@ The command does not create a text file. You need to pipe results from this comm
4646

4747
```powershell
4848
PS C:\> Get-Service Bits,Winrm |
49-
Convertto-Markdown -title "Service Check" -precontent "## $($env:computername)"
50-
51-
# Service Check
52-
53-
## THINK51
54-
55-
\`\`\`text
56-
57-
Status Name DisplayName
58-
------ ---- -----------
59-
Running Bits Background Intelligent Transfer Ser...
60-
Running Winrm Windows Remote Management (WS-Manag...
61-
\`\`\`
49+
ConvertTo-Markdown -title "Service Check" -PreContent "## $($env:computername)"`
50+
-PostContent "_report $(Get-Date)_" | Out-File c:\work\svc.md
6251
```
6352

64-
Create markdown output from a Get-Service command.
53+
Create markdown output from a Get-Service command and save the output to a file.
6554

6655
### EXAMPLE 2
6756

68-
```powershell
69-
PS C:\> Get-Service Bits,Winrm |
70-
Convertto-Markdown -title "Service Check" -precontent "## $($env:computername)"`
71-
-postcontent "_report $(Get-Date)_" | Out-File c:\work\svc.md
72-
```
73-
74-
Re-run the previous command and save the output to a file.
75-
76-
### EXAMPLE 3
77-
78-
```powershell
57+
````powershell
7958
PS C:\> $computers = "srv1","srv2","srv4"
8059
PS C:\> $Title = "System Report"
8160
PS C:\> $footer = "_report run by $($env:USERDOMAIN)\$($env:USERNAME)_"
8261
PS C:\> $sb = {
83-
$os = Get-CimInstance -classname Win32_OperatingSystem -property caption,
84-
lastbootUptime
85-
\[PSCustomObject\]@{
62+
$os = Get-CimInstance -ClassName Win32_OperatingSystem -property caption,
63+
LastBootUpTime
64+
[PSCustomObject]@{
8665
PSVersion = $PSVersionTable.PSVersion
8766
OS = $os.caption
88-
Uptime = (Get-Date) - $os.lastbootUpTime
67+
Uptime = (Get-Date) - $os.LastBootUpTime
8968
SizeFreeGB = (Get-Volume -DriveLetter C).SizeRemaining /1GB
9069
}
9170
}
92-
PS C:\> $out = Convertto-Markdown -title $Title
71+
PS C:\> $out = ConvertTo-Markdown -title $Title
9372
PS C:\> foreach ($computer in $computers) {
94-
$out+= Invoke-command -scriptblock $sb -Computer $computer -HideComputerName |
73+
$out+= Invoke-command -ScriptBlock $sb -Computer $computer -HideComputerName |
9574
Select-Object -Property * -ExcludeProperty RunspaceID |
9675
ConvertTo-Markdown -PreContent "## $($computer.ToUpper())"
9776
}
9877
PS C:\>$out += ConvertTo-Markdown -PostContent $footer
9978
PS C:\>$out | Set-Content c:\work\report.md
100-
```
79+
````
10180

10281
Here is an example that creates a series of markdown fragments for each computer and in the end creates a markdown document. The commands are shown at a PowerShell prompt, but you are likely to put them in a PowerShell script file.
10382

104-
### EXAMPLE 4
83+
### EXAMPLE 3
10584

10685
```powershell
10786
PS C:\> Get-WindowsVersion | ConvertTo-Markdown -title "OS Summary" -PreContent "## $($env:computername)" -AsList
87+
10888
# OS Summary
10989
110-
## THINKX1
90+
## THINKX1-JH
11191
112-
| | |
92+
| Property | Value |
11393
|----|----|
114-
|ProductName|Windows 10 Pro|
94+
|ProductName|Microsoft Windows 11 Pro|
95+
|ReleaseVersion|23H2|
11596
|EditionID|Professional|
11697
|ReleaseID|2009|
117-
|Build|22000.376|
118-
|Branch|co_release|
119-
|InstalledUTC|8/10/2021 12:17:07 AM|
98+
|Build|22631.2191|
99+
|Branch|ni_release|
100+
|InstalledUTC|5/17/2022 6:54:52 PM|
120101
|Computername|THINKX1-JH|
121102
```
122103

123104
Create a "list" table with output from the Get-WindowsVersion command.
124105

125-
### EXAMPLE 5
106+
### EXAMPLE 4
126107

127108
```powershell
128109
PS C:\> Get-Service | Sort-Object -property DisplayName |
@@ -131,7 +112,7 @@ Foreach-Object -begin {
131112
} -process {
132113
$name = $_.DisplayName
133114
$_ | Select-Object -property Name,StartType,Status,
134-
@{Name="RequiredServices";Expression = {$_.requiredservices.name -join ','}} |
115+
@{Name="RequiredServices";Expression = {$_.RequiredServices.name -join ','}} |
135116
ConvertTo-Markdown -asList -PreContent "## $Name"
136117
} -end {
137118
"### $($env:computername) $(Get-Date)"
@@ -273,6 +254,6 @@ Learn more about PowerShell: https://jdhitsolutions.com/blog/essential-powershel
273254
274255
## RELATED LINKS
275256
276-
[Convertto-HTML]()
257+
[ConvertTo-HTML]()
277258
278259
[Out-File]()

docs/Find-CimClass.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ Search CIM for a class.
1414
## SYNTAX
1515

1616
```yaml
17-
Find-CimClass [-ClassName] <String> [-Exclude <String>]
18-
[-Computername <String>] [<CommonParameters>]
17+
Find-CimClass [-ClassName] <String> [-Exclude <String>] [-CimSession <CimSession>] [<CommonParameters>]
1918
```
2019

2120
## DESCRIPTION
@@ -84,9 +83,9 @@ Accept pipeline input: False
8483
Accept wildcard characters: True
8584
```
8685
87-
### -Computername
86+
### -Exclude
8887
89-
Enter the name of a computer to search.
88+
Enter a pattern for class names to EXCLUDE from the results. You can use wildcards or regular expressions.
9089
9190
```yaml
9291
Type: String
@@ -95,31 +94,28 @@ Aliases:
9594

9695
Required: False
9796
Position: Named
98-
Default value: localhost
97+
Default value: None
9998
Accept pipeline input: False
100-
Accept wildcard characters: False
99+
Accept wildcard characters: True
101100
```
102101
103-
### -Exclude
104-
105-
Enter a pattern for class names to EXCLUDE from the results. You can use wildcards or regular expressions.
102+
### -CimSession
103+
Specify a computer name or an existing CimSession object.
106104
107105
```yaml
108-
Type: String
106+
Type: CimSession
109107
Parameter Sets: (All)
110-
Aliases:
108+
Aliases: CN
111109

112110
Required: False
113111
Position: Named
114112
Default value: None
115-
Accept pipeline input: False
113+
Accept pipeline input: True (ByValue)
116114
Accept wildcard characters: False
117115
```
118116
119117
### CommonParameters
120-
121-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
122-
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
118+
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).
123119
124120
## INPUTS
125121
@@ -136,3 +132,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
136132
## RELATED LINKS
137133
138134
[Get-CimClass]()
135+
136+
[Get-CimMember](Get-CimMember.md)

0 commit comments

Comments
 (0)