User Profile Deletion - Advanced Installer Community
rahnajoseh
Posts: 18
Joined: Tue Dec 16, 2014 6:58 am

User Profile Deletion

Hi,

When I install my application I want delete a particular folder from C:\Users\MyUser\<folder name>.

I want to delete this folder from all the user profile folders in that system.

How is it possible.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: User Profile Deletion

Hello,

Since this is an unusual scenario I'm afraid there's no predefined functionality in Advanced Installer to delete a folder for each user registered on the machine.

However, this can be done through a custom action. Basically, you need to search all registered users on a machine and then build the pattern for the related folder location.
To list the registered users on a machine, you can take advantage of the Win32_UserAccount class. Here's a piece of code that list all users from a machine.

Code: Select all

class Sample
    {
        static void Main(string[] args)
        {
            SelectQuery query = new SelectQuery("Win32_UserAccount");
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
            foreach (ManagementObject mo in searcher.Get())
            {
                 Console.WriteLine("Username : {0}", mo["Name"]);
            }
        }
    }
Please note that this also returns the system accounts IE: NT_Authority NT_System, but those can be filtered easily.

You can also take a look on the Deleting files in APPDATA for all users forum thread which debates a similar subject.

In order to integrate your custom action in Advanced Installer, you can take a look on the Options to integrate and debug custom actions article.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rahnajoseh
Posts: 18
Joined: Tue Dec 16, 2014 6:58 am

Re: User Profile Deletion

Hi Dan,

Thanks for the solution.

That forum thread you specified solved my issue.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: User Profile Deletion

You're welcome,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rahnajoseh
Posts: 18
Joined: Tue Dec 16, 2014 6:58 am

Checkbox control enable disable

Hi Dan,

I posted one more question today . http://www.advancedinstaller.com/forums ... =2&t=29878


"I am using enterprise project. I added a new dialog with three checkbox controls.

I want to disable and enable these checkboxes if a particular folder exist in the machine.

How to do this."
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: User Profile Deletion

Hi,

You can see my response on the following link from the forums. Let's continue the debate over there.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”