Skip to content

Commit

Permalink
2.49.0 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jun 6, 2024
1 parent 05d50b0 commit b345e01
Show file tree
Hide file tree
Showing 34 changed files with 3,875 additions and 761 deletions.
Binary file modified PSScriptTools.psd1
Binary file not shown.
3 changes: 2 additions & 1 deletion PSScriptTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if ($MyInvocation.line -match '-verbose') {
Write-Verbose 'Loading public functions'

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

if ($IsCoreCLR) {
Expand Down
443 changes: 322 additions & 121 deletions README.md

Large diffs are not rendered by default.

46 changes: 40 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,34 @@

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

## v2.48.0
## [Unreleased]

### Added

- Modified `ConvertTo-Markdown` to use `Property`and `Value` headings when converting to a list.
- 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))
- Added custom formatting for `Get-CimClassName`.
- Added the module `ThreadJob` as a module dependency to the manifest.

### Changed

- Updated `Get-ParameterInfo` to recognize `ProgressAction` as a common parameter. This parameter was add in PowerShell 7.
- Updated the default table view for output from `Get-ModuleCommand` to include the module version number.
- Modified `Show-Tree` to better handle multi-string and binary values in the registry.
- Modified `Show-Tree` to use `PSStyle.FileInfo` for color information if detected. ([Issue #147](https://github.com/jdhitsolutions/PSScriptTools/issues/147))
- Updated `README.md`
- 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))
- Re-wrote `Find-CimClass` to use `CimSession`.
- Revised `Get-ParameterInfo` to sort output by default using ParameterSet,Position, and Name
- Help updates.

### Fixed

