-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoke-VersionCheck.ps1
More file actions
22 lines (22 loc) · 1.38 KB
/
Invoke-VersionCheck.ps1
File metadata and controls
22 lines (22 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function Global:Invoke-VersionCheck {
param(
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
$InputObject
)
process {
Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 1 -Value "Checking version for '$($InputObject.Name)'"
$InputObject | Add-Member UnknownVersion (Get-AppVersion -AppXmlInfo $InputObject.XML.application.version.unknown -Format $InputObject.XML.application.version.unknown.format)
$InputObject | Add-Member KnownVersion (Get-AppVersion -AppXmlInfo $InputObject.XML.application.version.known -Path $InputObject.Path)
if ($InputObject.UnknownVersion.String -eq '0.0') {
Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 1 -Value "$($InputObject.Name) - Fail to read remote version!"
$Global:VersionErrors += "$($InputObject.Name) - Fail to read remote version!"
}
if ($InputObject.UnknownVersion.Object -ne $InputObject.KnownVersion.Object) {
Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 1 -Value "'$($InputObject.Name)' - $($InputObject.UnknownVersion.String) != $($InputObject.KnownVersion.String)"
}
Write-Output $_
}
}