Edit

Share via


Disconnect-CMTrackedObject

Clean up unused PowerShell objects to avoid SMS Provider quota violation errors.

Syntax

ByValue (Default)

Disconnect-CMTrackedObject
    -InputObject <IDisposable[]>
    [-Force]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByAll

Disconnect-CMTrackedObject
    [-All]
    [-Force]
    [-DisableWildcardHandling]
    [-ForceWildcardHandling]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

When you use Start-CMObjectTracking to track SMS Provider objects used by the PowerShell runtime, use this cmdlet to clean up these resources when they're no longer needed.

When you run Start-CMObjectTracking, the PowerShell runtime tracks IResultObject objects created by Configuration Manager cmdlets. For objects that aren't manually cleaned up with .Dispose(), reclaim them by using Disconnect-CMTrackedObject against an individual object.

Once an object is reclaimed, it can no longer be reused or passed to another cmdlet through the object pipeline.

Stop-CMObjectTracking can be used to turn off object tracking. Previously allocated objects remain active.

Unclaimed resources can cause the SMS Provider to raise quota violation errors. These quota issues typically manifest from working with large sets of SMS Provider objects or in long-running environments.

Note

This feature is experimental and may be subject to change or removal in a future release.

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1

The first command turns on object tracking. The second command reclaims a single object specified by the $obj variable. The third command reclaims all tracked objects. The last command turns off object tracking.

Start-CMObjectTracking

# Reclaim a single tracked object
$obj | Disconnect-CMTrackedObject -Force

# Reclaim all tracked objects
Disconnect-CMTrackedObject -All

Stop-CMObjectTracking

Parameters

-All

Add this parameter to reclaim all tracked objects.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByAll
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Add this parameter to prompt for confirmation before the cmdlet runs.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Add this parameter to run the command without asking for confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Specify any IResultObject that you previously created with a Configuration Manager cmdlet.

Parameter properties

Type:

IDisposable[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:InputObjects

Parameter sets

ByValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.IDisposable

Outputs

System.Object