Delete old PostgreSQL data directory in win7
I cannot delete the old data directory in Windows 7. I have already uninstalled PostgreSQL, but there is also a "postgres" system user account, which is the only one with permissions to the folder.
a possible solution would be to develop a service running as user "postgres" that deletes the folder, but there should be an easier way?
a source to share
I haven't used Windows 7, but if I remember correctly, there must be a way to start an explorer session (file manager, not IE) as a Postgres user and then delete it.
Otherwise, you can, logged in as an administrator, add administrator rights to change this directory and the parent directory, after which you can delete it.
I'm not sure if the administrator will be able to delete the directory directly, but it should be possible for him to add rights to that.
Update : I just installed PostgreSQL and tested it on Vista, it may work the same on Windows 7. It looks like they fixed the permissions stuff, so the tip above does not work (change permissions).
However, if the system account still exists, you can access it in Computer Management. Add it to your normal user group (like Users or Administrators) and then you can login to it and delete the directory after that.
a source to share
Simple. Just open Command Prompt as administrator and type
net user
Then press the return key, you will see the user accounts in your OS. Also you will notice that the postgres were listed there. To remove it, enter the following: -
net user postgres /del
And the return key. Voila, everything is ready. To make sure everything is complete, check your USERS folder on the C: drive, or whichever is relevant, and delete the postgres folder if present. Done! :)
a source to share