PowerShell Logo Small

Remove-TypeData



This is the built-in help made by Microsoft for the command 'Remove-TypeData', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Deletes extended types from the current session

SYNTAX


Remove-TypeData [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]] -TypeData <TypeData>
[-Confirm] [-WhatIf] [<CommonParameters>]
Remove-TypeData [-TypeName] <String> [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]]
[-Confirm] [-WhatIf] [<CommonParameters>]
Remove-TypeData [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]] -Path <String[]> [-Confirm]
[-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-TypeData cmdlet deletes extended type data from the current session. This cmdlet affects only the current session and sessions that are created in the current
session.


You can add properties and methods to objects in Windows PowerShell by defining them in Update-TypeData commes. For more information about Types.ps1xml files, see about_Types.ps1xml (http://go.microsoft.com/fwlink/?LinkID=113274).


This cmdlet is introduced in Windows PowerShell 3.0.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=294005
Get-TypeData
Update-TypeData
about_Types.ps1xml

REMARKS

<

Examples


Example 1

PS C:\>Remove-TypeData -TypeName System.Array



This command deletes from the session all type data for the System.Array type, including type data that was added by a Types.ps1xml file and dynamic type data that was added
to the session by using the Update-TypeData cmdlet.






Example 2

The first command uses the Get-TypeData cmdlet to get extended type data for the System.DateTime type.The output shows that a DateTime property has been added to all
System.DateTime objects in Windows PowerShell.
PS C:\>Get-TypeData System.DateTime
TypeName Members
-------- -------
System.DateTime {[DateTime, System.Management.Automation.Runspaces.ScriptPropertyData]}

The second command uses the Get-Date cmdlet, which returns a System.DateTime object. The command uses dot notation to get the value of the DateTime property of the
System.DateTime object that Get-Date returns.
PS C:\>(Get-Date).DateTime
Friday, January 20, 2012 9:01:00 PM

The third command uses the Get-TypeData cmdlet to get all extended type data for the System.DateTime type and the Remove-TypeData cmdlet to delete the extended type data.
PS C:\>Get-TypeData System.DateTime | Remove-TypeData

The fourth command shows the effect of deleting the extended type data for the System.DateTime type. The command repeats the second command. However, because the
System.DateTime property no longer exists, a command to get its value returns nothing.
PS C:\>(Get-Date).DateTime
PS C:\>



This command shows the effect of removing extended type data from a session.






Example 3

PS C:\>Get-Module | Remove-TypeData



This command removes all extended type data for module objects. When you pipe an object to Remove-TypeData, Remove-TypeData gets the name of the object type and removes all
type data for all objects of that type.






Example 4

PS C:\>Remove-TypeData -Path C:\WINDOWS\System32\WindowsPowerShell\v1.0\Modules\PSScheduledJob,
C:\WINDOWS\System32\WindowsPowerShell\v1.0\Modules\PSWorkflow\PSWorkflow.types.ps1xml



This command uses the Path parameter of the Remove-TypeData cmdlet to remove the extended types that are defined in the Types.ps1xml files that are added by the
PSScheduledJob and PSWorkflow modules. This command does not affect dynamic type data that is added by using the Update-TypeData cmdlet. The command succeeds only when the
modules have been imported into the current session.

For more information about modules, see about_Modules (http://go.microsoft.com/fwlink/?LinkID=144311).






Example 5

PS C:\>Invoke-Command -Session $s {Get-TypeData -TypeName *CIM* | Remove-TypeData}



This command removes extended types from a remote session. The command uses the Invoke-Command cmdlet to remove extended type data for all CIM types in the sessions in the
$s variable.