views:

841

answers:

3

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?

A: 

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.

Jimmy Stenke
thanks. i can run applications as different user by shift+right clicking them. the postgres user had no permission to execute explorer.exe but i was able to run notepad.exe.file->open popped up an explorer menu, where i was able to delete the folder =)
5andr0
:) That is also a way to do it. The reason it had no permission to execute explorer.exe is probably because it was not in a regular user (System user accounts have a very limited scope of permissions)
Jimmy Stenke
A: 

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.

Milen A. Radev
got an error message: (translated)You are not authorized , to view or edit the permission settings of the object
5andr0
"As an administrator"...
Milen A. Radev
did that, i activated my admin acc and logged into it. as i said, postgres was the only user with access. but thanks
5andr0
A: 

You have to remove the user too.

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