The following example updates the owner of an item by removing the existing security descriptor, and assigning the specified user account full control to the item and all child items.




Code Sample

# Set the item identifier of the item for which the security descriptor is to be replaced.

$itemID = 37423;


# Set the name of the user or group account to take ownership of the item.

$accountName = "CENTREL-WS01\Managers";


# Replaces the ownership of the specified item.

$xia.DO_ReplaceOwnership($itemID, $accountName);