header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
set ownership by username and domain
Last Post 01 Mar 2010 10:04 PM by PoSherLife. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
djdeenoUser is Offline
New Member
New Member
Posts:2
Avatar

--
15 Feb 2010 05:44 PM

    Hello

    I try to make a script that must do the follow

    In a windows 2003 domain, I have a 2008 windows share server, on this server there are the homedir from the users in this domain, in a root with the first letter, a example:

    User baker (login with the name baker) has his home dir on the windows 2008 server named: \\shareserver\b\baker

    Also user bakara (login with the name bakara) has his home dit on the same server , his path is \\shareserver\b\bakara

    Now what I want with my script is set the username (also login name) to the owner of this folder, only the user is owner and nobody els, also the administrator is not the owner.

    I write this script in powershell, that’s look to the usernames on this server, but what is the best method and how must I do that to set the owner rights correctly, the domain is , lets called, domain a user is domain\baker

     

     

    function VoerUit ([string]$startDir)
    {
     write "Bezig met $startDir"

     $rootDirs = dir $startDir

     

     foreach ($letter in $rootDirs)
     {

      $pat = $startDir + "\" + $letter


      write "Hier eerst met iacls administrator owner maken van $pat"
      write "Hier dan met iacls administrator full control geven op $pat"


      $Namen=dir $pat -name
      foreach ($naam in $namen)
      {
       $DirToDo = $pat + "\" + $naam
       write "bezig met modificeren van $DirToDo"
       write "Hier \\domain\$naam owner maken van $DirToDo"
       write "Hier $naam full control geven van $DirToDo"
      }

      write "Hier eerst met iacls van administrator alle rechten en owner van $pat halen"


     }
    }

     

    VoerUit ("\\shareserver\b")

    PoSherLifeUser is Offline
    Basic Member
    Basic Member
    Posts:364
    Avatar

    --
    01 Mar 2010 10:04 PM
    someone correct me if I'm wrong, but setting NTFS ownership to someone other than the authenticated user is not possible without using 3rd party tools.  With PoSh you can only set Owner to the account the script is being run with.
    When at first you don't succeed Step-Into

    http://theposherlife.blogspot.com
    http://www.jandctravels.com

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer