Removing Mobile Devices

Mobile Device objects are deleted by using the cmdlet Remove-EmdbMobileDevice or by invoking the object's Delete()-method.


Examples:


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


This command deletes the Mobile Device named "Android_HTC_01" from the context "emdb:\rootDSE\Managed Mobile Devices\HTC".


Remove-EmdbMobileDevice "emdb:\rootDSE\Managed Mobile Devices\HTC\Android_HTC_01"


The following code deletes the Mobile Device object named "IOS_IPHONE_05" in the current context:


Cd "emdb:\rootDSE\Managed Mobile Devices\Apple"

Remove-EmdbMobileDevice "IOS_IPHONE_05"


Alternatively, the Mobile Device "WPhone8" from the context "emdb:\rootDSE\Managed Mobile Devices\Nokia" can be deleted by using the Delete()-method:


$MyMobileDevice = Get-EmdbMobileDevice "emdb:\rootDSE\Managed Mobile Devices\Nokia\WPhone8"

$MyMobileDevice.Delete()


A third option is to delete the Mobile Device object "Strawberry" from the context "emdb:\rootDSE\Managed Mobile Devices\RIM" through the Remove-Item cmdlet:


Remove-Item "emdb:\rootDSE\Managed Mobile Devices\RIM\Strawberry"


Hint: Alternatively the alias DEL can be used to remove Mobile Device objects.


Note: The functionality described here is available for FrontRange DSM 7.1 and above only.


Starting with PSX 3.1 there was a new option implemented when deleting Mobile Device 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.