File Ownership 
Author Message
 File Ownership

We are swapping out some servers soon. Old ones are NT4, new ones are
Windows 2000.
We were looking at using the Quota Manager in windows 2000 to manage users
home directories.
Problem - Quota manager calculates space on ownership of files. When we
transfer the data from the old server to the new one, the ownership of the
files will change because an administrator will be doing the transfer. That
sort of makes the quota idea go out the window.
Is there a way I can use a login script so that it will go through each of
the files the next time the user logs take ownership of them (ie. make the
user the new owner)?

Thanks in advance -
Damien



Sun, 06 Jun 2004 14:26:15 GMT  
 File Ownership

You can use WMI to take ownership of files. In the following code
sample the ownership is changed for a specified file:

'connect to WMI namespace on local machine
Set objServices=GetObject("winmgmts:{impersonationLevel=impersonate}")
'get a reference to a file
Set objFile = objServices.Get("CIM_DataFile.Name='d:\data\report.doc")
If  objFile.TakeOwnership = 0 Then
 Wscript.Echo "File ownership successfully changed"
Else
 Wscript.Echo "File ownership transfer operation"
Endif

You'll need WMI. Since you are moving to Windows 2000 this won't be a
problem since it's included with the OS, but if you need to do it on
NT4 boxes you will need to install WMI on each box.

Regards,

Stein Borge
Author of Managing Enterprise Systems with the Windows Script Host
Over 800 pages of practicle solutions oriented material, providing
detailed coverage of WSH 5.6, WMI,
ADSI, ADO, CDO, FSO and much more.

www.EnterpriseWSH.com

On Wed, 19 Dec 2001 16:56:15 +1030, "Damien Holben"

Quote:

>We are swapping out some servers soon. Old ones are NT4, new ones are
>Windows 2000.
>We were looking at using the Quota Manager in windows 2000 to manage users
>home directories.
>Problem - Quota manager calculates space on ownership of files. When we
>transfer the data from the old server to the new one, the ownership of the
>files will change because an administrator will be doing the transfer. That
>sort of makes the quota idea go out the window.
>Is there a way I can use a login script so that it will go through each of
>the files the next time the user logs take ownership of them (ie. make the
>user the new owner)?

>Thanks in advance -
>Damien



Mon, 07 Jun 2004 17:43:19 GMT  
 File Ownership
Thanks for the information!
One little problem - and I should have mentioned this earlier (sorry).
Some of the clients are running Win95 - that means I can't use WMI for them
doesn't it?


Quote:

> You can use WMI to take ownership of files. In the following code
> sample the ownership is changed for a specified file:

> 'connect to WMI namespace on local machine
> Set objServices=GetObject("winmgmts:{impersonationLevel=impersonate}")
> 'get a reference to a file
> Set objFile = objServices.Get("CIM_DataFile.Name='d:\data\report.doc")
> If  objFile.TakeOwnership = 0 Then
>  Wscript.Echo "File ownership successfully changed"
> Else
>  Wscript.Echo "File ownership transfer operation"
> Endif

> You'll need WMI. Since you are moving to Windows 2000 this won't be a
> problem since it's included with the OS, but if you need to do it on
> NT4 boxes you will need to install WMI on each box.

> Regards,

> Stein Borge
> Author of Managing Enterprise Systems with the Windows Script Host
> Over 800 pages of practicle solutions oriented material, providing
> detailed coverage of WSH 5.6, WMI,
> ADSI, ADO, CDO, FSO and much more.

> www.EnterpriseWSH.com

> On Wed, 19 Dec 2001 16:56:15 +1030, "Damien Holben"

> >We are swapping out some servers soon. Old ones are NT4, new ones are
> >Windows 2000.
> >We were looking at using the Quota Manager in windows 2000 to manage
users
> >home directories.
> >Problem - Quota manager calculates space on ownership of files. When we
> >transfer the data from the old server to the new one, the ownership of
the
> >files will change because an administrator will be doing the transfer.
That
> >sort of makes the quota idea go out the window.
> >Is there a way I can use a login script so that it will go through each
of
> >the files the next time the user logs take ownership of them (ie. make
the
> >user the new owner)?

> >Thanks in advance -
> >Damien



Tue, 08 Jun 2004 08:28:40 GMT  
 File Ownership

Actually you can install WMI on Win 95, but the TakeOwnership method
might not work. Win 9x  doesn't support the same number of methods and
properties as Windows NT/2000/XP.

Stein Borge
Managing Enterprise Systems with the Windows Script Host
Over 800 pages of practicle solutions oriented material, providing
detailed coverage of WSH 5.6, WMI,
ADSI, ADO, CDO, FSO and much more.

www.EnterpriseWSH.com

On Fri, 21 Dec 2001 10:58:40 +1030, "Damien Holben"

Quote:

>Thanks for the information!
>One little problem - and I should have mentioned this earlier (sorry).
>Some of the clients are running Win95 - that means I can't use WMI for them
>doesn't it?



>> You can use WMI to take ownership of files. In the following code
>> sample the ownership is changed for a specified file:

>> 'connect to WMI namespace on local machine
>> Set objServices=GetObject("winmgmts:{impersonationLevel=impersonate}")
>> 'get a reference to a file
>> Set objFile = objServices.Get("CIM_DataFile.Name='d:\data\report.doc")
>> If  objFile.TakeOwnership = 0 Then
>>  Wscript.Echo "File ownership successfully changed"
>> Else
>>  Wscript.Echo "File ownership transfer operation"
>> Endif

>> You'll need WMI. Since you are moving to Windows 2000 this won't be a
>> problem since it's included with the OS, but if you need to do it on
>> NT4 boxes you will need to install WMI on each box.

>> Regards,

>> Stein Borge
>> Author of Managing Enterprise Systems with the Windows Script Host
>> Over 800 pages of practicle solutions oriented material, providing
>> detailed coverage of WSH 5.6, WMI,
>> ADSI, ADO, CDO, FSO and much more.

>> www.EnterpriseWSH.com

>> On Wed, 19 Dec 2001 16:56:15 +1030, "Damien Holben"

>> >We are swapping out some servers soon. Old ones are NT4, new ones are
>> >Windows 2000.
>> >We were looking at using the Quota Manager in windows 2000 to manage
>users
>> >home directories.
>> >Problem - Quota manager calculates space on ownership of files. When we
>> >transfer the data from the old server to the new one, the ownership of
>the
>> >files will change because an administrator will be doing the transfer.
>That
>> >sort of makes the quota idea go out the window.
>> >Is there a way I can use a login script so that it will go through each
>of
>> >the files the next time the user logs take ownership of them (ie. make
>the
>> >user the new owner)?

>> >Thanks in advance -
>> >Damien



Tue, 08 Jun 2004 09:08:07 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. disk quotas and files ownership

2. File Ownership

3. Changing File Ownership

4. Setting file ownership

5. Retrieving File Ownership on NTFS

6. file ownership

7. How can I get file ownership

8. disk quotas and files ownership

9. ownership of files and direcotry

10. ownership of files and direcotry

11. SQL XML Bulk Load Requires Database Ownership!

12. OCR-B font ownership/authorship??

 

 
Powered by phpBB® Forum Software