You're probably wondering to yourself, "Why's Darren so obsessed about utilities for forcing ownership of files under Windows 2000?"
Well, let me tell you why...
A few days ago, I tried to hook up the scanner Kirsten's Dad lent us under my Win2k install. It didn't work. But, it didn't work in a very odd way; the drivers installed fine, Windows said it detected the scanner, but also said it was unavailable.
Fine, said I. I'll reinstall the drivers. I reinstalled the scanner drivers 5 or 6 times, each time giving the same result as above.
Next step, I figured, was to uninstall the USB Host drivers, and reinstall them. That's where the trouble started. Once uninstalled, the USB drivers wouldn't reinstall. I spent a couple hours trying everything I could to get them working again. Nothing happened.
Knowing the three R's of Windows, reinstall was my next option. And that's really where the shit hit the fan. Windows 2000 won't let you install over an existing copy of itself; you have to either wipe the directory, or put it somewhere else. I figured I was in for a dollar at this point anyways, so I opted for the first of these, knowing I'd have to reinstall software anyways.
It deleted the directory just fine....... and then wouldn't write to it. In fact, it turned out I couldn't write to either of my drives at all.
Panic ensued.
I asked my good, good friend Dan to come over with a new copy of Win2k, thinking that somehow my install CD was corrupt. A couple of hours and an attempted XP install later, we were still not successful.
Some online resources suggested that memory might be a problem, so we removed all but one stick of memory and still no go. We were 3 hours in when I said "fsck it!" and wiped my secondary drive (which had nothing on it)... and it *almost* installed. It turns out both Win2k and XP need to write ntldr to the primary drive, no matter what.
I finally removed the primary drive from BIOS, and got XP installed on the secondary drive. From there, we discovered we could use cacls (which isn't included in the Win2k Repair Console, btw) to grant full permission to the primary drive.
Last night, I installed Win2k on the primary drive, toasted XP (good riddance) off the secondary drive, and started installing programs...... and discovered that cacls didn't quite repair *all* the permissions. And can't.
Only on Windows could you have files on the computer that you can't access, even as Administrator. Some directories are still set to the old owners, from the previous installation of Windows. This means that the tool I'd been using simply wasn't allowed to make changes to them.
I finally found a tool, setowner, that would forcibly reassign ownership, and it worked - with only one problem... it doesn't take wildcards, and doesn't do inheritance to child objects.
So, at 11:30pm last night, I started writing a PHP script to recurse through subdirectories, and apply the setowner to each file within them. At about 1am I gave up, knowing I was too tired to write a script to affect file access. :)
Doing some quick searches over lunch today, I was able to find some tools that might do a better job, including a setowner.exe that CAN do child objects. I'll let you know how it goes.
Oh, and as a postscript to all this.... the scanner works now. :)

>> Arcterex » Saturday, January 11, 2003 12:12 AM
Post a comment
* under no circumstances will your email address be traded for a sack of quarters. No-sirree.