Question

i'm not able to delete my old data directory in windows 7. i already uninstalled PostgreSQL, but there's still the system service user account "postgres", who's the only one with access-rights to the folder.

possible solution would be to develop a service, running as "postgres" user, which deletes the folder, but there must be an easier way?

Was it helpful?

Solution

I haven't used Windows 7, but if I recall correctly, there should be a way to start an explorer session (the filemanager, not IE) under the Postgres user and then remove it.

Otherwise, you might be able to, by logging in as an Administrator, add rights for Administrators to modify that directory and the parent directory and after that you should be able to remove it.

I am not certain if it is possible for an administrator to remove the directory directly, but it should be possible for one to add the rights to do so.

Update: I just installed PostgreSQL and tested it in Vista, it might work the same in Windows 7. It seems like they have fixed the permission stuff, so the tip above doesn't work (changing the permissions).

However, if the system account is still there, you can access it in the Computer Management. Add it to a regular user group (like Users or Administrators) and then you should be able to login with it and after that remove the directory.

OTHER TIPS

Its simple. Just open up Command Prompt as admin, and type

net user

Then press the return key, you'll see the user accounts within your OS. Also you'll notice postgres listed there. Inorder to remove it, type the following:-

net user postgres /del

And the return key. Voila, you're done. Just to make sure everything is done completely, check your 'USERS' folder in C: drive, or whichever concerned and remove the folder called 'postgres' if present. Done! :)

As an administrator take ownership of the directory in question - in Windows Explorer - right-click on it, 'Properties', 'Security', 'Advanced', 'Owner', and from the list under 'Change owner to' select your account. Then delete it.

You have to remove the user too.

Open a command line and type net user "login of the user" /delete

The post kind of old, but if what is intended is the same I intended (delete "postgres" account), the solution could be this:

  1. Open cmd as administrator
  2. Run the command: net user postgres /delete
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top