Skip to content

Invoke-IISCertificateReplacement

SYNOPSIS

Replace wildcard certificates on IIS servers.

SYNTAX

Invoke-IISCertificateReplacement [[-pwdstid] <Int32>] [-certlocation] <String> [-certfile] <String>
 [[-serverName] <String[]>] [-task] <UInt64> [<CommonParameters>]

DESCRIPTION

This function replaces wildcard certificates (e.g., .gentgrp.gent.be, .stad.gent, *.gent.be) on specified IIS servers. It retrieves the certificate from Passwordstate, imports it into the server's certificate store, and updates all HTTPS bindings to use the new certificate. The function also logs the process and updates the associated task in HEAT.

EXAMPLES

EXAMPLE 1

Invoke-IISCertificateReplacement -pwdstid 45336 -certlocation "ster.gentgrp.gent.be" -certfile "ster.gentgrp.gent.be_2022" -serverName "SRVCON07" -task 6497000

Replaces the wildcard certificate on the server "SRVCON07" and logs the process in HEAT task 6497000.

EXAMPLE 2

Invoke-IISCertificateReplacement -pwdstid 45336 -certlocation "stad.gent" -certfile "stad.gent_2023" -serverName @("SRVIIS01", "SRVIIS02") -task 6498000

Replaces the wildcard certificate on the servers "SRVIIS01" and "SRVIIS02" and logs the process in HEAT task 6498000.

PARAMETERS

-pwdstid

The Passwordstate ID of the certificate to be replaced.

Type: Int32
Parameter Sets: (All)
Aliases:

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

-certlocation

The folder path where the certificate file is located.

Type: String
Parameter Sets: (All)
Aliases:

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

-certfile

The name of the certificate file (e.g., "ster.gentgrp.gent.be_2022").

Type: String
Parameter Sets: (All)
Aliases:

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

-serverName

An array of server names where the certificate will be replaced.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: SRVIISF1QA01
Accept pipeline input: False
Accept wildcard characters: False

-task

The HEAT task number where the transcript of the operation will be logged.

Type: UInt64
Parameter Sets: (All)
Aliases:

Required: True
Position: 5
Default value: 0
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

OUTPUTS

NOTES