# How can I remove a certificate mapping?

**URL:** <https://forum.ansible.com/t/how-can-i-remove-a-certificate-mapping/28621>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [September 21, 2018, 3:54am UTC](https://forum.ansible.com/t/how-can-i-remove-a-certificate-mapping/28621 "2018-09-21T03:54:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gary\_Mo](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@Gary\_Mo](https://forum.ansible.com/u/Gary_Mo)\
**Post date:** [September 21, 2018, 3:54am UTC](https://forum.ansible.com/t/how-can-i-remove-a-certificate-mapping/28621/1 "2018-09-21T03:54:21Z")

</div>

In these days, I tried to use ansible to manage windows server.  
But met trouble after I generate a certificate:  
[https://docs.ansible.com/ansible/latest/user\_guide/windows\_winrm.html#generate-a-certificate](https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html#generate-a-certificate)

After mapping the certificate by command:

`

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [September 21, 2018, 6:03am UTC](https://forum.ansible.com/t/how-can-i-remove-a-certificate-mapping/28621/2 "2018-09-21T06:03:23Z")

</div>

The certificate mapping can be accessed through the WSMan provider at ‘WSMan:\localhost\ClientCertificate’.

To delete all the mappings run

`Remove-Item -Path WSMan:\localhost\ClientCertificate\* -Force -Recurse`

To delete a mapping for a particular account run

`Remove-Item -Force -Recurse -Path (Get-ChildItem -Path WSMan:\localhost\ClientCertificate\*\UserName | Where-Object { $_.Value -eq "username" }).PSParentPath`

Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Gary\_Mo](https://avatars.discourse-cdn.com/v4/letter/g/7ab992/32.png) [@Gary\_Mo](https://forum.ansible.com/u/Gary_Mo)\
**Post date:** [September 25, 2018, 9:06am UTC](https://forum.ansible.com/t/how-can-i-remove-a-certificate-mapping/28621/3 "2018-09-25T09:06:17Z")

</div>

It works, thanks Jordan
