Remove-EaiMobileStaleDevices
Module: Exchange_AddIn
Applies to: Exchange Server 2013, Exchange Server 2016, Exchange Server 2019
Remove-EaiMobileStaleDevices
SYNOPSIS
This function removes devices from an end user based on a time in days.
SYNTAX
User (Default)
Remove-EaiMobileStaleDevices -days <Object> [-UserName <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Unlimited
Remove-EaiMobileStaleDevices -days <Object> [-Unlimited] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
As devices become in a stale partnership, it is sometimes desired to remove them from the end users list.
This fuction can be used for all users within a tenant or specific user or users.
EXAMPLES
EXAMPLE 1
Remove-EaiMobileStaleDevices -Unlimited -days 60
This will remove all device partnerships older than 60 days for all users within an Exchange on premises organization.
EXAMPLE 2
Remove-EaiMobileStaleDevices -Unlimited -days 30 -WhatIf
This will show what devices would be removed older than 30 days for all users within an Exchange on premises organization.
EXAMPLE 3
Remove-EaiMobileStaleDevices -UserName mike@contoso.com -days 90
This code will remove all device partnerships, older than 90 days, from the user 'mike@contoso.com'
EXAMPLE 4
Remove-EaiMobileStaleDevices -UserName 'mike@contoso.com','Emma@contoso.com' -days 45 -verbose
This code will remove all device partnerships, older than 45 days, from the users 'mike@contoso.com' and 'Emma@contoso.com' and show verbose information.
PARAMETERS
-days
Enter the number of days back to which look for stale devices.
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Unlimited
Type: SwitchParameter
Parameter Sets: Unlimited
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-UserName
Enter user name or a list of user names separated by commas.
Type: String[]
Parameter Sets: User
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Number of days in the past to scan for partnerships.
OUTPUTS
Screen values
NOTES
Initial working code: 10/10/2021
Jason A. Wright, HP support created inital code for device removal.
Mike O'Neill, Microsoft CE updated into function.