Skip to content

Instantly share code, notes, and snippets.

@a5ync
Created April 19, 2016 23:56
Show Gist options
  • Save a5ync/578e9a76a56cf3d21e123e4877e10248 to your computer and use it in GitHub Desktop.
Save a5ync/578e9a76a56cf3d21e123e4877e10248 to your computer and use it in GitHub Desktop.
Changes the owner of files (filter *.png) in the given folder
# include Set-Owner
# https://gallery.technet.microsoft.com/scriptcenter/Set-Owner-ff4db177
. .\Set-Owner.ps1
$user = "testUser"
$remoteFiles = Get-ChildItem "C:\img" -Filter *.png
foreach ($file in $remoteFiles)
{
Write-Host Changing the owner of $file.FullName to $user
Set-Owner -Path $file.FullName -Account $user
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment