Skip to content

Instantly share code, notes, and snippets.

@zbalkan
Last active July 21, 2019 14:03
Show Gist options
  • Save zbalkan/7063d7533a0186bf9842aa3378db7d38 to your computer and use it in GitHub Desktop.
Save zbalkan/7063d7533a0186bf9842aa3378db7d38 to your computer and use it in GitHub Desktop.
A simple function to export NTFS Alternate Data Streams (ADS) of a specified file as symbolic links.
function Export-ADS (){
[CmdletBinding()]
param (
$Path
)
process {
Get-Item $Path -Stream * |
Select-Object -Property Stream -Skip 1 |
ForEach-Object {
$item = Get-Item $Path
[void] (New-Item -Path (Join-Path -Path $item.Directory -ChildPath "$($item.Name)_$($_.Stream)") -ItemType SymbolicLink -Value ("$($item.FullName):$($_.Stream)") -Force -Confirm:$false)
}
}
}
# Example
# Export-ADS -Path "test.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment