# Restore original api.js from backup
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)

Write-Host "[OK] Mounting AD2 C$ share..." -ForegroundColor Green
New-PSDrive -Name AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $cred -ErrorAction Stop | Out-Null

Write-Host "[OK] Restoring original api.js from backup..." -ForegroundColor Yellow
Copy-Item "AD2:\Shares\testdatadb\routes\api.js.backup-2026-01-21-124402" "AD2:\Shares\testdatadb\routes\api.js" -Force

Write-Host "[OK] Original file restored" -ForegroundColor Green
Write-Host "[ACTION] Restart Node.js: taskkill /F /IM node.exe && cd C:\Shares\testdatadb && node server.js" -ForegroundColor Yellow

Remove-PSDrive -Name AD2 -ErrorAction SilentlyContinue
Write-Host "[OK] Done" -ForegroundColor Green
