Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Alternate Data Streams on files

Reply
 
Old 01-09-2007   #1 (permalink)
Brandon Shell


 
 

Alternate Data Streams on files

Anyone have and idea if its possible and how to do this in Powershell?

--

Brandon Shell
---------------
Stop by my blog some time
http://mybsinfo.blogspot.com/
----------------------------------


My System SpecsSystem Spec
Old 01-09-2007   #2 (permalink)
Gaurhoth


 
 

Re: Alternate Data Streams on files

..NET doesn't seem to have any managed support for accessing ADS so I would expect that Powershell lacks support as well. There are win32 api's that allow access... but you'd likely need a third party dll to use that from Powershell.

You could creatively use some command line commands that support ADS to *read* the contents of a stream. I'm sure variations of this could be adapted for writing... but nothing in native powershell.

PS C:\Downloads> cmd /c "dir /r"
Volume in drive C has no label.
Volume Serial Number is 0000-0000

Directory of C:\Downloads

01/08/2007 11:09 PM <DIR> .
01/08/2007 11:09 PM <DIR> ..
12/22/2006 11:08 PM 23,510,720 dotnetfx_v2.0.exe
26 dotnetfx_v2.0.exe:Zone.Identifier:$DATA

PS C:\Downloads> $r = cmd /c "more < dotnetfx_v2.0.exe:Zone.Identifier:$DATA"
PS C:\Downloads> $r
[ZoneTransfer]
ZoneId=3

--

gaurhoth
http://gaurhothw.spaces.live.com/


"Brandon Shell" <tshell.mask@gmail.com> wrote in message news:ekkPVaCNHHA.1248@TK2MSFTNGP03.phx.gbl...
> Anyone have and idea if its possible and how to do this in Powershell?
>
> --
>
> Brandon Shell
> ---------------
> Stop by my blog some time
> http://mybsinfo.blogspot.com/
> ----------------------------------
>

My System SpecsSystem Spec
Old 01-09-2007   #3 (permalink)
Maximilian Hänel


 
 

Re: Alternate Data Streams on files

Hi Brandon

> Anyone have and idea if its possible and how to do this in Powershell?


A few month ago dreeschkind posted this one:

http://groups.google.de/group/micros...697a0aba7ab9ec

hth

Max
My System SpecsSystem Spec
Old 01-09-2007   #4 (permalink)
Brandon Shell


 
 

Re: Alternate Data Streams on files

Thanks... That was what I was looking for... I knew it had been discussed,
but my searches as well as google let me down

"Maximilian Hänel" <ngSpam@smjh.de> wrote in message
news:eXX$5tDNHHA.4376@TK2MSFTNGP03.phx.gbl...
> Hi Brandon
>
>> Anyone have and idea if its possible and how to do this in Powershell?

>
> A few month ago dreeschkind posted this one:
>
> http://groups.google.de/group/micros...697a0aba7ab9ec
>
> hth
>
> Max


My System SpecsSystem Spec
Old 01-10-2007   #5 (permalink)
/\\/\\o\\/\\/ [MVP]


 
 

Re: Alternate Data Streams on files

I'm using the library i mentioned in the former thread,

[void][System.Reflection.Assembly]::LoadFile("c:\powershell\ntfs.dll")

and I have the following in my typedata, I use for unblocking files, I still
have this on my "to blog" list

<Type>
<Name>System.IO.FileSystemInfo</Name>
<Members>
<ScriptMethod>
<Name>Block</Name>
<Script>
$FS = new NTFS.FileStreams($this.fullname)
$fs.add('Zone.Identifier')
$stream = $fs.Item('Zone.Identifier').open()

$sw = [System.IO.streamwriter]$stream
$Sw.writeline('[ZoneTransfer]')
$sw.writeline('ZoneID=4')
$sw.close()

$stream.close()
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>UnBlock</Name>
<Script>
$FS = new NTFS.FileStreams($this.fullname)
$fs['Zone.Identifier'].delete()
</Script>
</ScriptMethod>
<ScriptMethod>
<Name>GetFileStreams</Name>
<Script>
$FS = new NTFS.FileStreams($this.fullname)
$fs
</Script>
</ScriptMethod>

Greetings /\/\o\/\/

"Brandon Shell" <tshell@mask.gmail.com> wrote in message
news:OeWlGHENHHA.1240@TK2MSFTNGP03.phx.gbl...
> Thanks... That was what I was looking for... I knew it had been discussed,
> but my searches as well as google let me down
>
> "Maximilian Hänel" <ngSpam@smjh.de> wrote in message
> news:eXX$5tDNHHA.4376@TK2MSFTNGP03.phx.gbl...
>> Hi Brandon
>>
>>> Anyone have and idea if its possible and how to do this in Powershell?

>>
>> A few month ago dreeschkind posted this one:
>>
>> http://groups.google.de/group/micros...697a0aba7ab9ec
>>
>> hth
>>
>> Max

>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Executables in Alternate Data Stream would't execute General Discussion
Bitmaps from streams - duplicated data in memory? .NET General
any way to enable "alternate data streams" in Vista ? Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46