Skip to content

Instantly share code, notes, and snippets.

@rheid
Last active September 2, 2016 11:01
Show Gist options
  • Save rheid/c4e2d8b2662438614862 to your computer and use it in GitHub Desktop.
Save rheid/c4e2d8b2662438614862 to your computer and use it in GitHub Desktop.
Import SSL certificate to IIS webserver what is inside the root filesystem
$Path = "C:\inetpub\wwwroot\static"
$Folders = Get-ChildItem -path $Path -Recurse -Include *.pfx
$pass = $mypwd = ConvertTo-SecureString -String "<Passwort>" -Force –AsPlainText
foreach ($file in $Folders)
{
#Get Folder-Informationen form Filessystem
$loop = $loop + 1;
$sitefilepath = $file.Fullname
Write-Host $sitefilepath -ForegroundColor Green
Import-PfxCertificate –FilePath $sitefilepath -CertStoreLocation cert:\localmachine\my –Exportable -Password $pass
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment