Skip to content

New-Certificate

SYNOPSIS

Generate a new certificate for a user.

SYNTAX

New-Certificate [-User] <Object> [-OU] <String> [[-CAName] <String>] [[-Template] <String>] [[-Path] <String>]
 [[-TimeStamp] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The `New-Certificate` function generates a new certificate for a specified user. It supports various organizational units (OUs) and certificate templates. The function creates temporary accounts if required, generates certificate requests, and exports the certificate to a secure location.

EXAMPLES

EXAMPLE 1

New-Certificate -User "jdoe" -OU "Raadsleden"

Generates a new certificate for the user "jdoe" in the "Raadsleden" organizational unit.

EXAMPLE 2

New-Certificate -User "jdoe" -OU "API" -Template "_CustomTemplate"

Generates a new certificate for the user "jdoe" in the "API" organizational unit using a custom certificate template.

EXAMPLE 3

New-Certificate -User "jdoe" -OU "GPR" -Path "C:\Certificates"

Generates a new certificate for the user "jdoe" in the "GPR" organizational unit and stores it in the specified path.

PARAMETERS

-User

The username or identifier of the user for whom the certificate will be generated.

Type: Object
Parameter Sets: (All)
Aliases:

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

-OU

The organizational unit (OU) for the certificate. Supported values include: - API - Buitenlander - ESB - GPR - Nachtopvang - OCMWRaadsleden - Raadsleden - SG_noEid - Vubis - Syncore - mtls

Type: String
Parameter Sets: (All)
Aliases:

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

-CAName

The name of the Certificate Authority (CA) to use for generating the certificate. Defaults to `SRVCAISSUE02.gentgrp.gent.be\D09-Issuing-CA2`.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: SRVCAISSUE02.gentgrp.gent.be\D09-Issuing-CA2
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Template

The certificate template to use. Defaults to `_D09-CA2-SHA256-User-SSLVPN`.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: _D09-CA2-SHA256-User-SSLVPN
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Path

The base path where temporary files and certificates will be stored. Defaults to `\\StadGent\Repository\Systeembeheer_Scriptrepository\Certificaatbeheer`.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: \\StadGent\Repository\Systeembeheer\_Scriptrepository\Certificaatbeheer
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-TimeStamp

A timestamp used for logging and file naming. Defaults to the current date and time in `yyyyMMddHHmm` format.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: (Get-Date -Format 'yyyyMMddHHmm')
Accept pipeline input: True (ByPropertyName, ByValue)
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

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