Removing AutoInsert-Rules

This chapter describes deleting AutoInsert-Rule-objects.


Examples:


Hint: The execution of these examples requires a connected PowerShell drive.


To delete AutoInsert-Rule-objects, the Remove-EmdbAutoInsertRule cmdlet is used. The Rule "Computer Chicago", that was created beforehand, can be deleted using the following commands:


Remove-EmdbAutoInsertRule "Computer Chicago"


Alternatively, the Delete()-method of the corresponding object can be used, as the following example shows:


$MyAutoInsertRule = Get-EmdbAutoInsertRule "Users"

$MyAutoInsertRule.Delete()


Note: Note that AutoInsert-Rule-objects are not part of the context rootDSE and therefore they can be referenced without a full qualified path resp. an absolute path.


Starting with PSX 3.1 there was a new option implemented when deleting AutoInsert-Rule objects. When specifying the SingleItemExpected-switch it is expected, that none or exactly one object is affected. If the command would delete more than one object, an error is raised that can be caught and handled in scripts.