The following example modifies the security descriptor for an item.




Code Sample

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

$itemID = 37423;


# Set the account name to add to the security descriptor.

$accountName = "CENTREL-WS01\Managers";


# Read the existing descriptor.

$securityDescriptor = $xia.GET_SecurityDescriptor($itemID);


# Create a new security entry.

$securityEntry = New-Object "$($xia.GetType().Namespace).SecurityEntry";

$securityEntry.FullControl = $true;

$securityEntry.AccountName = $accountName;


# Ensure that the security descriptor does not inherit from the parent, and add the new security entry.

$securityDescriptor.Inherit = $false;

$securityDescriptor.SecurityEntries += $securityEntry;


# Update the security descriptor.

$xia.SET_SecurityDescriptor($itemId, $securityDescriptor, $true);