Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Sep 22, 2019
1 parent c6a5165 commit 31b660b
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 103 deletions.
9 changes: 9 additions & 0 deletions Get.Software/Get.Software.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
"Languages" : [
"en_US", "de_DE", "es_ES", "fr_FR", "ja_JP"
]
},
"VideoLanVlcPlayer" : {
"UriWin64" : "https://update.videolan.org/vlc/status-win-x64",
"UriWin32" : "https://update.videolan.org/vlc/status-win-x86",
"UriMac" : "http://update.videolan.org/vlc/sparkle/vlc-intel64.xml",
"ContentType" : "application/octet-stream"
},
"XenServerTools" : {
"Uri" : "https://pvupdates.vmd.citrix.com/updates.latest.tsv"
}
},
"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 @@ -80,7 +80,7 @@ FunctionsToExport = @('Get-AdobeAcrobatReaderDC',
'Get-NotepadPpVersion', 'Get-PaintDotNetUri',
'Get-PaintDotNetVersion', 'Get-VideoLanVlcPlayer',
'Get-VirtualBoxVersion', 'Get-VmwareToolsUri',
'Get-VmwareToolsVersion', 'Get-ZoomVersion')
'Get-VmwareToolsVersion', 'Get-XenServerTools', '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.
CmdletsToExport = @()
Expand Down
27 changes: 0 additions & 27 deletions Get.Software/Private/Get-VlcPlayerUpdateMac.ps1

This file was deleted.

35 changes: 0 additions & 35 deletions Get.Software/Private/Get-VlcPlayerUpdateWin.ps1

This file was deleted.

45 changes: 30 additions & 15 deletions Get.Software/Private/Invoke-WebContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,40 @@ Function Invoke-WebContent {
[ValidateNotNullOrEmpty()]
[System.String] $Uri,

[Parameter(Mandatory = $True, Position = 0)]
[Parameter(Position = 1)]
[ValidateNotNullOrEmpty()]
[System.String] $ContentType
[System.String] $ContentType = "text/plain; charset=utf-8",

[Parameter()]
[System.Management.Automation.SwitchParameter] $Raw
)

