Skip to content

Save-EvergreenApp

SYNOPSIS

Downloads target URIs passed to this function from Get-EvergreenApp into a directory structure.

SYNTAX

Path (Default)

Save-EvergreenApp [-InputObject] <PSObject> [[-Path] <FileInfo>] [-Proxy <String>]
 [-ProxyCredential <PSCredential>] [-UserAgent <String>] [-Force] [-NoProgress] [-WhatIf] [-Confirm]
 [<CommonParameters>]

CustomPath

Save-EvergreenApp [-InputObject] <PSObject> [[-CustomPath] <FileInfo>] [-Proxy <String>]
 [-ProxyCredential <PSCredential>] [-UserAgent <String>] [-Force] [-NoProgress] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Saves target URLs passed to this function from Get-EvergreenApp output to into a directory structure below -Path using the properties from the object passed to the function.

Get-EvergreenApp will return an object that may include application properties including (in the following order) - Product, Track, Channel, Release, Ring, Version, Language, and (processor) Architecture. Only properties that exist on the target object will be used.

This simplifies saving the target application installers or updaters into a consistent directory structure without having to build the target directory structure yourself or deal with other functions to download the file.

To override the default behaviour that creates the directory structure based on the properties of the object passed to the function, use the -CustomPath parameter to specify an exact path to save files into. Note that this method download the first file and then will skip files from an object passed from Get-EvergreenApp that includes files with the same name.

EXAMPLES

EXAMPLE 1

Get-EvergreenApp -Name "AdobeAcrobat" | Save-EvergreenApp -Path "C:\Temp\Adobe"

Description: Downloads each file specified in the URIs returned by Get-EvergreenApp -Name "AdobeAcrobat" to a directory structure below C:\Temp\Adobe, resulting in a directory structure per file like: C:\Temp\Adobe\\\\\.

EXAMPLE 2

Get-EvergreenApp -Name "AdobeAcrobat" | Save-EvergreenApp -CustomPath "C:\Temp\Adobe"

Description: Downloads all of the URIs returned by Get-EvergreenApp -Name "AdobeAcrobat" to a directory named C:\Temp\Adobe. All files specified in the URI property will be saved into this directory.

PARAMETERS

-InputObject

Save-EvergreenApp accepts the PSObject from Get-EvergreenApp. Save-EvergreenApp will test for the existence of at least these properties - Version and URI.

Type: PSObject
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Path

The target directory under which a directory structure will be created and application installers saved into. Typically the target path used will be a path per application.

Type: FileInfo
Parameter Sets: Path
Aliases:

Required: False
Position: 2
Default value: (Resolve-Path -Path $PWD)
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-CustomPath

Specify a single directory path where all application installers will be saved into. No sub-directories will be created.

Type: FileInfo
Parameter Sets: CustomPath
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Proxy

Specifies a proxy server for the request, rather than connecting directly to the internet resource. Enter the URI of a network proxy server

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProxyCredential

Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter. The default is the current user.

Type a user name, such as User01 or Domain01\User01, User@Domain.Com, or enter a PSCredential object, such as one generated by the Get-Credential cmdlet.

This parameter is valid only when the Proxy parameter is also used in the command.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: [System.Management.Automation.PSCredential]::Empty
Accept pipeline input: False
Accept wildcard characters: False

-NoProgress

Save-EvergreenApp uses Invoke-WebRequest to download target application installers. Download progress is suppressed by default for faster downloads; however, when -Verbose is used, download progress will be displayed. Use -NoProgress with -Verbose to suppress download progress while also displaying verbose output.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Forces this function to download the target application installers from the URI property even if they already exist in the target directory.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-UserAgent

Specifies a user agent string for the web request.

The default user agent is similar to the below with slight variations for each operating system and platform.

Mozilla/5.0 (Macintosh; Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103; en-AU) AppleWebKit/534.6 (KHTML, like Gecko) Chrome/7.0.500.0 Safari/534.6

To test a website with the standard user agent string that's used by most internet browsers, use the properties of the PSUserAgent class, such as Chrome, FireFox, InternetExplorer, Opera, and Safari.

For example, the following command uses the user agent string for Internet Explorer: Save-EvergreenApp -UserAgent ([Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer)

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Management.Automation.PSObject

Save-EvergreenApp accepts the output from Get-EvergreenApp.

OUTPUTS

System.Management.Automation.PSObject

Provides a list of paths of the downloaded target files.

NOTES

Site: https://stealthpuppy.com Author: Aaron Parker Twitter: @stealthpuppy

Download application installers: