We have a certificate server from which users are able to download their certificate (User Template) from this URL: http://localhost/certsrv.

I now want to create a script which will do the following:

  1. Delete the existing certificate from Personal Certificate store.
  2. Install the new certificate in Personal certificate store.

I already made the script, and it is able to delete the certificate but installation is not happening because the command is not supporting in Windows 7.

Here is my code:

# User Details
$dom = $env:userdomain
$usr = $env:username
$fulname = ([adsi]"WinNT://$dom/$usr,user").fullname

#get certificate & Remove the certificate
$Cert = Get-ChildItem -Path Cert:\CurrentUser\My | Where-Object {$_.Subject -match "$fulname"} | Remove-Item

#Install new certificate
Get-Certificate -Template User -DnsName mydomain.com -CertStoreLocation cert:\CurrentUser\My
  • "Get-Certificate" command is not supporting in windows 7 PowerShell version 4. is there any other way we can install the certificate (like - VBS or other scripts)? Apr 17, 2017 at 8:52

1 Answer 1


I believe you will need to use the command-line tool certutil.exe on Windows 7. It's use is documented here: https://technet.microsoft.com/en-us/library/cc732443(v=ws.11).aspx and available when Certificate Services are installed.

For example:

certutil -addstore -user -f "My" "Path to certificate\certificate.cer"

You can make use of this tool from within a PowerShell script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .