Remove Read Only Item Flag

I recently had an issue where I needed to update the Read Only Item Property on a large set of files.

Below is a script that will process all files under ‘C:\BACKUPFILES’ and set the Item Property ‘Read Only’ to false on all files.

$FolderPath = 'C:\BACKUPFILES'
$setRoAttributeTo = $false
$Items = Get-ChildItem -Path $folderPath -Recurse
Foreach ($File in $Items) {

 IF ($file.Attributes -like '*ReadOnly*'){
Write-Host $file.FullName
Write-Host "File Read Only" -BackgroundColor DarkRed
  Set-ItemProperty $File.FullName -Name IsReadOnly -Value $setRoAttributeTo
 }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.