#175925 - 2007-05-03 10:45 AM
Re: Take Ownership
[Re: Saleem]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Most probably, the vbscript can be converted. Quick try (I did not test it).
$strComputer = "."
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2")
$colFolders = $objWMIService.ExecQuery("Select * From Win32_Directory Where Name = 'C:\\Scripts'")
For Each $objFolder In $colFolders
$objFolder.TakeOwnershipEx
Next
But maybe SubInAcl can also help? I read in an other forum that it is much faster than a script SubInACL (SubInACL.exe) ScriptingAnswers.com Forums Archive - take ownership
|
Top
|
|
|
|
#176028 - 2007-05-07 10:10 AM
Re: Take Ownership
[Re: Saleem]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
This can be used to obtain the owner information. Setting the owner information is a bit more difficult to say the least
Dim $ou, $sd
$ou = GetObject("LDAP://OU=SomeOuName,DC=YourOrg,DC=Com")
$sd = $ou.Get("ntSecurityDescriptor")
? $sd.Owner
|
Top
|
|
|
|
#176030 - 2007-05-07 10:28 AM
Re: Take Ownership
[Re: Saleem]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
Then here you go
Dim $ou, $sd
$ou = GetObject("LDAP://CN=TestUser,OU=TestOU,DC=YourDomainName,DC=local")
$sd = $ou.Get("ntSecurityDescriptor")
? $sd.Owner
$sd.Owner = "YourDomainName\YourNewuser"
$ou.Put("ntSecurityDescriptor", $sd)
$ou.SetInfo
? @Error
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|