Skip to content

Commit

Permalink
Get-VMwareTools
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Sep 27, 2019
1 parent 348f70f commit 9684519
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 60 deletions.
11 changes: 11 additions & 0 deletions Get.Software/Get.Software.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
"MatchVersion" : "(\\d+(\\.\\d+){1,4}).*",
"MatchFileTypes" : ".*Version.*(exe|dmg|rpm|deb)",
"MatchDownloadFile" : "<a[^>]*>([^<]+)<\/a>"
},
"VMwareTools" : {
"Uri" : "https://packages.vmware.com/tools/versions",
"DownloadUri" : "https://packages.vmware.com/tools/esx/",
"Platforms" : [
"Windows"
],
"Architecture" : [
"x64"
],
"MatchFileName" : "[0-9]+\\.[0-9]+\\.[0-9]+\\-[0-9]+\\-x86_64"
}
},
"Preferences" : {
Expand Down
6 changes: 3 additions & 3 deletions Get.Software/Get.Software.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
'Get-LibreOfficeUri', 'Get-LibreOfficeVersion',
'Get-MicrosoftSsmsUri', 'Get-MicrosoftSsmsVersion',
'Get-MicrosoftVisualStudioCode', 'Get-MozillaFirefox',
'Get-NotepadPpUri',
'Get-NotepadPpUri', "Get-VMwareTools",
'Get-NotepadPpVersion', 'Get-PaintDotNetUri',
'Get-PaintDotNetVersion', 'Get-VideoLanVlcPlayer',
'Get-OracleVirtualBox', 'Get-VmwareToolsUri',
'Get-VmwareToolsVersion', 'Get-CitrixXenServerTools', 'Get-ZoomVersion')
'Get-OracleVirtualBox',
'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.
CmdletsToExport = @()
Expand Down
4 changes: 2 additions & 2 deletions Get.Software/Public/Get-CitrixXenServerTools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Function Get-CitrixXenServerTools {
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.CitrixXenServerTools.Uri -Raw
$Table = $Content | ConvertFrom-Csv -Delimiter "`t" -Header "Uri", "Version", "Size", "Architecture", "Index"
ForEach ($row in $Table) {
$PSObject = [PSCustomObject]@{
$PSObject = [PSCustomObject] @{
Version = $row.Version
Architecture = $row.Architecture
URI = $row.Uri
Size = $row.Size
}
Write-Output $PSObject
Write-Output -InputObject $PSObject
}
#endregion
}
52 changes: 52 additions & 0 deletions Get.Software/Public/Get-VMwareTools.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Function Get-VMwareTools {
<#
.SYNOPSIS
Get the current version and download URL for the VMware Tools.
.NOTES
Author: Bronson Magnan
Twitter: @cit_bronson
.LINK
https://github.com/aaronparker/Get.Software
.EXAMPLE
Get-VMwareTools
Description:
Returns the current version and download URLs for VMware Tools.
#>
[CmdletBinding()]
Param()

# Read the VMware version-mapping file
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.VMwareTools.Uri -Raw

# Format the results returns and convert into an array that we can sort and use
$Lines = $Content | Where-Object { $_ –notmatch "^#" }
$Lines = $Lines | ForEach-Object { $_ -replace '\s+', ',' }
$VersionTable = $Lines | ConvertFrom-Csv -Delimiter "," -Header 'Client', 'Server', 'Version', 'Build' | Sort-Object -Property Server -Descending

ForEach ($platform in $script:resourceStrings.Applications.VMwareTools.Platforms) {
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()
$Content = Invoke-WebContent -Uri $Uri
$Line = ($Content.split("`n") | `
Select-String -Pattern $script:resourceStrings.Applications.VMwareTools.MatchFileName).ToString().Trim()
$filename = (($Line.Replace(" ", "").Split("=") | `
Select-String -Pattern $script:resourceStrings.Applications.VMwareTools.MatchFileName).ToString().Trim().Split("`""))[1]

# Build the output object
$PSObject = [PSCustomObject] @{
Version = ($VersionTable | Select-Object -First 1).Version
Platform = $platform
Architecture = $architecture
URI = "https://packages.vmware.com/tools/esx/latest/$($platform.ToLower())/$architecture/$filename"
ESXi = (($VersionTable | Select-Object -First 1).Server -replace "esx/", "")
}
Write-Output -InputObject $PSObject
}
}
}
2 changes: 1 addition & 1 deletion Get.Software/Public/Get-VideoLanVlcPlayer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Function Get-VideoLanVlcPlayer {
$Content = Invoke-WebContent -Uri $script:resourceStrings.Applications.VideoLanVlcPlayer.$platform -Raw

# Construct the output; Return the custom object to the pipeline
$PSObject = [PSCustomObject]@{
$PSObject = [PSCustomObject] @{
Version = $Content[0]
Platform = $platform.Replace("Uri", "")
URI = $Content[1]
Expand Down
25 changes: 0 additions & 25 deletions Get.Software/Public/Get-VmwareToolsUri.ps1

This file was deleted.

29 changes: 0 additions & 29 deletions Get.Software/Public/Get-VmwareToolsVersion.ps1

This file was deleted.

0 comments on commit 9684519

Please sign in to comment.