PKISolutions / PSPKI

PowerShell PKI Module
Microsoft Public License
388 stars 59 forks source link

UnRegister-ObjectIdentifier function #224

Open madburg opened 2 weeks ago

madburg commented 2 weeks ago

PS C:\Windows\system32> get-help Unregister-ObjectIdentifier -Examples

NAME Unregister-ObjectIdentifier

SYNOPSIS Unregisters object identifier (OID) information from local computer, Active Directory or both sources.

--------------------------  Example 1  --------------------------

PS C:\> Unregister-ObjectIdentifier -Value "Remote Desktop Authentication" -UseActiveDirectory

Unregisters a custom OID that was previously registered in Active Directory.

Could not get UnRegister-ObjectIdentifier to work; unclear how to actually switch "from local computer, Active Directory or both sources." as stated?

Steps taken:

1) Create OID in AD using Register-ObjectIdentifier function:

Register-ObjectIdentifier -FriendlyName "Contoso Pharmaceuticals smart card policy" -Value "1.3.6.1.4.1.50095.1.1.1.1.0" -OidGroup IssuancePolicy -CPSLocation "http://www.contoso.com/cps/documents/scpolicy.pdf" -UseActiveDirectory

2) Now try and delete this OID using UnRegister-ObjectIdentifier function: From example it seems -Value argument should take the -FriendlyName argument we used to create the OID:


PS C:\Windows\system32> Unregister-ObjectIdentifier -Value "Contoso Pharmaceuticals smart card policy" -UseActiveDirectory

Unregister-ObjectIdentifier : Cannot process argument transformation on parameter 'Value'. Cannot convert the "Contoso Pharmaceuticals smart card policy" value of type "System.String" to type "SysadminsLV.PKI.Cryptography.Oid2". At line:1 char:36

3) For troubleshoot tried using the OID value instead of friendlyname for -Value argument (tried with double quotes, single quotes and no quotes, always same result):


PS C:\Windows\system32> Unregister-ObjectIdentifier -Value 1.3.6.1.4.1.50095.1.1.1.1.0 -UseActiveDirectory

Unregister-ObjectIdentifier : Cannot process argument transformation on parameter 'Value'. Cannot convert the "1.3.6.1.4.1.50095.1.1.1.1.0" value of type "System.String" to type "SysadminsLV.PKI.Cryptography.Oid2". At line:1 char:36

Crypt32 commented 2 weeks ago

Sounds like a bug. Will look into this.