Remove Read Only Attribute on File Using PowerShell

Remove read only property of a file

A common issue that administrators face while restoring files from their backups is that the read-only property of the files comes marked by default. This can cause serious trouble as end users will not be able to edit their documents without duplicating the restored files. However, a simple PowerShell code can be run to remove the read-only attribute of the necessary files.
 
Supplying the file path as a parameter and executing the following code will remove the read only property of a file. 

Script

<#
.SYNOPSIS
This script can be used to remove read only property of a file.
.DESCRIPTION
This script can be used to remove read only property of a file.
.EXAMPLE
C:\PS> C:\Script\To_Remove_Readonlyproperty_of_a_File.ps1 C:\Users\gautam\Desktop\Test_File.ps1
Removes the read only property of Test_File.ps1.
#>
#Set the IsReadonly value to false.

param ( [string]$FileName )
Set-ItemProperty $FileName -name IsReadonly -value $false