Skip to content

Commit

Permalink
2013 update; add check file ProductVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Jul 31, 2018
1 parent 02d46e6 commit 709cf80
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 37 deletions.
32 changes: 17 additions & 15 deletions VcRedist/Manifests/VisualCRedistributablesAll.xml
Expand Up @@ -227,22 +227,24 @@
<Download>https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x86" Release="2013" Install="/install /passive /norestart">
<Platform Architecture="x64" Release="2013" Install="/install /passive /norestart">
<Redistributable>
<Name>Visual C++ Redistributable Packages for Visual Studio 2013</Name>
<ShortName>RTM</ShortName>
<URL>https://www.microsoft.com/en-us/download/details.aspx?id=40784</URL>
<ProductCode>{f65db027-aff3-4070-886a-0d87064aabb1}</ProductCode>
<Version>12.0.30501.0</Version>
<Download>https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe</Download>
<Name>Microsoft Visual C++ 2013 Update 5 Redistributable Package</Name>
<ShortName>Update5</ShortName>
<URL>https://support.microsoft.com/en-us/help/4032938/update-for-visual-c-2013-redistributable-package</URL>
<ProductCode>{042d26ef-3dbe-4c25-95d3-4c1b11b235a7}</ProductCode>
<Version>12.0.40664.0</Version>
<Download>https://download.visualstudio.microsoft.com/download/pr/10912041/cee5d6bca2ddbcd039da727bf4acb48a/vcredist_x64.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x86" Release="2013" Install="/install /passive /norestart">
<Redistributable>
<Name>Update for Visual C++ 2013 and Visual C++ Redistributable Package</Name>
<ShortName>Update</ShortName>
<URL>https://support.microsoft.com/en-us/help/3179560/update-for-visual-c-2013-and-visual-c-redistributable-package</URL>
<ProductCode>{61087a79-ac85-455c-934d-1fa22cc64f36}</ProductCode>
<Version>12.0.40660.0</Version>
<Download>https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x86.exe</Download>
<Name>Microsoft Visual C++ 2013 Update 5 Redistributable Package</Name>
<ShortName>Update5</ShortName>
<URL>https://support.microsoft.com/en-us/help/4032938/update-for-visual-c-2013-redistributable-package</URL>
<ProductCode>{9dff3540-fc85-4ed5-ac84-9e3c7fd8bece}</ProductCode>
<Version>12.0.40664.0</Version>
<Download>https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x64" Release="2015" Install="/install /passive /norestart">
Expand Down Expand Up @@ -272,7 +274,7 @@
<URL>https://www.visualstudio.com/downloads/</URL>
<ProductCode>{80586c77-db42-44bb-bfc8-7aebbb220c00}}</ProductCode>
<Version>14.14.26429.4</Version>
<Download>https://aka.ms/vs/15/release/vc_redist.x86.exe</Download>
<Download>https://aka.ms/vs/15/release/vc_redist.x64.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x86" Release="2017" Install="/install /passive /norestart">
Expand All @@ -282,7 +284,7 @@
<URL>https://www.visualstudio.com/downloads/</URL>
<ProductCode>{2019b6a0-8533-4a04-ac0e-b2c10bdb9841}</ProductCode>
<Version>14.14.26429.4</Version>
<Download>https://aka.ms/vs/15/release/vc_redist.x64.exe</Download>
<Download>https://aka.ms/vs/15/release/vc_redist.x86.exe</Download>
</Redistributable>
</Platform>
</Redistributables>
24 changes: 12 additions & 12 deletions VcRedist/Manifests/VisualCRedistributablesSupported.xml
Expand Up @@ -63,22 +63,22 @@
</Platform>
<Platform Architecture="x64" Release="2013" Install="/install /passive /norestart">
<Redistributable>
<Name>Update for Visual C++ 2013 and Visual C++ Redistributable Package</Name>
<ShortName>Update</ShortName>
<URL>https://support.microsoft.com/en-us/help/3179560/update-for-visual-c-2013-and-visual-c-redistributable-package</URL>
<ProductCode>{ef6b00ec-13e1-4c25-9064-b2f383cb8412}</ProductCode>
<Version>12.0.40660.0</Version>
<Download>https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe</Download>
<Name>Microsoft Visual C++ 2013 Update 5 Redistributable Package</Name>
<ShortName>Update5</ShortName>
<URL>https://support.microsoft.com/en-us/help/4032938/update-for-visual-c-2013-redistributable-package</URL>
<ProductCode>{042d26ef-3dbe-4c25-95d3-4c1b11b235a7}</ProductCode>
<Version>12.0.40664.0</Version>
<Download>https://download.visualstudio.microsoft.com/download/pr/10912041/cee5d6bca2ddbcd039da727bf4acb48a/vcredist_x64.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x86" Release="2013" Install="/install /passive /norestart">
<Redistributable>
<Name>Update for Visual C++ 2013 and Visual C++ Redistributable Package</Name>
<ShortName>Update</ShortName>
<URL>https://support.microsoft.com/en-us/help/3179560/update-for-visual-c-2013-and-visual-c-redistributable-package</URL>
<ProductCode>{61087a79-ac85-455c-934d-1fa22cc64f36}</ProductCode>
<Version>12.0.40660.0</Version>
<Download>https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x86.exe</Download>
<Name>Microsoft Visual C++ 2013 Update 5 Redistributable Package</Name>
<ShortName>Update5</ShortName>
<URL>https://support.microsoft.com/en-us/help/4032938/update-for-visual-c-2013-redistributable-package</URL>
<ProductCode>{9dff3540-fc85-4ed5-ac84-9e3c7fd8bece}</ProductCode>
<Version>12.0.40664.0</Version>
<Download>https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe</Download>
</Redistributable>
</Platform>
<Platform Architecture="x64" Release="2015" Install="/install /passive /norestart">
Expand Down
93 changes: 93 additions & 0 deletions VcRedist/Private/Get-FileMetadata.ps1
@@ -0,0 +1,93 @@
Function Get-FileMetadata {
<#
.SYNOPSIS
Get file metadata from files in a target folder.
.DESCRIPTION
Retreives file metadata from files in a target path, or file paths, to display information on the target files.
Useful for understanding application files and identifying metadata stored in them. Enables the administrator to view metadata for application control scenarios.
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
.LINK
https://github.com/aaronparker/Install-VisualCRedistributables
.OUTPUTS
[System.Array]
.PARAMETER Path
A target path in which to scan files for metadata.
.PARAMETER Include
Gets only the specified items.
.EXAMPLE
Get-FileMetadata -Path "C:\Users\aaron\AppData\Local\GitHubDesktop"
Description:
Scans the folder specified in the Path variable and returns the metadata for each file.
#>
[CmdletBinding(SupportsShouldProcess = $False)]
[OutputType([Array])]
Param (
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True, `
HelpMessage = 'Specify a target path, paths or a list of files to scan for metadata.')]
[Alias('FullName', 'PSPath')]
[string[]]$Path,

[Parameter(Mandatory = $False, Position = 1, ValueFromPipeline = $False, `
HelpMessage = 'Gets only the specified items.')]
[Alias('Filter')]
[string[]]$Include = @('*.exe', '*.dll', '*.ocx', '*.msi', '*.ps1', '*.vbs', '*.js', '*.cmd', '*.bat')
)
Begin {
# Measure time taken to gather data
$StopWatch = [system.diagnostics.stopwatch]::StartNew()

# RegEx to grab CN from certificates
$FindCN = "(?:.*CN=)(.*?)(?:,\ O.*)"

Write-Verbose "Beginning metadata trawling."
$Files = @()
}
Process {
# For each path in $Path, check that the path exists
ForEach ($Loc in $Path) {
If (Test-Path -Path $Loc -IsValid) {
# Get the item to determine whether it's a file or folder
If ((Get-Item -Path $Loc).PSIsContainer) {
# Target is a folder, so trawl the folder for .exe and .dll files in the target and sub-folders
Write-Verbose "Getting metadata for files in folder: $Loc"
$items = Get-ChildItem -Path $Loc -Recurse -Include $Include
}
Else {
# Target is a file, so just get metadata for the file
Write-Verbose "Getting metadata for file: $Loc"
$items = Get-Item -Path $Loc
}

# Create an array from what was returned for specific data and sort on file path
$Files += $items | Select-Object @{Name = "Path"; Expression = {$_.FullName}}, `
@{Name = "Owner"; Expression = {(Get-Acl -Path $_.FullName).Owner}}, `
@{Name = "Vendor"; Expression = {$(((Get-AcDigitalSignature -Path $_ -ErrorAction SilentlyContinue).Subject -replace $FindCN, '$1') -replace '"', "")}}, `
@{Name = "Company"; Expression = {$_.VersionInfo.CompanyName}}, `
@{Name = "Description"; Expression = {$_.VersionInfo.FileDescription}}, `
@{Name = "Product"; Expression = {$_.VersionInfo.ProductName}}, `
@{Name = "ProductVersion"; Expression = {$_.VersionInfo.ProductVersion}}, `
@{Name = "FileVersion"; Expression = {$_.VersionInfo.FileVersion}}
}
Else {
Write-Error "Path does not exist: $Loc"
}
}
}
End {

# Return the array of file paths and metadata
$StopWatch.Stop()
Write-Verbose "Metadata trawling complete. Script took $($StopWatch.Elapsed.TotalMilliseconds) ms to complete."
Return $Files | Sort-Object -Property Path
}
}
21 changes: 16 additions & 5 deletions VcRedist/Public/Get-VcRedist.ps1
Expand Up @@ -57,7 +57,7 @@ Function Get-VcRedist {
[array] $VcList,

[Parameter(Mandatory = $False, Position = 1, HelpMessage = "Specify a target path to download the Redistributables to.")]
[ValidateScript({ If (Test-Path $_ -PathType 'Container') { $True } Else { Throw "Cannot find path $_" } })]
[ValidateScript( { If (Test-Path $_ -PathType 'Container') { $True } Else { Throw "Cannot find path $_" } })]
[string] $Path,

[Parameter(Mandatory = $False, HelpMessage = "Specify the version of the Redistributables to download.")]
Expand Down Expand Up @@ -101,14 +101,25 @@ Function Get-VcRedist {
}
}

# If the target Redistributable is already downloaded, skip it.
# If running on Windows PowerShell use Start-BitsTransfer, otherwise use Invoke-WebRequest
# If the target Redistributable is already downloaded, compare the version
$target = Join-Path $folder $(Split-Path -Path $Vc.Download -Leaf)
Write-Verbose "Target is $($target)"
$download = $True
If ( Test-Path -Path $target -PathType Leaf ) {
Write-Verbose "$($target) exists. Skipping."
Write-Verbose "$($target) exists. Comparing versions."
$ProductVersion = $(Get-FileMetadata -Path $target).ProductVersion
If ( ($Vc.Version -gt $ProductVersion) -or ($Null -eq $ProductVersion) ) {
# Download the newer version
Write-Verbose "$($Vc.Version) > $ProductVersion. Downloading."
$download = $True
}
Else {
# No need to download
$download = $False
}
}
Else {
If ($download) {
# If running on Windows PowerShell use Start-BitsTransfer, otherwise use Invoke-WebRequest
If ( Get-Command Start-BitsTransfer -ErrorAction SilentlyContinue ) {
If ( $pscmdlet.ShouldProcess($Vc.Download, "BitsDownload") ) {
Start-BitsTransfer -Source $Vc.Download -Destination $target `
Expand Down
2 changes: 1 addition & 1 deletion VcRedist/VcRedist.psd1
Expand Up @@ -12,7 +12,7 @@
RootModule = 'VcRedist.psm1'

# Version number of this module.
ModuleVersion = '1.3.6.56'
ModuleVersion = '1.3.7.56'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
1 change: 0 additions & 1 deletion docs/SUMMARY.MD
Expand Up @@ -23,4 +23,3 @@
* [Get-InstalledVcRedist](function-syntax/get-installedvcredist.md)
* [Change log](change-log.md)
* [Known issues](known-issues.md)

1 change: 0 additions & 1 deletion docs/SUMMARY.md
Expand Up @@ -23,4 +23,3 @@
* [Get-InstalledVcRedist](function-syntax/get-installedvcredist.md)
* [Change log](change-log.md)
* [Known issues](known-issues.md)

5 changes: 5 additions & 0 deletions docs/change-log.md
@@ -1,5 +1,10 @@
# Change log

## v1.3.7.xx

* Update manifests with `2013`, version `12.0.40664`
* Add `UninstallString` to function `Get-InstalledVcRedist` output

## v1.3.6.56

* Add `Get-InstalledVcRedist`, using private function `Get-InstalledSoftware`. Closing issue \#18 with feature request for this function. `Get-InstallSoftware` function by [Adam Bertram](https://4sysops.com/archives/find-the-product-guid-of-installed-software-with-powershell/)
Expand Down
4 changes: 2 additions & 2 deletions docs/known-issues.md
Expand Up @@ -2,5 +2,5 @@

## Import-VcMdtApp

* The bundle doesn't currently add the MDT redistributables in order from oldest to newest. Install order shouldn't matter however.

* The bundle doesn't currently add the MDT redistributables in order from oldest to newest. Install order shouldn't matter however
* 'English - United States' is the only supported language. The module will only download the en-US versions of the Redistributables
5 changes: 5 additions & 0 deletions scripts/Uninstall-VcRedist.ps1
@@ -0,0 +1,5 @@
$InstalledVcRedists = Get-InstalledVcRedist
ForEach ($VcRedist in $InstalledVcRedists) {
Write-Host $VcRedist.Name
Start-Process -FilePath "$env:SystemRoot\System32\cmd.exe" -ArgumentList "/c $($VcRedist.UninstallString) /passive" -Wait
}

0 comments on commit 709cf80

Please sign in to comment.