In the first section of this guide, you get a quick overview of the Powershell NoTypeInformation parameter. Then, in section two, I’ll show you how to find all cmdlets that use the NoTypeInformation parameter. In section three, you’ll learn the syntax of these cmdlets, including the NoTypeInformation parameter. After you have read all these, you’ll be prepared to read the exciting part – section four details some examples and applications of the NoTypeInformation parameter.

Powershell NoTypeInformation Parameter: Overview

When you use some PowerShell cmdlets to export data to csv, convert to csv or export to XML, the operation includes the #TYPE information header by default.

So, what is #TYPE information? Every PowerShell object has a TypeName. For example, the TypeName for Get-Process is System.Diagnostics.Process. The TypeName of an object is the .Net class of that object. One way to display the type information of an object is to pipe the output of the cmdlet to the Get-Member cmdlet. For example, to see the TypeName for Get-Process, run the command below: The Get-Member cmdlet displays the properties and methods of a cmdlet. But before that, on top of the properties and methods, it displays the TypeName. As you can see from the screenshot below, the TypeName of Get-Process is System.Diagnostics.Process. I know that you must be wondering how all of these relate to the Powershell NoTypeInformation parameter. Here is how: When you export the output of some cmdlets to csv using the Export-csv cmdlet, the Export-csv includes the type information returned by the original cmdlet into the csv file’s header. If you want the type information to be excluded from the exported file’s header, then you need to include the NoTypeInformation parameter in the Export-csv command. It is essential to mention that from PowerShell version 6.0, you do not need to specify the NoTypeInformation to remove the #TYPE information from the header of the exported file. In the examples section of this guide, I have some examples that demonstrate how PowerShell version 6.0 and upwards handle #TYPE information compared to previous versions of PowerShell.

Cmdlets That Use The PowerShell NoTypeInformation Parameter

In the last section, I hinted that there are three cmdlets that feature the NoTypeInformation parameter. Run the command below to get a list of cmdlets that feature the NoTypeInformation parameter. As you can see from the screenshot below, the three PowerShell cmdlets that feature the NoTypeInformation parameter are Export-Csv, ConvertTo-Csv and ConvertTo-Xml.

Syntax Of The NoTypeInformation Parameter

Since the NoTypeInformation is a parameter of cmdlets, it does not have its own syntax. The syntax of the NoTypeInformation is effectively the syntax of the cmdlet that features the parameter. So, here are the basic syntaxes of the three cmdlets that feature the NoTypeInformation parameter. Earlier I mentioned that from PowerShell version 6.0, the default behavior of these cmdlets is to exclude the #TYPE information. So, from 6.0, Export-Csv and ConvertTo-Csv include a parameter called IncludeTypeInformation. This parameter was introduced so that if you need to include the #TYPE information, you can call the IncludeTypeInformation parameter.

Examples And Applications Of The Powershell NoTypeInformation Parameter

Now that you have some information about the Powershell NoTypeInformation parameter, it’s time to see some examples and applications.

How To Use Export-Csv PowerShell Cmdlet With NoTypeInformation Parameter

This is the most natural place to start, as you’re likely to have the need to remove the #TYPE information header by using the Export-Csv command. To demonstrate how to use Export-Csv with the NoTypeInformation parameter, I’ll export the output of Get-Service to csv. Firstly, I’ll run the command without the Export-Csv’s NoTypeInformation parameter. Here is the result of the command displaying the #TYPE information on the csv file’s header. To remove the “TYPE System.ServiceProcess.ServiceController” from the csv file’s header, I’ll run the last command, but this time, I’ll include the NoTypeInformation parameter. This time the “TYPE System.ServiceProcess.ServiceController” is no longer at the csv file’s header. Earlier, I mentioned that from PowerShell version 6.0, when you run the Export-Csv command, you no longer need to include the NoTypeInformation parameter. This is because, from PowerShell version 6.0, the Export-Csv command no longer includes #TYPE information on the csv file’s header. Now, I’ll run the last command from my PowerShell version 7.2 console. Bingo, the is no #TYPE information on the csv file’s header! But what if I want to include the #TYPE information on the csv file’s header? In that case, when I run the command in PowerShell v6.0 and above, I’ll include a parameter called IncludeTypeInformation. This time, the #TYPE information will return to the csv file’s header!

How To Use Select-Object And Export-csv With NoTypeInformation

In the last example, I exported the output of the Get-Service to csv. However, I explored all headers. But what if I want to only show the Name and Status of the service. In that case, I will introduce the Select-Object command. Here is a sample command. The command returned all services on my computer but only shows the Names and Status of the services.

How To Use ConvertTo-Csv PowerShell Cmdlet With NoTypeInformation Parameter

To demonstrate how to use ConvertTo-Csv with NoTypeInformation, let’s start by running the Get-Process command to return a process called ACCSvc. As expected, the command returns the process in a tabular format. But what if I want to return the information in CSV (comma-separated values). To achieve this, I will pipe the output of the Get-Process command to ConvertTo.Csv The above command does a good job of converting the output of Get-Process to csv. However, it left the “TYPE System.Diagnostics.Process” #TYPE information above the result. To get rid of “TYPE System.Diagnostics.Process”, I’ll include the NoTypeInformation Parameter in the Powershell ConvertTo-Csv cmdlet. Now, “TYPE System.Diagnostics.Process” is no longer in the result. But, one more task may be required to complete this process. Most administrators will want to export this information to a CSV file. To achieve this, I’ll now pipe the output of the last command to the Out-File command.

How To Append Data With Export-Csv NoTypeInformation

The Export-Csv cmdlet has an Append parameter. When you specify the Append parameter, Export-Csv adds output to the end of a specified file. Otherwise, without including the Append parameter, Export-Csv overwrites the file with new information. At this point, you may be thinking that when you append information to a csv file, the Export-Csv cmdlet will also include the #TYPE information. Surprisingly, when you append the information to a csv file even without using the NoTypeInformation parameter, the Export-Csv cmdlet does NOT include the #TYPE information. Let’s see how these theories work in real PowerShell commands. I’ll start by creating a csv that contains a single process called ACCSvc. Here is the result of the last command in a csv file. In this next step, I want to append another process called AgentSvc. To add this information to the end of the csv file, I’ll include the Append parameter. The result of the screenshot below shows that the above command did not include the #TYPE information before appending the next line to the csv file.

My Final Thoughts About The Powershell NoTypeInformation Parameter

The Powershell NoTypeInformation parameter is a very useful parameter that eliminates the annoying #TYPE information header from a csv file. Without it (at least in PowerShell versions prior to 6.0), you will not be able to eliminate the #TYPE information header from a csv file exported with the Export-CSV or ConvertTo-Csv cmdlets. However, as I hinted in the last paragraph, from PowerShell version 6, you do not need to specify the NoTypeInformation parameter anymore. This is because from 6.0 upwards, PowerShell does not include the #TYPE information header. Rather, if you need to include this information, use the IncludeTypeInformation parameter. The IncludeTypeInformation parameter is available from PowerShell version 6.0. I hope I was able to make it easy for you to understand the Powershell NoTypeInformation parameter. I also hope that you found the examples helpful? If you found this guide helpful and easy to understand, kindly spare 2 minutes to share your experience with our community at Itechguides Community Forum. On the other hand, if you still have a question about the Powershell NoTypeInformation parameter, please reply to this article’s topic at Itechguides Community Forum. Finally, to read more PowerShell Explained articles, visit our Windows PowerShell Explained page.

References And Further Reading