< Back

Set-CertFile

Mon Jan 13, 2020 12:25 am

NAME Set-CertFile



SYNOPSIS

Persists a given certificate to file





SYNTAX

Set-CertFile [-Certificate] <String> [-CertFile] <String> [[-PfxPassword] <String>] [<CommonParameters>]





DESCRIPTION

Compares the current cert and overwrites if different based on thumbprint. Certificate is PFX or PEM format

obtained from Get-Cert.

If PfxPassword is specified, the file is considered to be PFX. Otherwise, it is considered to be PEM format.





PARAMETERS

-Certificate <String>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-CertFile <String>



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PfxPassword <String>



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

$True if cert was written to file. $False if cert was not written to file.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-CertFile -Certificate $pfxCert -CertFile some.mysite.com.pfx -PfxPassword "!234SECRETbc123"



Stores the PFX certificate in specified file.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-CertFile -Certificate $pemCert -CertFile some.mysite.com.pem



Stores the PEM formatted certificate in specified file.











RELATED LINKS