Skip to content

Commit

Permalink
Get-MicrosoftPowerShellCore
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Sep 27, 2019
1 parent 9684519 commit c2627f3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 49 deletions.
6 changes: 5 additions & 1 deletion Get.Software/Get.Software.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@
},
"VMwareTools" : {
"Uri" : "https://packages.vmware.com/tools/versions",
"DownloadUri" : "https://packages.vmware.com/tools/esx/",
"DownloadUri" : "https://packages.vmware.com/tools/esx/latest/",
"Platforms" : [
"Windows"
],
"Architecture" : [
"x64"
],
"MatchFileName" : "[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-x86_64"
},
"MicrosoftPowerShellCore" : {
"Uri" : "https://api.github.com/repos/PowerShell/PowerShell/releases",
"ContentType" : "application/json; charset=utf-8"
}
},
"Preferences" : {
Expand Down
2 changes: 1 addition & 1 deletion Get.Software/Get.Software.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'Get-NotepadPpUri', "Get-VMwareTools",
'Get-NotepadPpVersion', 'Get-PaintDotNetUri',
'Get-PaintDotNetVersion', 'Get-VideoLanVlcPlayer',
'Get-OracleVirtualBox',
'Get-OracleVirtualBox', 'Get-MicrosoftPowerShellCore'
'Get-CitrixXenServerTools', 'Get-ZoomVersion')

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
Expand Down
43 changes: 43 additions & 0 deletions Get.Software/Public/Get-MicrosoftPowerShellCore.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Function Get-MicrosoftPowerShellCore {
<#
.SYNOPSIS
Returns the latest PowerShell Core version number.
.DESCRIPTION
Returns the latest PowerShell Core version number.
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
.LINK
https://github.com/aaronparker/Get.Software
.EXAMPLE
Get-PowerShellCoreVersion
Description:
Returns the latest PowerShell Core version number.
#>
[CmdletBinding()]
Param()

# Get latest version and download latest PowerShell Core release via GitHub API
# Query the PowerShell Core repository for releases, keeping the latest stable release
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.MicrosoftPowerShellCore.Uri `
-ContentType $script:resourceStrings.Applications.MicrosoftPowerShellCore.ContentType -Raw
$JsonReleases = $Content | ConvertFrom-Json
$LatestRelease = $JsonReleases | Where-Object { $_.prerelease -eq $False } | Select-Object -First 1

# Build the output object with release details
ForEach ($release in $latestRelease.assets) {
$PSObject = [PSCustomObject] @{
Version = $LatestRelease.tag_name
Platform = "Platform"
Architecture = "x64"
URI = $release.browser_download_url
Size = $release.size
}
Write-Output -InputObject $PSObject
}
}
45 changes: 0 additions & 45 deletions Get.Software/Public/Get-PowerShellCore.ps1

This file was deleted.

4 changes: 2 additions & 2 deletions Get.Software/Public/Get-VMwareTools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Function Get-VMwareTools {
ForEach ($architecture in $script:resourceStrings.Applications.VMwareTools.Architecture) {

# Query the download page for the download file name
$Uri = ("https://packages.vmware.com/tools/esx/latest/$platform/$architecture/index.html").ToLower()
$Uri = ("$($script:resourceStrings.Applications.VMwareTools.DownloadUri)$platform/$architecture/index.html").ToLower()
$Content = Invoke-WebContent -Uri $Uri
$Line = ($Content.split("`n") | `
Select-String -Pattern $script:resourceStrings.Applications.VMwareTools.MatchFileName).ToString().Trim()
Expand All @@ -42,7 +42,7 @@ Function Get-VMwareTools {
$PSObject = [PSCustomObject] @{
Version = ($VersionTable | Select-Object -First 1).Version
Platform = $platform
Architecture = $architecture
Architecture = $architecture
URI = "https://packages.vmware.com/tools/esx/latest/$($platform.ToLower())/$architecture/$filename"
ESXi = (($VersionTable | Select-Object -First 1).Server -replace "esx/", "")
}
Expand Down

0 comments on commit c2627f3

Please sign in to comment.