Skip to content

Commit

Permalink
see changelog for v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jan 4, 2019
1 parent 28d9a56 commit c8743ad
Show file tree
Hide file tree
Showing 36 changed files with 1,480 additions and 25 deletions.
Binary file modified PSScriptTools.psd1
Binary file not shown.
12 changes: 6 additions & 6 deletions PSScriptTools.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Get-ChildItem -path $PSScriptRoot\*.ps1 | foreach-object -process {
Get-ChildItem -path $PSScriptRoot\functions\*.ps1 | foreach-object -process {
. $_.FullName
}

Expand All @@ -9,19 +9,19 @@ if ($psEditor) {
Param(
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context
)

$prompt = "What do you need to do?"
$title = "To Do"
$item = Invoke-Inputbox -Title $title -Prompt $prompt
$todo = "# [$(Get-Date)] TODO: $item"
$context.CurrentFile.InsertText($todo)
}
Register-EditorCommand -Name "Insert.ToDo" -DisplayName "Insert ToDo" -ScriptBlock $sb -SuppressOutput

}
elseif ($psise) {
$action = {
$action = {

$prompt = "What do you need to do?"
$title = "To Do"
$item = Invoke-Inputbox -Title $title -Prompt $prompt
Expand All @@ -30,7 +30,7 @@ elseif ($psise) {
#jump cursor to the end
$psise.CurrentFile.editor.SetCaretPosition($psise.CurrentFile.Editor.CaretLine,$psise.CurrentFile.Editor.CaretColumn)
}

#add the action to the Add-Ons menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("ToDo",$Action,"Ctrl+Alt+2" ) | Out-Null
}
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,41 @@ PS C:\> New-WPFMessageBox -Message "Select a system option from these choices:"

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

## Compare-Module

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

```powershell
PS C:\> Compare-Module | Where UpdateNeeded | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name }
```

Compare modules and send results to Out-Gridview. Use Out-Gridview as an object picker to decide what modules to update.

## Get-WindowsVersion

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.

```powershell
PS C:\> get-windowsversion -Computername srv1,srv2,win10 -Credential company\artd | format-table
ProductName EditionID ReleaseId Build InstalledUTC Computername
----------- --------- --------- ----- ------------ ------------
Windows Server 2016 Standard Evaluation ServerStandardEval 1607 14393.2273 12/26/2018 4:07:25 PM SRV1
Windows Server 2016 Standard Evaluation ServerStandardEval 1607 14393.2273 12/26/2018 4:08:07 PM SRV2
Windows 10 Enterprise Evaluation EnterpriseEval 1703 15063.1387 12/26/2018 4:08:11 PM WIN10
```

### Get-WindowsVersionString

This command is a variation of `Get-WindowsVersion` that returns a formatted string with version information.

```powershell
PS C:\> Get-WindowsVersionString
Windows 10 Pro Version 1809 (OS Build 17763.195)
```

## Compatibility

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.

*last updated 30 December 2018*
*last updated 3 January 2019*
7 changes: 2 additions & 5 deletions Tests/Test-Expression.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#pester tests for Test-Expression

Import-Module ..\Test-Expression -force

InModuleScope Test-Expression {
Import-Module $PSScriptRoot\..\functions\Test-Expression.ps1 -force

Describe "Test-Expression" {

It "Should have an alias" {
(Get-Alias tex).ResolvedCommand.Name | Should Be "Test-Expression"
}
Expand Down Expand Up @@ -48,4 +46,3 @@ Describe "Test-Expression" {
} #Describe


} #module scope
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log for PSScriptTools

## v1.8.0

+ fixed typo in `Write-Detail` (Thanks @AndrewPla)
+ Added `Compare-Module` function (Issue #19)
+ Added `Get-WindowsVersion` function (Issue #20)
+ Added `Get-WindowsVersionString` function
+ Updated `README.md`
+ Updated module manifest
+ reorganized module
+ Updated Pester test for `Test-Expression`
+ Updated external help file

## v1.7.0

+ Added `New-WPFMessagebox` function. (Issue #11)
Expand Down
146 changes: 146 additions & 0 deletions docs/Compare-Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
external help file: PSScriptTools-help.xml
Module Name: PSScriptTools
online version:
schema: 2.0.0
---

# Compare-Module

## SYNOPSIS

Compare PowerShell module versions.

## SYNTAX

```yaml
Compare-Module [[-Name] <String>] [-Gallery <String>] [<CommonParameters>]
```

## DESCRIPTION

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.

## EXAMPLES

### EXAMPLE 1

```powershell
PS C:\> Compare-Module | Where-object {$_.UpdateNeeded}
Name : DNSSuffix
OnlineVersion : 0.4.1
InstalledVersion : 0.2.0
PublishedDate : 10/22/2018 8:21:46 PM
UpdateNeeded : True
Name : InvokeBuild
OnlineVersion : 5.4.2
InstalledVersion : 3.2.2
PublishedDate : 12/7/2018 1:30:46 AM
UpdateNeeded : True
...
```

List all modules that could be updated.

### EXAMPLE 2

```powershell
PS C:\> Compare-Module | Where UpdateNeeded | Out-Gridview -title "Select modules to update" -outputMode multiple | Foreach { Update-Module $_.name }
```

Compare modules and send results to Out-Gridview. Use Out-Gridview as an object picker to decide what modules to update.

### EXAMPLE 3

```powershell
PS C:\> compare-module -name xWin* | format-table
Name OnlineVersion InstalledVersion PublishedDate UpdateNeeded
---- ------------- ---------------- ------------- ------------
xWindowsUpdate 2.7.0.0 2.7.0.0,2.5.0.0 7/12/2017 10:43:54 PM False
xWinEventLog 1.2.0.0 1.2.0.0 6/13/2018 8:06:45 PM False
```

Compare all modules that start with xWin* and display results in a table format.

### EXAMPLE 4

```powershell
PS C:\> get-dscresource xAD* | Select moduleName -Unique | compare-module
Name : xActiveDirectory
OnlineVersion : 2.22.0.0
InstalledVersion : 2.16.0.0,2.14.0.0
PublishedDate : 10/25/2018 5:25:24 PM
UpdateNeeded : True
Name : xAdcsDeployment
OnlineVersion : 1.4.0.0
InstalledVersion : 1.1.0.0,1.0.0.0
PublishedDate : 12/20/2017 10:10:43 PM
UpdateNeeded : True
```

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.

## PARAMETERS

### -Name

The name of a module to check. Wildcards are permitted.

```yaml
Type: String
Parameter Sets: (All)
Aliases: modulename

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: True
```
### -Gallery
Specify the remote repository or gallery to check.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: PSGallery
Accept pipeline input: False
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).
## INPUTS
### [string]
## OUTPUTS
### PSCustomObject
## NOTES
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/
## RELATED LINKS
[Find-Module]()
[Get-Module]()
[Update-Module]()
Loading

0 comments on commit c8743ad

Please sign in to comment.