Skip to content

Commit df2166c

Browse files
v2.14.0
1 parent 62e5a95 commit df2166c

Some content is hidden

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

67 files changed

+1379
-6726
lines changed

PSScriptTools.psd1

408 Bytes
Binary file not shown.

README.md

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Please post any questions, problems or feedback in [Issues](https://github.com/j
3030

3131
### [Convert-EventLogRecord](docs/Convert-EventLogRecord.md)
3232

33-
When you use Get-WinEvent, the results are objects you can work with in PowerShell.
33+
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.
3434
However, often times there is additional information that is part of the eventlog record, such as replacement strings, that are used to construct a message.
3535
This additional information is not readily exposed.
3636
You can use this command to convert results of a Get-WinEvent command into a PowerShell custom object with additional information.
@@ -91,11 +91,24 @@ This module includes a custom format file for these results.
9191

9292
Use this command to compare module versions between what is installed against an online repository like the PSGallery
9393

94+
```powershell
95+
PS C:\> Compare-Module Platyps
96+
97+
98+
Name : platyPS
99+
OnlineVersion : 0.14.0
100+
InstalledVersion : 0.14.0,0.12.0,0.11.1,0.10.2,0.9.0
101+
PublishedDate : 4/3/2019 12:46:30 AM
102+
UpdateNeeded : False
103+
```
104+
105+
Or you can compare and manage multiple modules.
106+
94107
```powershell
95108
PS C:\> Compare-Module | Where UpdateNeeded | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name }
96109
```
97110

98-
Compare modules and send results to `Out-Gridview`. Use `Out-Gridview` as an object picker to decide what modules to update.
111+
This example compares modules and send results to `Out-Gridview`. Use `Out-Gridview` as an object picker to decide what modules to update.
99112

100113
### [Get-WindowsVersion](docs/Get-WindowsVersion.md)
101114

@@ -219,9 +232,9 @@ This function is designed to search an entire CIM repository for a class name. S
219232

220233
### [Out-VerboseTee](docs/Out-VerboseTee.md)
221234

222-
This command is intended to let you see your verbose output and write the verbose messages to a log file. It will only work if the verbose pipeline is enabled, usually when your command is run with -Verbose. This function is designed to be used within your scripts and functions. You either have to hard code a file name or find some other way to define it in your function or control script. You could pass a value as a parameter or set it as a PSDefaultParameterValue.
235+
This command is intended to let you see your verbose output and write the verbose messages to a log file. It will only work if the verbose pipeline is enabled, usually when your command is run with -Verbose. This function is designed to be used within your scripts and functions. You either have to hard code a file name or find some other way to define it in your function or control script. You could pass a value as a parameter or set it as a `PSDefaultParameterValue`.
223236

224-
This command has an alias of `Tee-Verbose`.
237+
This command has aliases of `Tee-Verbose` and `tv`.
225238

226239
```powershell
227240
Begin {
@@ -262,11 +275,11 @@ PS C:\> Get-PowerShellEngine
262275
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
263276
```
264277

265-
But PowerShell Core is a bit different:
278+
But PowerShell on non-Windows platforms is a bit different:
266279

267280
```powershell
268281
PS /home/jhicks> Get-PowerShellEngine
269-
/opt/microsoft/powershell/6/pwsh
282+
/opt/microsoft/powershell/7/pwsh
270283
```
271284

272285
You can also get detailed information.
@@ -277,7 +290,7 @@ You can also get detailed information.
277290

278291
![PowerShell Core on Linux](./images/get-powershellengine3.png)
279292

280-
Results will vary depending on whether you are running Windows PowerShell or PowerShell Core.
293+
Results will vary depending on whether you are running PowerShell on Windows nor non-Windows systems.
281294

282295
## File Tools
283296

@@ -803,6 +816,40 @@ datetime : 2019-03-16T03:44:45.689655+11:00
803816
abbreviation : AEDT
804817
```
805818

819+
### [ConvertTo-LexicalTime](docs/ConvertTo-LexicalTime.md)
820+
821+
When working with timespans or durations in XML files, such as those from scheduled tasks, the format is a little different than what you mgiht expect. The specification is described at [https://www.w3.org/TR/xmlschema-2/#duration](https://www.w3.org/TR/xmlschema-2/#duration). Use this command to convert a timespan into a lexical format you can use in an XML file where you need to specify a duration.
822+
823+
```powershell
824+
ConvertTo-LexicalTimespan (New-TimeSpan -Days 7 -hours 12)
825+
826+
P7DT12H
827+
```
828+
829+
### [ConvertFrom-LexicalTime](docs/ConvertFrom-LexicalTime.md)
830+
831+
Likewise, you might need to convert a lexical value back into a timespan.
832+
833+
```powershell
834+
ConvertFrom-LexicalTimespan P7DT12H
835+
836+
837+
Days : 7
838+
Hours : 12
839+
Minutes : 0
840+
Seconds : 0
841+
Milliseconds : 0
842+
Ticks : 6480000000000
843+
TotalDays : 7.5
844+
TotalHours : 180
845+
TotalMinutes : 10800
846+
TotalSeconds : 648000
847+
TotalMilliseconds : 648000000
848+
849+
```
850+
851+
These functions were first described at [https://jdhitsolutions.com/blog/powershell/7101/converting-lexical-timespans-with-powershell/](https://jdhitsolutions.com/blog/powershell/7101/converting-lexical-timespans-with-powershell/)
852+
806853
## Console Utilities
807854

808855
### [Out-More](docs/Out-More.md)
@@ -1054,8 +1101,25 @@ Begin {
10541101
} #begin
10551102
```
10561103

1104+
### [Save-GitSetup](docs/Save-GitSetup.md)
1105+
1106+
This command is intended for Windows users to easily download the latest 64bit version of `Git`.
1107+
1108+
```powershell
1109+
PS C:\> Save-GitSetup -Path c:\work -Passthru
1110+
1111+
1112+
Directory: C:\work
1113+
1114+
Mode LastWriteTime Length Name
1115+
---- ------------- ------ ----
1116+
-a--- 1/23/2020 4:31 PM 46476880 Git-2.25.0-64-bit.exe
1117+
```
1118+
1119+
You will need to manually install the file.
1120+
10571121
## Compatibility
10581122

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

1061-
last Updated 2020-01-22 19:12:33Z UTC
1125+
Last Updated *2020-01-27 20:38:42Z UTC*

changelog.md

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

3+
## v2.14.0
4+
5+
+ Updated `New-PSFormatXML` to support Wide table formats (Issue #55)
6+
+ Updated `Test-ExpressionForm` to better handle non-Windows platforms
7+
+ Added `Save-GitSetup` to download the latest x64 version of `git`
8+
+ Modified `New-CustomFileName` to support a new template element, `%hour24` (Issue #57)
9+
+ Added `tv` alias to `Out-VerboseTee`
10+
+ Added `ConvertTo-LexicalTimespan`
11+
+ Added `ConvertFrom-LexicalTimespan`
12+
+ Updated manifest description
13+
+ Updated help for `Get-PowerShellEngine`
14+
+ Updated `README.md`
15+
316
## v2.13.0
417

518
+ Added `New-RunspaceCleanupJob` command to be used with WPF commands running in a new runspace

docs-yaml/Add-Border.yml

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)