# Deploy and run test query on AD2
$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] Copying test script to AD2..." -ForegroundColor Green
Copy-Item "D:\ClaudeTools\test-query.js" "AD2:\Shares\testdatadb\test-query.js" -Force

Write-Host "[OK] Test script deployed" -ForegroundColor Green
Write-Host "`n[ACTION] Run on AD2:" -ForegroundColor Yellow
Write-Host "  cd C:\Shares\testdatadb" -ForegroundColor Cyan
Write-Host "  node test-query.js" -ForegroundColor Cyan

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