The IADMEXT::Terminate method is called by IISADMIN when it terminates, so your program can perform termination tasks, including unregistering your DCOM class factories.
virtual HRESULT STDMETHODCALLTYPE Terminate(void) = 0;