Link to home
Start Free TrialLog in
Avatar of JesNoFear
JesNoFearFlag for United States of America

asked on

How to change a files owner and permissions for NTFS in vb

I am looking to change a files owner in windows 2000, I have a program that runs every day as administrator which catalogs the daily batch of files. The issue i am having is that each user that sends files for the daily batch, each users has a quota of 100 megs. so every few months they run out of server space and then i must go in manualy and change the ownership of the file to my self.
It would be nice to be able to add in the ability to change owners in my program so when it catalogs the files daily, it will also change owners.
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Why not just increase the quotas?
Avatar of JesNoFear

ASKER

Because of limited space on the server. And people in my company love to take advantage of what they get.
This makes no sense... you're just bypassing the Quotas for them when you take ownership.
Yes, that is the intent, Because the files that are part of the daily batch go to a hiden share on the server it still counts as part of there quota. And since after they transmit the batch of files over to the server, they never use them again, it becomes an issue when they can't save there word documents to there personal server space.
I guess I'm confused too..   So, why are you changing the ownership of the files?   I agree with leew, in that this procedure just appears to be a way to get the owner of the file more disk quota.

Let's skip the obvious question as to "why"... and find out some more information

1) what programming platform?  VB6, VB.Net ,etc
2) you need to do this from an application (not from a batch file/command-line)?
3) you need to change the ownership to your own account?
4) you are an administrator on this server?
Just to help make things clear, I am moving audio files (WAV Files) from 5 people's pc to the server, in addition, each user on the network has a quota of 100 megs to save work related stuff such as documents power point and other type of files. The wave files that they sent out on a daily bases i do not want to count against there quota's because once they are sent, they are never used again by them. The audio files are kepted on the server for 6 months befor being archived to tape.

I have both vb6 and vb.net but would prefer to do it in vb6, (Still learning .net) I would like to use an API or other command means of changing these files over, but as last resort i can do command line.
The program is shelled under Administrator on the server which is whom i'd like to take ownership under. (If possable to do it under the group Administrators would be best)
Yes I am the network admin and am the Administrator on the server.
Currently my program is executed via Schedule Tasks under windows 2000 server everynight. what the program dose is takes all the files from the SQL db for that day and makes sure all the files are found on the server, So it has a compleat listing of each files and where the file is located.
Why not use a different partition on the server to copy the files to?  That won't necessarily be under the quota you've set.
that is ture, I have been trying to accomplish this a few diffrent ways, I tryed on the client end, currently they execute my program which copys all the audio files to my server, I tryed having that program run itself as an administrator, I tryed to have my program log onto the server as administrator. It would be easier to just change the permissions on the file is possable. Currently the server that it is running on we have had for 2 years and is maxed out as is, it currently has 2 hard drives with no room to spare, and since it is in the rack its kinda hard to do an external hd.
So i am kinda limited to my equiptment in that regard.
ASKER CERTIFIED SOLUTION
Avatar of graye
graye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks for the quick responce, Ill be able to test this out at work tommarow.
Ill let you know how it goes.
- Jes
Sorry for the long delay, Things came up at work and have not had a chance to test it out yet.
Thanks for the quick responce though.