Edit

Share via


Export-IISConfiguration

Exports the IIS configuration and machine keys.

Syntax

Default (Default)

Export-IISConfiguration
    [-PhysicalPath] <String>
    [[-UserName] <String>]
    [[-Password] <SecureString>]
    [[-KeyEncryptionPassword] <SecureString>]
    [-DontExportKeys]
    [-Force]
    [<CommonParameters>]

Description

The Export-IISConfiguration cmdlet exports the IIS configuration and machine keys to a specified ___location.

The exported configuration is available only to administrators through the access control list (ACL).

You can encrypt the machine keys with the KeyEncryptionPassword parameter.

You must supply a valid username and password to access the export ___location. If you do not want to export the keys, specify the DontExportKeys parameter.

Examples

Example 1: Export a configuration

PS C:\> $KeyEncryptionPassword = ConvertTo-SecureString -AsPlainText -String "SecurePa$$w0rd" -Force
#Automation scenarios
PS C:\> $KeyEncryptionPassword = Read-Host -AsSecureString
#UI scenarios
PS C:\> Export-IISConfiguration -PhysicalPath "C:\export" -KeyEncryptionPassword $keyEncryptionPassword
PS C:\> Export-IISConfiguration -PhysicalPath "C:\export" -DontExportKeys -Force

Passwords must be in SecureString format. The first command uses ConvertTo-SecureString to convert the specified password, and then stores it in the $KeyEncryptionPassword variable. Using ConvertTo-SecureString is useful in automation scenarios.

The second command uses Read-Host to read console input for the key encryption password, and then stores it in the $KeyEncryptionPassword variable. Using Read-Host is a more secure method for UI scenarios.

The third command exports the keys and configuration to C:\export, and encrypts the key with the specified password.

The fourth command exports the configuration without the keys. Because the Force parameter is specified, this command overwrites the previous configuration. The exported keys in C:\export are not deleted.

Parameters

-DontExportKeys

Indicates that this operation does not export the keys.

To enable the IIS shared configuration feature with this exported configuration, run the Enable-IISSharedConfig cmdlet with the DontCopyRemoteKeys switch parameter.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyEncryptionPassword

Specifies the key encryption password for the exported keys.

You can use this value with Enable-IISSharedConfig to enable shared configuration with the configuration that this cmdlet exports.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Password

Specifies the password of the account for accessing the physical ___location.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PhysicalPath

Specifies the ___location to which to export the configuration and keys.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UserName

Specifies the user name of the account to access the physical ___location.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

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

Inputs

String

SecureString

Outputs

Object