$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password) Write-Host "[OK] Mounting AD2 C$ share..." try { New-PSDrive -Name AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $cred -ErrorAction Stop | Out-Null Write-Host "[OK] Mounted as AD2: drive" Write-Host "`n[OK] Listing root directories..." Get-ChildItem AD2:\ -Directory | Where-Object Name -match "database|testdata|test.*db" | Format-Table Name, FullName Write-Host "`n[OK] Reading Sync-FromNAS.ps1..." if (Test-Path "AD2:\Shares\test\scripts\Sync-FromNAS.ps1") { $scriptContent = Get-Content "AD2:\Shares\test\scripts\Sync-FromNAS.ps1" -Raw $scriptContent | Out-File -FilePath "D:\ClaudeTools\Sync-FromNAS-retrieved.ps1" -Encoding UTF8 Write-Host "[OK] Script retrieved and saved" Write-Host "`n[INFO] Searching for database references in script..." $scriptContent | Select-String -Pattern "(database|sql|sqlite|mysql|postgres|\.db|\.mdb|\.accdb)" -AllMatches | Select-Object -First 20 } else { Write-Host "[ERROR] Sync-FromNAS.ps1 not found" } Write-Host "`n[OK] Checking for database files in Shares\test..." Get-ChildItem "AD2:\Shares\test" -Recurse -Include "*.db","*.mdb","*.accdb","*.sqlite" -ErrorAction SilentlyContinue | Select-Object -First 10 | Format-Table Name, FullName } catch { Write-Host "[ERROR] Failed to mount share: $_" } finally { if (Test-Path AD2:) { Remove-PSDrive -Name AD2 -ErrorAction SilentlyContinue Write-Host "`n[OK] Unmounted AD2 drive" } }