Uncheck “Overwrite Existing files” in SharePoint

In SharePoint 2013 we are able to see the option “overwrite Existing files” while attaching documents in Document library. By default the option will be checked most of time by mistakenly end users will upload document with same name so that they can miss the existing document.
To avoid that we will Uncheck that option, so that if they are trying to upload the same name document it will throw error.
We implemented this functionality using JQuery and added in the master page, this will effect only in that particular site only.
Step 1:  Download the master and rename it.
In the new master page we added the JQuery JS file and script as shown below screen shot.
We already uploaded the JS file in the same site in Site Assets library. 


Step 2: Upload the new master page and select the master page for that particular site alone.

Out Put:


Sharepoint On-premises script injection with Powershell


Inject custom JavaScript file to all pages


I want add script into site without editing master page. Using JavaScript Injection we can easily add our custom script into all pages.
Below PowerShell script to inject custom file to all pages.

Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$SiteURL = "http://dotnetsharepoint.com/sites/PublishingSite/"
 
$actionName = "Lakshmi_JS_INjection"
$actiontype = "ScriptLink"
#Custom Script File
$actionSourceFile ="http://dotnetsharepoint.com/sites/PublishingSite/Documents/Test%20Inject.js"

 $Context =New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$web = $Context.Web
$Context.Load($web)
$context.Load($web.Webs)

  $Context.ExecuteQuery()


 if($web)

 try

  {
#for all subsites
 foreach($web in $web.Webs)
{
    
$actions = $web.get_userCustomActions();
$Context.Load($actions)
$Context.ExecuteQuery()
if($actions)

{
#Delete existing script inject

 foreach($action in $actions)
{
if($action.get_description() -eq $actionName -and $action.get_location() -eq $actionType){
$action.deleteObject()

}

}

}
 $newAction = $actions.add();
$newAction.set_description($actionName);
$newAction.set_location('ScriptLink');
$scriptBlock = 'var headID = document.getElementsByTagName("head")[0];var newScript = document.createElement("script");newScript.type ="text/javascript";newScript.src ="';
$scriptBlock += $actionSourceFile + '?ver=' +(Get-Date);
$scriptBlock += '";headID.appendChild(newScript);';
$newAction.set_scriptBlock($scriptBlock);
$newAction.update();
$Context.ExecuteQuery();
Write-Host "Added"

}

}
 catch
  {
 Write-Host "error"

}

}