View Single Post
Old 2nd September 2009, 09:45   #1
Junior Member
Join Date: Jul 2006
Posts: 42
[delete user account] remaining home directory

Hi all,

During my install I'm creating a user account (postgres). Then When uninstalling I'm using the UserMgr plugin to delete a user account.
User account is correctly deleted but the user home directory remain and the next time i install the software i have a new home directoy named postgres.%computer name%.001 ...

I made a lot of search on the web to find a way do delete this remaining directory and ended with the only solution that is to retrieve the user home directory thanks to the ProfileImagePath registry keys.

But to do so I need to retreive first the user profil SID, then go to the registry and look to ProfileImagePath keys.

here is an exemple made with win32 c# (i guess)

require 'win32/security'
require 'win32/registry'

key = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\"
usr = 'some_user'

sec =
key += sec.to_s do |reg|
puts reg['ProfileImagePath']

to do the same with C++ win32 code i need to use LookupAccountName then convert SID to string ...

do you have better solution ? or is nsis providing something for that ?
ginglese is offline   Reply With Quote