1
0
Files
odbc-migration-kit/README.md
2025-10-10 18:52:55 -07:00

237 lines
7.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p align="center">
<img src="assets/odbc_migration_kit_banner.png" alt="ODBC Migration Kit Banner" width="100%">
</p>
## 🚀 What this does
This kit:
- Saves all ODBC **drivers, DSNs, and registry settings**
- Builds a single `.zip` backup package
- Automatically lists **vendor download links** (Microsoft, Oracle, MySQL, PostgreSQL, etc.)
- Recreates everything on a new computer in one click
---
## 🖥️ Requirements
- Windows 10 or 11
- Administrator permissions
- PowerShell 5.1 or higher
---
## 🧰 Files Included
| File | Purpose |
| -------------------------- | ----------------------------------------------------- |
| `export-ODBC.ps1` | Run this on the **old computer** to export settings |
| `restore-ODBC.ps1` | Run this on the **new computer** to import everything |
| `ODBC_Backup.zip` | The automatically created backup package |
| `ODBC_Migration_Report.md` | Report with driver download links |
---
## 📤 Step 1 — Backup (Old Computer)
1. **Create a new folder** anywhere on your computer, for example:
`C:\ODBC_Migration_Scripts`
2. Save both of these files into that folder:
- `export-ODBC.ps1`
- `restore-ODBC.ps1`
3. **Right-click the folder** in File Explorer and choose:
**“Open in Terminal”** or **“Open PowerShell window here”**
4. In the PowerShell window that opens, type:
```powershell
.\export-ODBC.ps1
```
(If PowerShell asks about permissions, allow it by typing `Y` when prompted.)
5. When the script finishes, youll see a message like:
```
Export complete. ZIP created at: C:\ODBC_Migration\ODBC_Backup.zip
```
6. Open `C:\ODBC_Migration` and verify that the file `ODBC_Backup.zip` exists and is larger than **1 MB**.
7. Copy that `ODBC_Backup.zip` file to a USB drive or cloud folder.
🟢 **Tip:**
Running the script this way keeps the PowerShell window open —
so if anything goes wrong, youll see the exact error message.
---
## 📥 Step 2 — Restore (New Computer)
1. On the new computer, **create a folder** again (e.g. `C:\ODBC_Migration_Scripts`)
and place both files inside:
- `export-ODBC.ps1`
- `restore-ODBC.ps1`
2. Copy your `ODBC_Backup.zip` file from the old computer into:
```
C:\ODBC_Migration\
```
3. **Right-click the script folder** → choose **“Open in Terminal”**
or **“Open PowerShell window here”**
4. In the PowerShell window, type:
```powershell
.\restore-ODBC.ps1
```
5. The script will:
- Extract your backup
- Import registry settings
- Recreate DSNs
- List missing drivers (with download links)
🟢 **Tip:**
You can safely run the `restore-ODBC.ps1` script more than once — it wont overwrite or damage anything.
Keep the PowerShell window open until the script finishes —
youll see messages like “Added DSN…” or “Missing ODBC Drivers Detected.”
---
## 📊 Step 3 — View the Migration Report
After you finish restoring, a detailed report is automatically created:
```
C:\ODBC_Migration\restore\ODBC_Migration_Report.md
```
You can open this file in:
- **Notepad** (Right-click → “Open with Notepad”)
- Or a **Markdown viewer** (like Typora, Obsidian, or Visual Studio Code)
This report shows every driver that was backed up and whether its installed on your new PC.
Example section from the report:
| ODBC Driver | Platform | Version | Product | Publisher | Download Link |
| ----------------------------- | -------- | -------- | --------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| ODBC Driver 18 for SQL Server | 64-bit | 18.2.1.1 | Microsoft ODBC Driver 18 for SQL Server | Microsoft | [Download](https://learn.microsoft.com/sql/connect/odbc/download-odbc-driver-for-sql-server) |
| MySQL ODBC 8.0 Unicode Driver | 64-bit | 8.0.36 | Oracle | [Download](https://dev.mysql.com/downloads/connector/odbc/) | |
---
## 💾 Step 4 — Install Missing Drivers on the New PC
If the restore window or report says **“Missing ODBC Drivers Detected”**, do this:
1. Open the `ODBC_Migration_Report.md` file
2. Look for any drivers with **“Download”** links
3. Click the link — it will open the **official vendor website**
4. Download and install the driver that matches your system (64-bit or 32-bit)
🟢 **Common examples:**
- SQL Server → “Microsoft ODBC Driver 18 for SQL Server”
- MySQL → “MySQL Connector/ODBC”
- PostgreSQL → “psqlODBC”
- SQLite → “SQLite ODBC Driver”
5. When installing drivers, **right-click the installer** and choose **“Run as Administrator.”**
6. Once installed, **run the `restore-ODBC.ps1` script again**
```powershell
.\restore-ODBC.ps1
```
This will recheck the system and add any DSNs that couldnt be created earlier.
---
## 🧪 Step 5 — Verify the Restored DSNs
1. Press **Windows + R**, type:
```
odbcad32.exe
```
2. Open both:
- **64-bit ODBC Administrator**: `C:\Windows\System32\odbcad32.exe`
- **32-bit ODBC Administrator**: `C:\Windows\SysWOW64\odbcad32.exe`
3. Check that your DSNs appear under:
- **User DSN** and/or **System DSN**
✅ **If you see your DSNs listed under “System DSN,” youre done!**
---
## 🧹 Step 6 — Optional Cleanup
Once everything is working:
- Delete the folder `C:\ODBC_Migration_Scripts`
- Move `ODBC_Backup.zip` to a safe backup location (USB drive, NAS, or cloud storage)
---
## 📦 Files Created During Backup
```
C:\ODBC_Migration\
├── ODBC_Backup.zip
├── export_log.txt
├── export\
│ ├── ODBC_Migration_Report.md
│ ├── odbc_driver_product_map.csv
│ ├── odbc_installer_hits.csv
│ ├── odbc_drivers.csv
│ ├── odbc_dsns.xml
│ ├── ODBC_System.reg
│ ├── ODBC_User.reg
│ └── ODBC_System32.reg
```
---
## 🛠️ Troubleshooting
| Issue | Fix |
| ------------------------------------------- | --------------------------------------------------------------------- |
| PowerShell says “script execution disabled” | Open PowerShell as admin → `Set-ExecutionPolicy RemoteSigned` |
| ZIP not created | Ensure theres enough space on `C:\` and that PowerShell ran as admin |
| Missing driver link says “Search manually” | Use the Markdown report to see full list of known download sites |
| Restore errors out | Run again after installing missing drivers |
---
## 🧑‍💻 Technical Details (for advanced users)
- Uses `Get-OdbcDsn`, `Get-OdbcDriver`, and registry exports
- Detects installed products from `HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall`
- Generates CSV and Markdown reports with official vendor links
- Compressed using `Compress-Archive` built into PowerShell
- Logs stored in `C:\ODBC_Migration`
---
## 🧡 Credits
Created by **Gene Amos** for easy ODBC migration between home or work PCs.
Licensed under MIT.
Feel free to fork and improve.
---