Skip to content

New-InstallerDirectory

SYNOPSIS

Includes a directory in the installer.

SYNTAX

custom (Default)

New-InstallerDirectory [-DirectoryName] <String> [-Id <String>] [[-Content] <ScriptBlock>] [-Configurable]
 [<CommonParameters>]

predefined

New-InstallerDirectory -PredefinedDirectoryName <String> [[-Content] <ScriptBlock>] [<CommonParameters>]

DESCRIPTION

Includes a directory in the installer. You can specify custom or predefined directories, such as Program Files.

EXAMPLES

Example 1

PS C:\>   New-Installer -ProductName "PowerShellTools" -UpgradeCode "25d7c902-c46c-44fd-87e0-0756bee726de" -Version '2.1' -OutputDirectory $OutputDir -Content {
            New-InstallerDirectory -PredefinedDirectory "LocalAppDataFolder" -Content {
                New-InstallerDirectory -DirectoryName "PowerShell Tools" -Configurable {
                    Get-ChildItem (Join-Path $PSScriptRoot "InstallerAssets\*.exe") | New-InstallerFile -Verbose
                }
            } 
        }

Creates a new installer that includes the LocalAppDataFolder. Within the LocalAppDataFolder a new PowerShell Tools folder is created. The configurable flag is specified so the user will be able to change this folder during installation.

PARAMETERS

-Configurable

Specifies whether the installation folder is configurable. The user will be prompted during installation. Only one Configurable directory is allowed.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: custom
Aliases:

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

-Content

The content of this directory. This can include files, shortcuts or other directories.

Type: System.Management.Automation.ScriptBlock
Parameter Sets: (All)
Aliases:

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

-DirectoryName

The name of this directory.

Type: System.String
Parameter Sets: custom
Aliases:

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

-Id

The ID of this directory. This needs to be unique and will be autogenerated if not specified.

Type: System.String
Parameter Sets: custom
Aliases:

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

-PredefinedDirectoryName

Specifies a predefined directory name. The root directory to the installer must be a predefined directory.

Type: System.String
Parameter Sets: predefined
Aliases:
Accepted values: AdminToolsFolder, AppDataFolder, CommonAppDataFolder, CommonFilesFolder, CommonFiles64Folder, CommonFiles6432Folder, DesktopFolder, FavoritesFolder, FontsFolder, LocalAppDataFolder, MyPicturesFolder, PersonalFolder, ProgramFilesFolder, ProgramFiles64Folder, ProgramFiles6432Folder, ProgramMenuFolder, SendToFolder, StartMenuFolder, StartupFolder, SystemFolder, System64Folder, TemplateFolder, WindowsFolder

Required: True
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

None

OUTPUTS

System.Object

NOTES

Back to top