Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Update-TypeData

Update-TypeData - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Update-TypeData

Short description
Updates the extended type data in the session.

Syntax


Description
The Update-TypeData cmdlet updates the extended type data in the session by reloading the Types.ps1xml files into 
memory and adding new extended type data.


By default, Windows PowerShell loads extended type data as it is needed. Without parameters, Update-TypeData reloads 
all of the Types.ps1xml files that it has loaded in the session, including any type files that you added. You can use 
the parameters of Update-TypeData to add new type files and add and replace extended type data.


The Update-TypeData cmdlet can be used to preload all type data. This feature is particularly useful when you are 
developing types and want to load those new types for testing purposes.


Beginning in Windows PowerShell 3.0, you can use Update-TypeData to add and replace extended type data in the session 
without using a Types.ps1xml file. Type data that is added dynamically, that is, without a file, is added only to the 
current session. To add the type data to all sessions, add an Update-TypeData command to your Windows PowerShell 
profile. For more information, see about_Profiles (http://go.microsoft.com/fwlink/?LinkID=113729).


Also, beginning in Windows PowerShell 3.0, you can use the Get-TypeData cmdlet to get the extended types in the 
current session and the Remove-TypeData cmdlet to delete extended types from the current session.


Exceptions that occur in properties, or from adding properties to an Update-TypeData command, do not report errors to 
StdErr. This is to suppress exceptions that would occur in many common types during formatting and outputting. If you 
are getting .NET Framework properties, you can work around the suppression of exceptions by using method syntax 
instead, as shown in the following example:


"hello".get_Length()


Note that method syntax can only be used with .NET Framework properties. Properties that are added by running the 
Update-TypeData cmdlet cannot use method syntax.


For more information about the *types.ps1xml files in Windows PowerShell, see about_Types.ps1xml 
(http://technet.microsoft.com/library/hh847881.aspx).