Question Better tool to build a profile rebuilding tool with?


Nov 25, 2014
Programming Experience
I want to build a tool to rebuild profiles. Essentially it would rename the profile folder on a server, delete a lot of folders and files from the user folder on the same server, just a different folder, and delete the locally stored cached profile from the remote PC.

My question or questions are:

1. Looking at what is in bold, is there a better tool to use to write this? Would a batch file in dos delete those files/folders remotely at a faster speed than C#? I know very little of either, but more C# than dos or shell. (If I try to open the remote PC on my Computer by going to run and typing //pcname/c$ and delete the profile that way, it can sometimes take over 30 minutes to delete, but if I remote in and delete them locally, they can be deleted at no more than a couple minutes. This is why I ask, I want this tool to work as fast as possible. Most deletions will be folder deletions and everything in those folders, without regard for any files.... so in DOS I guess a RD /q /s type thing would be best. I'm just not sure about speed, and how C# compares.

2. Also, there is one folder that we have to deal with sometimes for windows 7 profiles, that will not let us delete it manually. We have to go into properties, and take ownership of the folder, in order to delete it. Can this be done programmatically?

3. Lastly, can I run a dos file on the remote PC to update group policy on that PC? Its just a simple run command that opens a command prompt window and runs the update, then confirms that you want to reboot to complete it. Could this be run from an Admin PC in my program, and updated on the remote PC like it was being ran there?

I apologize for the questions if they are confusing. I'm just learning C#, and want to try and do this in it if possible. Any advice is welcome!


BTW: if you need additional info, this is everything I can think of.
Profiles are Win XP and Win 7 only, 90% Win XP.
I have VS 2012 and 2013 so can write in either one.
This program needs to be able to run on XP AND Win 7, as we are running XP now but upgrading soon to Windows 7 in our Support Center.

Folder to rename is: \\Server\Profiles\Username to \\Server\Profiles\Username.old
Files to delete are:
\\Server\Profiles\UsernameV2 - Deleted if I can get my program to take ownership of this folder like I do through properties when it gives me the error. 50% of the time it seems.

\\Server\Users\Username\Cookies deleted.
\\Server\Users\Username\Microsoft deleted.
\\Server\Users\Username\Application Data\ - everything deleted except 6 specific folders.
\\Server\Users\Username\Application Data\Outlook - everything deleted except NK2 file.
\\Server\Users\Username\Application Data\Internet Explorer - everything deleted except one file also.

After this, I would like to delete the users locally cached folder on the PC.... for example... \\PCName\C$\Settings and Documents\Username -- Deleted.... this is the one that takes a long time to delete most times.

Then I would like to update the group policy last and let it reboot the PC to finish.

On windows 7 machines I will also need to remove a couple of registry keys, but that's on the back burner for now. Want to get the basics accomplished if possible.
Top Bottom