In my post Uninstalling AD FS 2.0 (and deleting the databases) I described how to uninstall AD FS 2.0 from Windows Server 2008 or 2008 R2. While the process is fundamentally the same there are some subtle differences in Windows Server 2012 that mean the instructions in the previous post won’t work. I felt I should post the differences and cover how to uninstall AD FS 2.1.
The two changes that tripped me up were the Windows Internal Database (WID) connection string and the location of the WID data files. You connect to WID on Windows Server 2012 using the string:
The default data file directory for WID on Windows Server 2012 is:
So you delete the AD FS database files using:
Otherwise the process is essentially the same:
Retrieve the certificate sharing container (assuming you’re using auto certificate rollover feature)
(Get-ADFSProperties).CertificateSharingContainer | clip
Uninstall AD FS
Remove the databases from WID
I downloaded SQL Server 2012 Express Management Tools to connect to WID and execute the T-SQL DML.
use master; go sp_detach_db 'adfsconfiguration'; go sp_detach_db 'adfsartifactstore'; go
Delete the data files
Note that the name has changed in 2012. In Windows Server 2008/R2 the ServerManager name for WID was Windows-Internal-DB. In Windows Server 2012 it is Windows-Internal-Database!
- Open IIS manager. Expand <server> | Sites | Default Web Site | adfs
- Right-click on ls and click Remove
- Right-click on adfs and click Remove
- Be sure to remove LS and then ADFS and don’t just remove ADFS otherwise you’ll be in the applicationHost.config deleting XML elements.
- Click Application Pools (further up the tree) and right-click on ADFSAppPool and click Remove.
- Lastly delete the folders and files.
del c:\inetpub\adfs –Recurse
The previous task is not required if you uninstall IIS.
Clean-up AD DS
$delme = New-Object System.DirectoryServices.DirectoryEntry( "LDAP://CN=42bc22f5-e636-412f-9175-ba75912d4b4a,CN=ADFS,CN=Microsoft,CN=Program Data,DC=rnd,DC=litware-inc,DC=com") $delme.DeleteTree()
You can one-line that deletion too…
Check the previous post for a more thorough description.