Skip to content

Instantly share code, notes, and snippets.

@danielniccoli
Created October 12, 2023 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielniccoli/f221abdd7567b7cc01cc91e9ff926270 to your computer and use it in GitHub Desktop.
Save danielniccoli/f221abdd7567b7cc01cc91e9ff926270 to your computer and use it in GitHub Desktop.
Remove File Attributes that are not supported in PowerShell
Get-Item * | % {
$flagsToRemove = 0x00040000 -bor 0x00080000 -bor 0x00100000 -bor 0x00040000 -bor 0x00400000
$flags = ($_ | Get-ItemProperty).Attributes
$fixedFlags = $flags -band (-bnot $flagsToRemove)
$_ | Set-ItemProperty -Name attributes -Value $fixedFlags
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment