Skip to content

Commit f666014

Browse files
authoredSep 28, 2024··
Merge pull request #748 from aaronparker/apps
Apps
2 parents e798c3a + 86d1c04 commit f666014

10 files changed

+125
-48
lines changed
 
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
function Get-MicrosoftWindowsApp {
2+
<#
3+
.NOTES
4+
Site: https://stealthpuppy.com
5+
Author: Aaron Parker
6+
Twitter: @stealthpuppy
7+
#>
8+
[OutputType([System.Management.Automation.PSObject])]
9+
[CmdletBinding(SupportsShouldProcess = $false)]
10+
param (
11+
[Parameter(Mandatory = $false, Position = 0)]
12+
[ValidateNotNull()]
13+
[System.Management.Automation.PSObject]
14+
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
15+
)
16+
17+
foreach ($Url in $res.Get.Download.Uri) {
18+
# Grab the download link headers to find the file name
19+
$params = @{
20+
Uri = $Url
21+
Method = "Head"
22+
ReturnObject = "Headers"
23+
}
24+
$Headers = Invoke-EvergreenWebRequest @params
25+
if ($null -ne $Headers) {
26+
27+
# Match filename
28+
$Filename = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchFilename).Captures.Groups[1].Value
29+
30+
# Match version
31+
$Version = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchVersion).Captures.Value
32+
if ($Version.Length -eq 0) { $Version = "Unknown" }
33+
34+
# Construct the output; Return the custom object to the pipeline
35+
$PSObject = [PSCustomObject] @{
36+
Version = $Version
37+
Date = $Headers['Last-Modified'] | Select-Object -First 1
38+
Architecture = Get-Architecture -String $Filename
39+
Filename = $Filename
40+
URI = $Url
41+
}
42+
Write-Output -InputObject $PSObject
43+
}
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"Name": "Microsoft Windows App",
3+
"Source": "https://learn.microsoft.com/en-us/windows-app/whats-new",
4+
"Get": {
5+
"Update": {},
6+
"Download": {
7+
"Uri": [
8+
"https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RW1pC6G",
9+
"https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RW1pHol",
10+
"https://query.prod.cms.rt.microsoft.com/cms/api/am/binary/RW1pJV5"
11+
],
12+
"ApiUri": "https://query.prod.cms.rt.microsoft.com/cms/api",
13+
"ApiHeader1": "X-CMS-Tenant",
14+
"ApiHeader2": "X-CMS-Type",
15+
"ApiHeader3": "X-CMS-DocumentId",
16+
"MatchFilename": "(WindowsApp_.*_Release_.*.msix)",
17+
"MatchVersion": "(\\d+(\\.\\d+){1,4})",
18+
"SplitText": "filename=",
19+
"DatePattern": "ddd, dd MMM yyyy HH:mm:ss GMT"
20+
}
21+
},
22+
"Install": {
23+
"Setup": "",
24+
"Physical": {
25+
"Arguments": "",
26+
"PostInstall": []
27+
},
28+
"Virtual": {
29+
"Arguments": "",
30+
"PostInstall": []
31+
}
32+
}
33+
}

‎docs/invoke.md ‎docs/api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ PS C:\> Invoke-RestMethod -Uri "https://evergreen-api.stealthpuppy.com/app/Unsup
4141
Invoke-RestMethod: {message: "Application not found. List all apps for valid application names. Application names are case sensitive.}
4242
```
4343

44-
## Invoke-EvergreenApp
44+
## Get-EvergreenAppFromApi
4545

46-
Evergreen includes the `Invoke-EvergreenApp` function that is used in much the same way as `Get-EvergreenApp`. This function is simpler than using `Invoke-RestMethod`, and it automatically filters for available applications. For example, to query the API for application data for Microsoft Edge, use:
46+
Evergreen includes the `Get-EvergreenAppFromApi` function that is used in much the same way as `Get-EvergreenApp`. This function is simpler than using `Invoke-RestMethod`, and it automatically filters for available applications. For example, to query the API for application data for Microsoft Edge, use:
4747

4848
```powershell
49-
PS C:\> Invoke-EvergreenApp -Name "MicrosoftEdge"
49+
PS C:\> Get-EvergreenAppFromApi -Name "MicrosoftEdge"
5050
5151
Version : 89.0.774.76
5252
Platform : Windows
@@ -63,5 +63,5 @@ This returns the current version and download URLs for Microsoft Edge using the
6363
Just as with `Get-EvergreenApp`, the output can be filtered for the specific application installer with `Where-Object`. The example below returns the current version and download URL for the Stable channel of the 64-bit Enterprise ring of Microsoft Edge.
6464

6565
```powershell
66-
Invoke-EvergreenApp -Name "MicrosoftEdge" | Where-Object { $_.Architecture -eq "x64" -and $_.Channel -eq "Stable" -and $_.Release -eq "Enterprise" }
66+
Get-EvergreenAppFromApi -Name "MicrosoftEdge" | Where-Object { $_.Architecture -eq "x64" -and $_.Channel -eq "Stable" -and $_.Release -eq "Enterprise" }
6767
```

‎docs/getlibraryapp.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Install an application from a library
22

3-
Once an Evergreen library is populated with application downloads, it can be queried for a specific application for the available versions of that application with `Get-EvergreenLibraryApp`. Details of the Evergreen library must be passed to `Get-EvergreenLibraryApp` from `Get-EvergreenLibrary`.
3+
Once an Evergreen library is populated with application downloads, it can be queried for a specific application for the available versions of that application with `Get-EvergreenAppFromLibrary`. Details of the Evergreen library must be passed to `Get-EvergreenAppFromLibrary` from `Get-EvergreenLibrary`.
44

55
The application details that are returned will include the version and path to the installer binaries for installing the target application. Application details are returned in descending order of version, thus the latest available version can be used or the details filtered for a specific version.
66

77
## Examples
88

9-
In this example, details of the target library at `\\server\EvergreenLibrary` are returned with `Get-EvergreenLibrary` and placed into a variable `$Library`. `Get-EvergreenLibraryApp` is then used to search for Microsoft Visual Studio Code in the library.
9+
In this example, details of the target library at `\\server\EvergreenLibrary` are returned with `Get-EvergreenLibrary` and placed into a variable `$Library`. `Get-EvergreenAppFromLibrary` is then used to search for Microsoft Visual Studio Code in the library.
1010

1111
```powershell
1212
PS C:\> $Library = Get-EvergreenLibrary -Path "\\server\EvergreenLibrary"
13-
PS C:\> Get-EvergreenLibraryApp -Inventory $Library -Name "MicrosoftVisualStudioCode"
13+
PS C:\> Get-EvergreenAppFromLibrary -Inventory $Library -Name "MicrosoftVisualStudioCode"
1414
1515
Version : 1.74.3
1616
URI : https://az764295.vo.msecnd.net/stable/97dec172d3256f8ca4bfb2143f3f76b503ca0534/VSCodeSetup-x64-1.74.3.exe
@@ -29,10 +29,10 @@ Channel : Stable
2929
Architecture : x64
3030
```
3131

32-
This syntax can be simplified by passing details of the Evergreen library at `\\server\EvergreenLibrary` to `Get-EvergreenLibraryApp` via the pipeline to return details for Microsoft Visual Studio Code.
32+
This syntax can be simplified by passing details of the Evergreen library at `\\server\EvergreenLibrary` to `Get-EvergreenAppFromLibrary` via the pipeline to return details for Microsoft Visual Studio Code.
3333

3434
```powershell
35-
PS C:\> Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenLibraryApp -Name "MicrosoftVisualStudioCode"
35+
PS C:\> Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenAppFromLibrary -Name "MicrosoftVisualStudioCode"
3636
3737
Version : 1.74.3
3838
URI : https://az764295.vo.msecnd.net/stable/97dec172d3256f8ca4bfb2143f3f76b503ca0534/VSCodeSetup-x64-1.74.3.exe
@@ -54,7 +54,7 @@ Architecture : x64
5454
Application information returned from an Evergreen library can be used in a script to install the latest available version (in this case) of Microsoft Visual Studio Code:
5555

5656
```powershell
57-
$App = Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenLibraryApp -Name "MicrosoftVisualStudioCode" | Select-Object -First 1
57+
$App = Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenAppFromLibrary -Name "MicrosoftVisualStudioCode" | Select-Object -First 1
5858
$params = @{
5959
FilePath = $App.Path
6060
ArgumentList = "/VERYSILENT /NOCLOSEAPPLICATIONS /NORESTARTAPPLICATIONS /NORESTART /SP- /SUPPRESSMSGBOXES /MERGETASKS=!runcode"
@@ -69,7 +69,7 @@ Start-Process @params
6969
Where a specific version of Visual Studio Code needs to be installed instead of the latest version, the specific version can be selected before installing:
7070

7171
```powershell
72-
$App = Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenLibraryApp -Name "MicrosoftVisualStudioCode" | Where-Object { $_.Version -eq "1.74.0" }
72+
$App = Get-EvergreenLibrary -Path "\\server\EvergreenLibrary" | Get-EvergreenAppFromLibrary -Name "MicrosoftVisualStudioCode" | Where-Object { $_.Version -eq "1.74.0" }
7373
$params = @{
7474
FilePath = $App.Path
7575
ArgumentList = "/VERYSILENT /NOCLOSEAPPLICATIONS /NORESTARTAPPLICATIONS /NORESTART /SP- /SUPPRESSMSGBOXES /MERGETASKS=!runcode"

‎docs/index.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
11
# Evergreen
22

3-
Evergreen is a PowerShell module that returns the latest version and download URLs for a set of common Windows applications. The module consists of simple functions to use in scripts when performing several tasks including:
3+
Evergreen is a PowerShell module that returns the latest version and download links for a set of common Windows applications.
44

5-
* Retrieve the latest version of an application to compare against a version already installed or downloaded
6-
* Return the URL for the latest version of the application to download it for local installation or deployment to target machines
5+
## Trust
76

8-
Evergreen is intended for use with solutions used to automate software deployments. These solutions could be:
7+
The goal of this project is to provide trust. Evergreen executes in your environment and queries application vendor sources only. To find application versions, Evergreen queries the same update APIs used by the application to find new updates or a source owned by the vendor. This means that you can trust what Evergreen returns because there is no middle man.
98

10-
* Image creation with Hashicorp Packer - images can be created with the latest version of a set of applications
11-
* Import applications into Configuration Manager or [Microsoft Intune](https://github.com/aaronparker/packagefactory) - keep up to date with the latest versions of applications
12-
* Validating or auditing a desktop image to ensure the current version of an application is installed
13-
* Create a [library of application installers](https://stealthpuppy.com/apptracker) - by regularly running Evergreen functions, you can retrieve and download the current version of an application and store it in an application directory structure for later use
9+
## Why
10+
11+
Evergreen helps solve several challenges including:
12+
13+
* Finding the latest version of an application to compare against a version already installed or downloaded
14+
* Finding the URL for the latest application installer to download it for local installation (via scripted install or in a gold image) or deployment to target machines (e.g. Intune or ConfigMgr)
15+
16+
Evergreen helps to automate software deployments. These could be:
17+
18+
* Gold image creation with Hashicorp Packer - images can be created with the latest version of a set of applications
19+
* Import applications into the Microsoft Deployment Toolkit, Configuration Manager or [Microsoft Intune](https://github.com/aaronparker/packagefactory) - stay current with the latest versions of applications
20+
* Validating or auditing a Windows image or machine for installed application versions
21+
* Create a [library of application installers](https://stealthpuppy.com/apptracker) - by regularly running Evergreen functions, you can retrieve and download the current version of an application and store it for later use
1422
* Submitting manifests to `Winget` or `Chocolatey` or similar - Evergreen can return an object with a version number and download URL that can be used to construct manifests for the most recent versions
1523

24+
There are several community and commercial solutions that manage application deployment and updates already. This module isn't intended to compete against those, and Evergreen isn't intended to be a fully featured package manager for Windows. Evergreen can be complementary to 3rd party solutions
25+
1626
## Functions
1727

1828
Primary functions in Evergreen are:
1929

2030
* `Get-EvergreenApp` - returns details of the latest release of an application including the version number and download URL for supported applications. Runs in your environment
31+
* `Save-EvergreenApp` - simplifies downloading application installers returned from `Get-EvergreenApp`
2132
* `Get-EvergreenEndpointFromApi` - returns details of the latest release of an application including the version number and download URL from the Evergreen API
22-
* `Save-EvergreenApp` - simplifies downloading application URLs returned from `Get-EvergreenApp`
2333
* `Find-EvergreenApp` - lists applications supported by the module
2434
* `Test-EvergreenApp` - tests that the URIs returned by `Get-EvergreenApp` are valid
2535
* `New-EvergreenLibrary` - creates a new Evergreen library for downloading and maintaining multiple versions of application installers

‎docs/under.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@ Evergreen includes the following directory structure:
1010

1111
* `<ModuleBase>/Public` - public functions including `Get-EvergreenApp`, `Find-EvergreenApp` and `Save-EvergreenApp`
1212
* `<ModuleBase>/Apps` - internal per-application functions that contain the logic for retrieving application details. These are often unique for each application
13+
* `<ModuleBase>/Shared` - internal functions used by specific apps to reduce repeated code
1314
* `<ModuleBase>/Manifests` - each application includes a manifest in JSON format that includes application specific details used by the per-application functions. These describe details of the application including URLs used to determine the latest version of the application
1415
* `<ModuleBase>/Private` - internal functions containing reusable code
1516

1617
### Public
1718

1819
The `Public` folder includes all functions exported from Evergreen:
1920

21+
* `ConvertTo-DotNetVersionClass.ps1`
2022
* `Export-EvergreenApp.ps1`
2123
* `Export-EvergreenManifest.ps1`
2224
* `Find-EvergreenApp.ps1`
2325
* `Get-EvergreenApp.ps1`
26+
* `Get-EvergreenAppFromApi.ps1`
27+
* `Get-EvergreenAppFromLibrary.ps1`
28+
* `Get-EvergreenEndpointFromApi.ps1`
2429
* `Get-EvergreenLibrary.ps1`
25-
* `Invoke-EvergreenApp.ps1`
26-
* `Invoke-EvergreenLibraryUpdate.ps1`
2730
* `New-EvergreenLibrary.ps1`
2831
* `Save-EvergreenApp.ps1`
32+
* `Start-EvergreenLibraryUpdate.ps1`
2933
* `Test-EvergreenApp.ps1`
3034

3135
### Apps

‎docs/updatelibrary.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Update an Evergreen Library
22

3-
To update a library, use `Invoke-EvergreenLibraryUpdate` - this function will read the `EvergreenLibrary.json` file and use `Get-EvergreenApp` and `Save-EvergreenApp` to populate the library with the application installers and maintain a manifest of the application version information for later reference.
3+
To update a library, use `Start-EvergreenLibraryUpdate` - this function will read the `EvergreenLibrary.json` file and use `Get-EvergreenApp` and `Save-EvergreenApp` to populate the library with the application installers and maintain a manifest of the application version information for later reference.
44

55
Here's an example - `EvergreenLibrary.json` contains the following entry for Microsoft Teams:
66

@@ -33,12 +33,12 @@ Each time a new version of Team installer is downloaded, `MicrosoftTeams.json` i
3333

3434
## How to update a library
3535

36-
`Invoke-EvergreenLibraryUpdate` has a single parameter - `-Path`, which should be the path to the Evergreen library:
36+
`Start-EvergreenLibraryUpdate` has a single parameter - `-Path`, which should be the path to the Evergreen library:
3737

3838
```powershell
39-
Invoke-EvergreenLibraryUpdate -Path "\\server\EvergreenLibrary"
39+
Start-EvergreenLibraryUpdate -Path "\\server\EvergreenLibrary"
4040
```
4141

4242
If a path is specified that does not contain `EvergreenLibrary.json` and error will be thrown.
4343

44-
To download new application installers when a new version is detected, `Invoke-EvergreenLibraryUpdate` can be run via a scheduled task or other automation tools. This provides a simple method to update the library and make new application available for install or packaging.
44+
To download new application installers when a new version is detected, `Start-EvergreenLibraryUpdate` can be run via a scheduled task or other automation tools. This provides a simple method to update the library and make new application available for install or packaging.

‎docs/why.md

-15
This file was deleted.

‎mkdocs.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ extra:
126126
# Page tree
127127
nav:
128128
- Home:
129-
- Introduction: index.md
130-
- Why Evergreen: why.md
129+
- About: index.md
131130
- How Evergreen works: how.md
132131
- Supported apps: apps.md
133132
- Getting started:
@@ -145,7 +144,7 @@ nav:
145144
- Retrieve details from a library: getlibrary.md
146145
- Install an application from a library: getlibraryapp.md
147146
- Evergreen API:
148-
- How to use the Evergreen API: invoke.md
147+
- How to use the Evergreen API: api.md
149148
- List endpoints used by Evergreen: endpoints.md
150149
- Resources:
151150
- Troubleshooting: troubleshoot.md
@@ -159,12 +158,13 @@ nav:
159158
- Save-EvergreenApp: help/en-US/Save-EvergreenApp.md
160159
- Test-EvergreenApp: help/en-US/Test-EvergreenApp.md
161160
- New-EvergreenLibrary: help/en-US/New-EvergreenLibrary.md
162-
- Invoke-EvergreenApp: help/en-US/Invoke-EvergreenApp.md
163-
- Invoke-EvergreenLibraryUpdate: help/en-US/Invoke-EvergreenLibraryUpdate.md
161+
- Start-EvergreenLibraryUpdate: help/en-US/Start-EvergreenLibraryUpdate.md
164162
- Get-EvergreenLibrary: help/en-US/Get-EvergreenLibrary.md
165-
- Get-EvergreenLibraryApp: help/en-US/Get-EvergreenLibraryApp.md
163+
- Get-EvergreenAppFromLibrary: help/en-US/Get-EvergreenAppFromLibrary.md
166164
- Export-EvergreenApp: help/en-US/Export-EvergreenApp.md
167165
- Export-EvergreenManifest: help/en-US/Export-EvergreenManifest.md
168-
- Get-EvergreenEndpoint: help/en-US/Get-EvergreenEndpoint.md
166+
- Get-EvergreenAppFromApi: help/en-US/Get-EvergreenAppFromApi.md
167+
- Get-EvergreenEndpointFromApi: help/en-US/Get-EvergreenEndpointFromApi.md
168+
- ConvertTo-DotNetVersionClass: help/en-US/ConvertTo-DotNetVersionClass.md
169169
- App Tracker: https://stealthpuppy.com/apptracker/
170170
- PSPackageFactory: https://stealthpuppy.com/packagefactory/

0 commit comments

Comments
 (0)
Please sign in to comment.