If ($Null -ne $script:resourceStrings) {
try {
$params = @{
Uri = $Uri
ContentType = $ContentType
UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
UseBasicParsing = $True
ErrorAction = $script:resourceStrings.Preferences.ErrorAction
If ($Raw.IsPresent) {
$tempFile = New-TemporaryFile
$params = @{
Uri = $Uri
OutFile = $tempFile
ContentType = $ContentType
UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
UseBasicParsing = $True
ErrorAction = $script:resourceStrings.Preferences.ErrorAction
}
$Response = Invoke-WebRequest @params
$Content = Get-Content -Path $TempFile
}
Else {
$params = @{
Uri = $Uri
ContentType = $ContentType
UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
UseBasicParsing = $True
ErrorAction = $script:resourceStrings.Preferences.ErrorAction
}
$Response = Invoke-WebRequest @params
$Content = $Response.Content
}
$Request = Invoke-WebRequest @params
}
catch [System.Net.WebException] {
Write-Warning -Message ($($MyInvocation.MyCommand))
Expand All @@ -34,12 +53,8 @@ Function Invoke-WebContent {
Write-Warning -Message "$($MyInvocation.MyCommand): failed to invoke request to: $Uri."
Throw $_.Exception.Message
}

If ($Request.StatusCode -eq "200") {
Write-Output -InputObject $Request.Content
}
Else {
Write-Warning -Message "$($MyInvocation.MyCommand): no valid response."
finally {
Write-Output -InputObject $Content
}
}
Else {
Expand Down
30 changes: 18 additions & 12 deletions Get.Software/Public/Get-AdobeAcrobatReaderDC.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Function Get-AdobeAcrobatReaderDC {
Return downloads for Windows or macOS platforms. Use "win" or "mac" or specify both to return downloads for both platforms.
.EXAMPLE
Get-AdobeReaderUri -Platform
Get-AdobeAcrobatReaderDC -Platform
Description:
Returns an array with installer type, language and download URL for Windows.
Returns an array with version, installer type, language and download URL for Windows.
.EXAMPLE
Get-AdobeReaderUri -Platform win, mac
Get-AdobeAcrobatReaderDC -Platform win, mac
Description:
Returns an array with installer type, language and download URL for both Windows and macOS.
Returns an array with version, installer type, language and download URL for both Windows and macOS.
#>
[CmdletBinding()]
Param (
Expand All @@ -38,59 +38,65 @@ Function Get-AdobeAcrobatReaderDC {
# Get current version
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.AdobeAcrobatReaderDC.Uri `
-ContentType $script:resourceStrings.Applications.AdobeAcrobatReaderDC.ContentType
$version = $Content.Replace(".", "")

# Construct download list
If ($Null -ne $version) {
If ($Null -ne $Content) {
$versionString = $Content.Replace(".", "")
ForEach ($plat in $Platform) {
Switch ($plat) {
"win" {
$ftpUrl = "ftp://ftp.adobe.com/pub/adobe/reader/$plat/AcrobatDC/"
ForEach ($lang in $script:resourceStrings.Applications.AdobeAcrobatReaderDC.Languages) {
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "Windows"
Type = "Installer"
Language = $lang
URL = "$($ftpUrl)$($version)/AcroRdrDC$($version)_$($lang).exe"
URL = "$($ftpUrl)$($versionString)/AcroRdrDC$($versionString)_$($lang).exe"
}
Write-Output -InputObject $PSObject
}
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "Windows"
Type = "Updater"
Language = "Neutral"
URL = "$($ftpUrl)$($version)/AcroRdrDC$($version).msp"
URL = "$($ftpUrl)$($versionString)/AcroRdrDC$($versionString).msp"
}
Write-Output -InputObject $PSObject
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "Windows"
Type = "Updater"
Language = "Multi"
URL = "$($ftpUrl)$($version)/AcroRdrDC$($version)_MUI.msp"
URL = "$($ftpUrl)$($versionString)/AcroRdrDC$($versionString)_MUI.msp"
}
Write-Output -InputObject $PSObject
}
"mac" {
$ftpUrl = "ftp://ftp.adobe.com/pub/adobe/reader/$plat/AcrobatDC/"
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "macOS"
Type = "Installer"
Language = "Multi"
URL = "$($ftpUrl)$($version)/AcroRdrDC_$($version)_MUI.dmg"
URL = "$($ftpUrl)$($versionString)/AcroRdrDC_$($versionString)_MUI.dmg"
}
Write-Output -InputObject $PSObject
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "macOS"
Type = "Updater"
Language = "Multi"
URL = "$($ftpUrl)$($version)/AcroRdrDCUpd$($version)_MUI.dmg"
URL = "$($ftpUrl)$($versionString)/AcroRdrDCUpd$($versionString)_MUI.dmg"
}
Write-Output -InputObject $PSObject
$PSObject = [PSCustomObject] @{
Version = $Content
Platform = "macOS"
Type = "Updater"
Language = "Multi"
URL = "$($ftpUrl)$($version)/AcroRdrDCUpd$($version)_MUI.pkg"
URL = "$($ftpUrl)$($versionString)/AcroRdrDCUpd$($versionString)_MUI.pkg"
}
Write-Output -InputObject $PSObject
}
Expand Down
33 changes: 26 additions & 7 deletions Get.Software/Public/Get-VideoLanVlcPlayer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,30 @@ Function Get-VideoLanVlcPlayer {
[CmdletBinding()]
Param()

# Get VLC Player versions and URLs from private functions
$Win32 = Get-VlcPlayerUpdateWin -Platform Win32
$Win64 = Get-VlcPlayerUpdateWin -Platform Win64
$macOS = Get-VlcPlayerUpdateMac

# Return output object to the pipeline
Write-Output $Win32, $Win64, $macOS
#region Get current version for macOS
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.VideoLanVlcPlayer.UriMac
$xml = [System.XML.XMLDocument] $Content
$latest = $xml.rss.channel.item[$xml.rss.channel.item.Length - 1]
$version = $latest.title.Trim("Version ")
$PSObject = [PSCustomObject] @{
Version = $version
Platform = "macOS"
URI = "https://get.videolan.org/vlc/$version/macosx/vlc-$version.dmg"
}
Write-Output -InputObject $PSObject
#endregion

#region Get current version for Windows
ForEach ($platform in @("UriWin64", "UriWin32")) {
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.VideoLanVlcPlayer.$platform -Raw

# Construct the output; Return the custom object to the pipeline
$PSObject = [PSCustomObject]@{
Version = $Content[0]
Platform = $platform.Replace("Uri", "")
URI = $Content[1]
}
Write-Output $PSObject
}
#endregion
}
40 changes: 34 additions & 6 deletions Get.Software/Public/Get-XenServerTools.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
Function Get-XenServerTools {
$Uri = "https://pvupdates.vmd.citrix.com/updates.latest.tsv"
$TempFile = New-TemporaryFile
Invoke-WebRequest -Uri $Uri -OutFile $TempFile
$RawContent = Get-Content $TempFile
$Table = $RawContent | ConvertFrom-Csv -Delimiter "`t" -Header "Uri", "Version", "Size", "Architecture", "Index"
Write-Output $Table
<#
.SYNOPSIS
Get the current version and download URL for the XenServer tools.
.NOTES
Site: https://stealthpuppy.com
Author: Aaron Parker
Twitter: @stealthpuppy
.LINK
https://github.com/aaronparker/Get.Software
.EXAMPLE
Get-XenServerTools
Description:
Returns the current version and download URLs for XenServer tools.
#>
[CmdletBinding()]
Param()

#region Get XenServer tool details
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.XenServerTools.Uri -Raw
$Table = $Content | ConvertFrom-Csv -Delimiter "`t" -Header "Uri", "Version", "Size", "Architecture", "Index"
ForEach ($row in $Table) {
$PSObject = [PSCustomObject]@{
Version = $row.Version
Architecture = $row.Architecture
URI = $row.Uri
Size = $row.Size
}
Write-Output $PSObject
}
#endregion
}

0 comments on commit 31b660b

Please sign in to comment.