Wednesday, February 16, 2005

My day at work

 Originally posted on:

This is becoming a ranting blog, but actually today eventually turned out good.

Begin of day
1. Engineer at clients site reports a problem with installation, we start trying to reproduce - no luck, a little later a re-installation of the patch resolved the issue... Important client, good thing we didn't fail there..
2. Team leader assigns a new issue to me. Apparently a tool that we outsourced to a different company to develop was not behaving well. The tool does all kinds of IIS chores for us - defines new VDs etc... One of the chores is set NTFS permissions on the application folders. At some points it took over two hours to finish the process. Outsourcing company reply: “There were a lot of files.” Doing the exact same things from Windows UI took under a minute (not including navigating the UI which took two more minutes...) - Team leader to me: “Well, we have the source code of the tool, go fix it...”.

Makes you wonder why we outsourced it in the first place ;-)

Anyway, I look at the code, looks pretty straight forward - read the config XML file, for each folder apply settings. Using ADSI objects. I looked deeper into the code, and saw many deleting and setting. and decided that I'm not that proficient with the object and issues to optimize it and still be sure it performs the same. On to search for alternate options...

What I found after a little googling was fileacl.exe which I'm sure some of you already know. This is even distributed by MS link is to there. Unfortunately couldn't find authors' site to look up more information (only on google cache). Tested it for a while from the command line, after understanding saw that it worked exactly as I needed it, and much faster...

Opened up the source code of the utility again, this time modified it to call the exe instead of executing with the other (slow) method, a little more work to convert the data from the XML to the correct switches for fileAcl - and were done.

First test, realised I was doing something wrong with the Full Control permission, fixed - DONE a two hour run now takes under a minute. Thank you Guillaume Bordier .

Also thank you ShellExecuteEx always trusty from MS.

Another day finished.

No comments: