Disabling Identity Server in #Sitecore Installation with #PowerShell

Recently I was given the task to disable the identity login for a dev server. It can be done easily by renaming Sitecore.Owin.Authentication.Disabler.config.example and Sitecore.Owin.Authentication.IdentityServer.Disabler.config.example in the [sitefolder]\App_Config\Include\Examples\ folder. We needed an automated way though. Using the PowerShell script below did the trick.

#SitePhysicalRoot and Prefix are optional. If this script is inserted into a PowerShell install script that has these variables already. In my case XP0-SingleDeveloper.ps1.
#$SitePhysicalRoot = "F:\Sites"
#$Prefix = "testsite123"

$filepath = $SitePhysicalRoot + '\' + $Prefix +'.sc\App_Config\Include\Examples\'
$filelist = @()
$fn1 = 'Sitecore.Owin.Authentication.Disabler.config.example'
$fn2 = 'Sitecore.Owin.Authentication.IdentityServer.Disabler.config.example'
$path1 = $filepath + $fn1
$path2 = $filepath + $fn2
$filelist = @($path1,$path2)

 foreach ($file in $filelist) {
    If (Test-Path $file){
        $rn = $file.replace(".example","")
        Rename-Item -Path $file -NewName $rn
        Write-Output $file was renamed to $rn
    } else {
    "{0} does not exist or already renamed" -f $file
    }
}