🐍 Python 3.10+
Export Motherboard Info to CSV (Python)
Exports Motherboard Info (Win32_BaseBoard) to a timestamped CSV file via wmic.
export_base_board_to_csv.py
#!/usr/bin/env python3
"""
export_base_board_to_csv.py
Exports Motherboard Info (Win32_BaseBoard) to a timestamped CSV file using the
built-in `wmic` command, stdlib only.
Usage:
python export_base_board_to_csv.py [output_folder]
"""
import subprocess
import sys
from datetime import datetime
from pathlib import Path
def main() -> None:
out_folder = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".")
out_folder.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
out_path = out_folder / f"base_board_{timestamp}.csv"
result = subprocess.run(
["wmic", "path", "Win32_BaseBoard", "get", "Manufacturer,Product,SerialNumber", "/format:csv"],
capture_output=True, text=True, check=False,
)
if result.returncode != 0:
sys.exit(f"wmic failed: {result.stderr.strip()}")
out_path.write_text(result.stdout, encoding="utf-8")
print(f"Exported Motherboard Info to {out_path}")
if __name__ == "__main__":
main()