delete windows service account

It is surprising how difficult some “simple” problems can be.

When trying to install PostgreSQL, the system was complaining because the “postgres” service account already exists (and I didn’t know the password any more, probably leftover from long ago). Anyway, the “easy” solution would be to delete that service account to that it can be created anew, using a freshly chosen password.

Using the command line type
net user /delete postgres

That’s it. Now if google could have told me that immediately, then it would have saved me two hours today.

13 Comments

  1. marco flavio says:

    I had the absolutely same problem.
    For all windows 7 users: you need to execute the cmd as admin.
    thanks

  2. Paul says:

    Thanks for this, also had the exact same issue.

  3. DT says:

    Thank you! With your blog post the result does popup pretty easily in Google.

    This hits upon one of my pet peeves with all three popular OSes (Mac OS X; Linux; Windows) – objects and settings which are hidden or not easily discoverable by an admin. There are plenty of examples, but in this case: why doesn’t the GUI used to manage user accounts also manage service accounts?

    Also: why doesn’t the Postgres uninstaller think to remove the service account since its only purpose is to serve the Postgres installation which is…being removed?

    Oh well.

  4. Keld says:

    Thank you for posting. PROBLEM SOLVED 🙂

    one more time for SEO effect: delete windows service account

  5. Sumant says:

    I get Error
    C:\Users\ssdk>net user postgres /delete
    System error 5 has occurred.

    Access is denied.

  6. nandra indonesia says:

    Great……… THANX FOR SOLUTION

  7. Eric says:

    You could also just update the password with:
    net user

    • Meg says:

      The OP solution worked great for me (postgres is driving me crazy today 🙄 ) but if I’d seen this first it might have worked even better. I don’t really use the Windows command prompt much, so I looked it up. This will change your postgres service account password to “examplepassword”:

      net user postgres examplepassword

  8. GODHELPME says:

    I put in NET USER /DELETE POSTGRES and I get an error saying this is not correct syntax. It implies that I actually need to type in my username, and with a password, after USER and before /DELETE. But I try that, in many different ways, and it keeps saying my syntax is wrong.

    What am I missing here? Do you REALLY just type in “net user /delete postgres”??? If you do, then why aren’t you getting an error message saying this is wrong syntax?

  9. Andrew says:

    This is very useful, however it tell me Access is denied. I only have one user account which is an Administrator, so I don’t see why access is denied.

    I can see there is also a service account called “administrator” but I don’t know how I can login as this and whether it will make a difference. Either way my login user account should have full rights!

    Does anyone know how I can get round this?

    • Andrew says:

      Further to this I found that running command prompt in the usual way does not automatically run as administrator.

      To run as administrator:

      Search for CMD
      and then rather pressing ENTER instead press CTRL SHIFT ENTER.

  10. rasago says:

    nice info, this solve my problem.
    thanks alot :mrgreen:

  11. Fernando Siqueira says:

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

*