DirectoryServicesCOMException: A device attached to the system is not functioning.

From the ministry of silly error messages …

When creating a user through Active Directory you receive the error “A first chance exception of type 'System.DirectoryServices.DirectoryServicesCOMException' occurred in System.DirectoryServices.dll: A device attached to the system is not functioning.“.

Chances are the sAMAccountName property was set to a string of 20 characters or more.

External References

  • Microsoft documents the size restriction here–one would just wish for a more helpful message.
  • Everything one could want to do in Active Directory with .NET is shown in this article.
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to DirectoryServicesCOMException: A device attached to the system is not functioning.

  1. Josh says:

    After hours of playing with my code, this solution solved my error. I was setting a samaccountname of more then 20 letters. You have NO idea how much I appreciate finding this site. 🙂

  2. Paul Pretorius says:

    Saved me a nightmare! Thank you

Leave a comment