- Revised `Get-WindowsVersion` to handle non-English cultures. ([Issue #142](https://github.com/jdhitsolutions/PSScriptTools/issues/142))
- Fixed bug in `Convert-EventLogRecord` that failed on duplicate property name `ID`. ([Issue #143](https://github.com/jdhitsolutions/Scripts/issues/143))


## [v2.48.0] - 2023-07-28

### Added

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

## v2.47.0
## [v2.47.0] - 2023-05-25

### Changed

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

## v2.46.0
## [v2.46.0] - 2023-03-03

### Changed

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

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

## v2.45.0
## [v2.45.0] - 2022-09-16

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

## v2.44.0
## [v2.44.0] -

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

## v2.43.0
## [v2.43.0] - 2022-04-04

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

If you need to see older change history, look at the [Archive ChangeLog](https://github.com/jdhitsolutions/PSScriptTools/blob/master/Archive-ChangeLog.md) online.

[Unreleased]: https://github.com/jdhitsolutions/PSScriptTools/compare/..HEAD
[v2.48.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.47.0..v2.48.0
[v2.47.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.46.0..v2.47.0
[v2.46.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.45.0..v2.46.0
[v2.45.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.44.0..v2.45.0
[v2.44.0]: https://github.com/jdhitsolutions/PSScriptTools/compare/v2.43.0..v2.44.0
67 changes: 24 additions & 43 deletions docs/ConvertTo-Markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ConvertTo-Markdown [[-InputObject] <Object>] [-Title <String>] [-PreContent <Str

## DESCRIPTION

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

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.

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

```powershell
PS C:\> Get-Service Bits,Winrm |
Convertto-Markdown -title "Service Check" -precontent "## $($env:computername)"
# Service Check
## THINK51
\`\`\`text
Status Name DisplayName
------ ---- -----------
Running Bits Background Intelligent Transfer Ser...
Running Winrm Windows Remote Management (WS-Manag...
\`\`\`
ConvertTo-Markdown -title "Service Check" -PreContent "## $($env:computername)"`
-PostContent "_report $(Get-Date)_" | Out-File c:\work\svc.md
```

Create markdown output from a Get-Service command.
Create markdown output from a Get-Service command and save the output to a file.

### EXAMPLE 2

```powershell
PS C:\> Get-Service Bits,Winrm |
Convertto-Markdown -title "Service Check" -precontent "## $($env:computername)"`
-postcontent "_report $(Get-Date)_" | Out-File c:\work\svc.md
```

Re-run the previous command and save the output to a file.

### EXAMPLE 3

```powershell
````powershell
PS C:\> $computers = "srv1","srv2","srv4"
PS C:\> $Title = "System Report"
PS C:\> $footer = "_report run by $($env:USERDOMAIN)\$($env:USERNAME)_"
PS C:\> $sb = {
$os = Get-CimInstance -classname Win32_OperatingSystem -property caption,
lastbootUptime
\[PSCustomObject\]@{
$os = Get-CimInstance -ClassName Win32_OperatingSystem -property caption,
LastBootUpTime
[PSCustomObject]@{
PSVersion = $PSVersionTable.PSVersion
OS = $os.caption
Uptime = (Get-Date) - $os.lastbootUpTime
Uptime = (Get-Date) - $os.LastBootUpTime
SizeFreeGB = (Get-Volume -DriveLetter C).SizeRemaining /1GB
}
}
PS C:\> $out = Convertto-Markdown -title $Title
PS C:\> $out = ConvertTo-Markdown -title $Title
PS C:\> foreach ($computer in $computers) {
$out+= Invoke-command -scriptblock $sb -Computer $computer -HideComputerName |
$out+= Invoke-command -ScriptBlock $sb -Computer $computer -HideComputerName |
Select-Object -Property * -ExcludeProperty RunspaceID |
ConvertTo-Markdown -PreContent "## $($computer.ToUpper())"
}
PS C:\>$out += ConvertTo-Markdown -PostContent $footer
PS C:\>$out | Set-Content c:\work\report.md
```
````

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.

### EXAMPLE 4
### EXAMPLE 3

```powershell
PS C:\> Get-WindowsVersion | ConvertTo-Markdown -title "OS Summary" -PreContent "## $($env:computername)" -AsList
# OS Summary
## THINKX1
## THINKX1-JH
| | |
| Property | Value |
|----|----|
|ProductName|Windows 10 Pro|
|ProductName|Microsoft Windows 11 Pro|
|ReleaseVersion|23H2|
|EditionID|Professional|
|ReleaseID|2009|
|Build|22000.376|
|Branch|co_release|
|InstalledUTC|8/10/2021 12:17:07 AM|
|Build|22631.2191|
|Branch|ni_release|
|InstalledUTC|5/17/2022 6:54:52 PM|
|Computername|THINKX1-JH|
```

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

### EXAMPLE 5
### EXAMPLE 4

```powershell
PS C:\> Get-Service | Sort-Object -property DisplayName |
Expand All @@ -131,7 +112,7 @@ Foreach-Object -begin {
} -process {
$name = $_.DisplayName
$_ | Select-Object -property Name,StartType,Status,
@{Name="RequiredServices";Expression = {$_.requiredservices.name -join ','}} |
@{Name="RequiredServices";Expression = {$_.RequiredServices.name -join ','}} |
ConvertTo-Markdown -asList -PreContent "## $Name"
} -end {
"### $($env:computername) $(Get-Date)"
Expand Down Expand Up @@ -273,6 +254,6 @@ Learn more about PowerShell: https://jdhitsolutions.com/blog/essential-powershel
## RELATED LINKS
[Convertto-HTML]()
[ConvertTo-HTML]()
[Out-File]()
28 changes: 13 additions & 15 deletions docs/Find-CimClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Search CIM for a class.
## SYNTAX

```yaml
Find-CimClass [-ClassName] <String> [-Exclude <String>]
[-Computername <String>] [<CommonParameters>]
Find-CimClass [-ClassName] <String> [-Exclude <String>] [-CimSession <CimSession>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -84,9 +83,9 @@ Accept pipeline input: False
Accept wildcard characters: True
```
### -Computername
### -Exclude
Enter the name of a computer to search.
Enter a pattern for class names to EXCLUDE from the results. You can use wildcards or regular expressions.
```yaml
Type: String
Expand All @@ -95,31 +94,28 @@ Aliases:

Required: False
Position: Named
Default value: localhost
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Accept wildcard characters: True
```
### -Exclude
Enter a pattern for class names to EXCLUDE from the results. You can use wildcards or regular expressions.
### -CimSession
Specify a computer name or an existing CimSession object.
```yaml
Type: String
Type: CimSession
Parameter Sets: (All)
Aliases:
Aliases: CN

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### CommonParameters
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).
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).
## INPUTS
Expand All @@ -136,3 +132,5 @@ Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell
## RELATED LINKS
[Get-CimClass]()
[Get-CimMember](Get-CimMember.md)
Loading

0 comments on commit b345e01

Please sign in to comment.