Remove read only property of a file

Supply the filepath as parameter to 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

 

Output
Readonly1
Readonly2

Leave a Reply