New-Item -ItemType

How can I get a full list of values for the -ItemType parameter in New-Item?

I realize that directory and file are acceptable values for the filesystem provider. But where in the help can I confirm this information? Or what command can I run to show it.

Hey Greg,
That’s a good question, i’m not too sure about how to automatically/quickly get a list of values for a parameter. But in this case, its a short list so tabbing through works ok.
File
Directory
SymbolicLink - I think this is V 5 only
Junction
HardLink

I’d be interested to know if there was an easy way to pull this from powershell though.

Liam

If it were an Enum you could easily pull the list but I think Liam points out the only way to find something that appears to just be a ValidateSet.

Thanks for the response guys.
The tab option is a sufficient enough workaround to satisfy my curiosity.

This question was asked five years ago on the TechNet forums:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/4e35f397-d8ad-406d-8ef0-11210ab9f37e/getting-list-of-itemtype-options-for-the-newitem-cmdlet?forum=ITCG

A feature request was filed on connect here:
https://connect.microsoft.com/PowerShell/feedback/details/677346/retrieve-list-of-possible-itemtypes-for-a-provider

There was a response in January indicating you can also press CTRL+spacebar to retrieve a list of possible values. This is new in PowerShell 5.

That only works in the ISE, but it is a good start.

I find that it works in the shell as well, at least on 1511.

Give it a try and see:

New-item c:\newitem.txt -ItemType CTRL+spacebar

The thing is that New-Item is largely dynamic. What values are valid depends on the PSDrive you’re in at the time. So there’s no static enumeration. The command does expose tab completion, but it’s dependent on the PSProvider providing the valid values. Some will, some won’t.

Understood.
Again, appreciate the replies everyone!