Skip to content

Commit c8743ad

Browse files
see changelog for v1.8.0
1 parent 28d9a56 commit c8743ad

36 files changed

+1480
-25
lines changed

PSScriptTools.psd1

172 Bytes
Binary file not shown.

PSScriptTools.psm1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Get-ChildItem -path $PSScriptRoot\*.ps1 | foreach-object -process {
2+
Get-ChildItem -path $PSScriptRoot\functions\*.ps1 | foreach-object -process {
33
. $_.FullName
44
}
55

@@ -9,19 +9,19 @@ if ($psEditor) {
99
Param(
1010
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context
1111
)
12-
12+
1313
$prompt = "What do you need to do?"
1414
$title = "To Do"
1515
$item = Invoke-Inputbox -Title $title -Prompt $prompt
1616
$todo = "# [$(Get-Date)] TODO: $item"
1717
$context.CurrentFile.InsertText($todo)
1818
}
1919
Register-EditorCommand -Name "Insert.ToDo" -DisplayName "Insert ToDo" -ScriptBlock $sb -SuppressOutput
20-
20+
2121
}
2222
elseif ($psise) {
23-
$action = {
24-
23+
$action = {
24+
2525
$prompt = "What do you need to do?"
2626
$title = "To Do"
2727
$item = Invoke-Inputbox -Title $title -Prompt $prompt
@@ -30,7 +30,7 @@ elseif ($psise) {
3030
#jump cursor to the end
3131
$psise.CurrentFile.editor.SetCaretPosition($psise.CurrentFile.Editor.CaretLine,$psise.CurrentFile.Editor.CaretColumn)
3232
}
33-
33+
3434
#add the action to the Add-Ons menu
3535
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("ToDo",$Action,"Ctrl+Alt+2" ) | Out-Null
3636
}

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,41 @@ PS C:\> New-WPFMessageBox -Message "Select a system option from these choices:"
549549

550550
![A customized WPF Message box](/images/wpfbox-2.png)
551551

552+
## Compare-Module
553+
554+
Use this command to compare module versions between what is installed against an online repository like the PSGallery
555+
556+
```powershell
557+
PS C:\> Compare-Module | Where UpdateNeeded | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name }
558+
```
559+
560+
Compare modules and send results to Out-Gridview. Use Out-Gridview as an object picker to decide what modules to update.
561+
562+
## Get-WindowsVersion
563+
564+
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.
565+
566+
```powershell
567+
PS C:\> get-windowsversion -Computername srv1,srv2,win10 -Credential company\artd | format-table
568+
569+
ProductName EditionID ReleaseId Build InstalledUTC Computername
570+
----------- --------- --------- ----- ------------ ------------
571+
Windows Server 2016 Standard Evaluation ServerStandardEval 1607 14393.2273 12/26/2018 4:07:25 PM SRV1
572+
Windows Server 2016 Standard Evaluation ServerStandardEval 1607 14393.2273 12/26/2018 4:08:07 PM SRV2
573+
Windows 10 Enterprise Evaluation EnterpriseEval 1703 15063.1387 12/26/2018 4:08:11 PM WIN10
574+
```
575+
576+
### Get-WindowsVersionString
577+
578+
This command is a variation of `Get-WindowsVersion` that returns a formatted string with version information.
579+
580+
```powershell
581+
PS C:\> Get-WindowsVersionString
582+
Windows 10 Pro Version 1809 (OS Build 17763.195)
583+
```
584+
552585
## Compatibility
553586

554587
Where possible these commands have been tested with PowerShell Core, but not every platform. If you encounter problems, have suggestions or other feedback, please post an issue.
555588

556-
*last updated 30 December 2018*
589+
*last updated 3 January 2019*

Tests/Test-Expression.tests.ps1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#pester tests for Test-Expression
22

3-
Import-Module ..\Test-Expression -force
4-
5-
InModuleScope Test-Expression {
3+
Import-Module $PSScriptRoot\..\functions\Test-Expression.ps1 -force
64

75
Describe "Test-Expression" {
8-
6+
97
It "Should have an alias" {
108
(Get-Alias tex).ResolvedCommand.Name | Should Be "Test-Expression"
119
}
@@ -48,4 +46,3 @@ Describe "Test-Expression" {
4846
} #Describe
4947

5048

51-
} #module scope

changelog.md

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

3+
## v1.8.0
4+
5+
+ fixed typo in `Write-Detail` (Thanks @AndrewPla)
6+
+ Added `Compare-Module` function (Issue #19)
7+
+ Added `Get-WindowsVersion` function (Issue #20)
8+
+ Added `Get-WindowsVersionString` function
9+
+ Updated `README.md`
10+
+ Updated module manifest
11+
+ reorganized module
12+
+ Updated Pester test for `Test-Expression`
13+
+ Updated external help file
14+
315
## v1.7.0
416

517
+ Added `New-WPFMessagebox` function. (Issue #11)

docs/Compare-Module.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
external help file: PSScriptTools-help.xml
3+
Module Name: PSScriptTools
4+
online version:
5+
schema: 2.0.0
6+
---
7+
8+
# Compare-Module
9+
10+
## SYNOPSIS
11+
12+
Compare PowerShell module versions.
13+
14+
## SYNTAX
15+
16+
```yaml
17+
Compare-Module [[-Name] <String>] [-Gallery <String>] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
22+
Use this command to compare module versions between what is installed against an online repository like the PSGallery. Results will be automatically sorted by module name.
23+
24+
## EXAMPLES
25+
26+
### EXAMPLE 1
27+
28+
```powershell
29+
PS C:\> Compare-Module | Where-object {$_.UpdateNeeded}
30+
31+
Name : DNSSuffix
32+
OnlineVersion : 0.4.1
33+
InstalledVersion : 0.2.0
34+
PublishedDate : 10/22/2018 8:21:46 PM
35+
UpdateNeeded : True
36+
37+
Name : InvokeBuild
38+
OnlineVersion : 5.4.2
39+
InstalledVersion : 3.2.2
40+
PublishedDate : 12/7/2018 1:30:46 AM
41+
UpdateNeeded : True
42+
...
43+
```
44+
45+
List all modules that could be updated.
46+
47+
### EXAMPLE 2
48+
49+
```powershell
50+
PS C:\> Compare-Module | Where UpdateNeeded | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name }
51+
```
52+
53+
Compare modules and send results to Out-Gridview. Use Out-Gridview as an object picker to decide what modules to update.
54+
55+
### EXAMPLE 3
56+
57+
```powershell
58+
PS C:\> compare-module -name xWin* | format-table
59+
60+
Name OnlineVersion InstalledVersion PublishedDate UpdateNeeded
61+
---- ------------- ---------------- ------------- ------------
62+
xWindowsUpdate 2.7.0.0 2.7.0.0,2.5.0.0 7/12/2017 10:43:54 PM False
63+
xWinEventLog 1.2.0.0 1.2.0.0 6/13/2018 8:06:45 PM False
64+
```
65+
66+
Compare all modules that start with xWin* and display results in a table format.
67+
68+
### EXAMPLE 4
69+
70+
```powershell
71+
PS C:\> get-dscresource xAD* | Select moduleName -Unique | compare-module
72+
73+
Name : xActiveDirectory
74+
OnlineVersion : 2.22.0.0
75+
InstalledVersion : 2.16.0.0,2.14.0.0
76+
PublishedDate : 10/25/2018 5:25:24 PM
77+
UpdateNeeded : True
78+
79+
Name : xAdcsDeployment
80+
OnlineVersion : 1.4.0.0
81+
InstalledVersion : 1.1.0.0,1.0.0.0
82+
PublishedDate : 12/20/2017 10:10:43 PM
83+
UpdateNeeded : True
84+
```
85+
86+
Get all DSC Resources that start with xAD and select the corresponding module name. Since the module name will be listed for every resource, get a unique list and pipe that to Compare-Module.
87+
88+
## PARAMETERS
89+
90+
### -Name
91+
92+
The name of a module to check. Wildcards are permitted.
93+
94+
```yaml
95+
Type: String
96+
Parameter Sets: (All)
97+
Aliases: modulename
98+
99+
Required: False
100+
Position: 1
101+
Default value: None
102+
Accept pipeline input: True (ByPropertyName)
103+
Accept wildcard characters: True
104+
```
105+
106+
### -Gallery
107+
108+
Specify the remote repository or gallery to check.
109+
110+
```yaml
111+
Type: String
112+
Parameter Sets: (All)
113+
Aliases:
114+
115+
Required: False
116+
Position: Named
117+
Default value: PSGallery
118+
Accept pipeline input: False
119+
Accept wildcard characters: False
120+
```
121+
122+
### CommonParameters
123+
124+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
125+
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
126+
127+
## INPUTS
128+
129+
### [string]
130+
131+
## OUTPUTS
132+
133+
### PSCustomObject
134+
135+
## NOTES
136+
137+
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
138+
139+
## RELATED LINKS
140+
141+
[Find-Module]()
142+
143+
[Get-Module]()
144+
145+
[Update-Module]()
146+

0 commit comments

Comments
 (0)