PowerShell can use .NET type names, for example to convert values to a given type. Frequently, scripts use a variety of formats to define .NET types. Here is why, and what they mean:

# short name for "Integer" data type
[int]12.4
# official .NET type name
[system.int32]12.4
# here is how you get there
[int].FullName
# with official names, the namespace "System" is always optional
[int32]12.4

In short, PowerShell maintains its own private list of “type accelerators”: alias names for .NET types. When you look into the “FullName” property of any type, you get back the full and official .NET type name. Whenever it starts with “System.”, you are free to remove “System”.

Twitter This Tip! ReTweet this Tip!

Anonymous