-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Get-MicrosoftFSLogixApps.ps1
39 lines (34 loc) · 1.6 KB
/
Get-MicrosoftFSLogixApps.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Function Get-MicrosoftFSLogixApps {
<#
.SYNOPSIS
Get the current version and download URL for the Microsoft FSLogix Apps agent.
.NOTES
Site: https://stealthpuppy.com
Author: Aaron Parker
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $False)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)
ForEach ($item in $res.Get.Download.Uri.GetEnumerator()) {
# Follow the download link which will return a 301
$response = Resolve-SystemNetWebRequest -Uri $res.Get.Download.Uri[$item.Key]
# Check returned URL. It should be a go.microsoft.com/fwlink/?linkid style link
If ($Null -ne $response) {
# Construct the output; Return the custom object to the pipeline
$PSObject = [PSCustomObject] @{
Version = [RegEx]::Match($($response.ResponseUri.AbsoluteUri), $res.Get.Download.MatchVersion).Captures.Value
Date = ConvertTo-DateTime -DateTime $response.LastModified -Pattern $res.Get.Download.DatePattern
Channel = $item.Name
URI = $response.ResponseUri.AbsoluteUri
}
Write-Output -InputObject $PSObject
}
}
}