Alternate Data Streams
NTFS has the ability to associate multiple data streams (aka forks) to a file. It’s not very well supported in most Microsoft tools and not very well known, but I use them quite a bit for associating metadata with files.
Unfortunately, PowerShell (or rather .NET) doesn’t support them very well.
If I open up a “Command Prompt” window (CMD.EXE), I can do things like this:
CMD>echo Hello world > file.txt CMD>echo Hello other world > file.txt:other CMD>more < file.txt Hello world CMD>more < file.txt:other Hello other world
As you can see, file.txt has two streams, the default one and one named other.
Back in PowerShell:
PS>gc file.txt Hello world PS>gc file.txt:other Get-Content : Cannot find drive. A drive with name 'file.txt' does not exist. At line:1 char:3 + gc < < file.txt:other
PowerShell doesn't like it. It incorrectly parses the part before the colon as a drive. Even if PowerShell did parse it properly, the underlying .NET bit would fail with System.NotSupportedException: The given path's format is not supported.
.
Perhaps Microsoft don't want people using ADS any more... or perhaps they're just not sure... if you Move-Item
or Copy-Item
the file, the extra stream is moved/copied intact.
PowerShell : Accessing alternative data-streams of files on an NTFS volume ……
As Adrian Milliner, mentioned on his blog here : Alternate Data Streams , Alternate Data Streams are…
Hi Adrian,
I use a .NET library for this, and made a blogpost about it :
http://thepowershellguy.com/blogs/posh/archive/2007/01/27/powershell-accessing-alternative-data-streams-of-files-on-an-ntfs-volume.aspx
Greetings /\/\o\/\/