Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear-Host
- [string]$certDetailsString
- $choosePassword = Read-Host "Please enter a password"
- $myPwd = ConvertTo-SecureString -String $choosePassword -Force -AsPlainText
- Get-ChildItem -Path Cert:\LocalMachine\My
- $myCert = Read-Host "Please paste a thumbprint"
- $certDetails = Get-ChildItem -Path Cert:\LocalMachine\My\$myCert
- $certDetailsString = $certDetails.Subject
- $subject = $certDetailsString.Split('=')
- Clear-Host
- $subjectOne = $subject[1]
- $subjectOneDetails = $subjectOne.Split('.')
- $subjectOneNetBIOS = $subjectOneDetails[0]
- $subjectOneNetBIOS
- $outputFile = ".\pfxFiles\"+$subjectOneNetBIOS+".pfx"
- $outputFile
- Export-PfxCertificate -Cert $certDetails -FilePath "$outputFile" -Password $mypwd
Advertisement
Add Comment
Please, Sign In to add comment