Windows 시스템 하드웨어 정보 보고서 스크립트

IT 전문가나 기술 애호가라면 컴퓨터의 하드웨어 정보를 자주 확인해야 할 때가 많습니다. 문제 해결, 하드웨어 업그레이드, 또는 단순히 장치 구성을 파악하는 경우 등 기존의 시스템 정보 확인 방식은 단조롭고 비효율적일 수 있습니다. 이 글에서는 PowerShell 스크립트를 활용하여 이러한 작업을 혁신적으로 수행할 수 있는 방법을 소개합니다.

스크립트 주요 기능

  • 시각적 사용자 경험
    • 스크립트 실행 시 ASCII 아트 제목 표시
    • 정보 모듈별 색상 구분으로 가독성 향상
    • 동적 로딩 애니메이션으로 진행 상황 시각화
    • 각 정보 섹션의 깔끔한 테두리 디자인
  • 포괄적인 하드웨어 정보
    • 시스템 개요: OS 버전, 설치일, 부팅 시간, 컴퓨터 이름, 제조업체 등
    • CPU 상세 정보: 프로세서 모델, 코어 수, 주파수, 아키텍처
    • 메모리 분석: 총 용량, 슬롯 사용 현황, 각 모듈 세부 정보
    • 저장 장치: 디스크 모델, 용량, 인터페이스 유형, 일련 번호
    • 그래픽 카드 정보: GPU 모델, VRAM 크기, 드라이버 버전
    • 네트워크 어댑터: 장치 이름, MAC 주소

사용 방법

간단한 세 단계로 실행:

  1. 스크립트 저장
    # Windows 하드웨어 정보 수집 스크립트
    # 'Get-HardwareReport.ps1' 파일로 저장
    
    # 콘솔 설정 (제목 및 전경색)
    $Host.UI.RawUI.WindowTitle = " Windows 하드웨어 정보 도구 "
    $Host.UI.RawUI.ForegroundColor = "White"
    $Host.UI.RawUI.BackgroundColor = "Black"
    
    # 스크립트 헤더 (ASCII 아트) 출력 함수
    function Display-ScriptHeader {
        Write-Host ""
        Write-Host "==================================================================================" -ForegroundColor DarkCyan
        Write-Host "  ██╗  ██╗██╗    ██╗    ███████╗███╗   ██╗ ██████╗  ██████╗ ██╗    ██╗  " -ForegroundColor Yellow
        Write-Host "  ██║  ██║██║    ██║    ██╔════╝████╗  ██║██╔═══██╗██╔═══██╗██║    ██║  " -ForegroundColor Yellow
        Write-Host "  ███████║██║ █╗ ██║    █████╗  ██╔██╗ ██║██║   ██║██║   ██║██║ █╗ ██║  " -ForegroundColor Yellow
        Write-Host "  ██╔══██║██║███╗██║    ██╔══╝  ██║╚██╗██║██║   ██║██║   ██║██║███╗██║  " -ForegroundColor Yellow
        Write-Host "  ██║  ██║╚███╔███╔╝    ███████╗██║ ╚████║╚██████╔╝╚██████╔╝╚███╔███╔╝  " -ForegroundColor Yellow
        Write-Host "  ╚═╝  ╚═╝ ╚══╝╚══╝     ╚══════╝╚═╝  ╚═══╝ ╚═════╝  ╚═════╝  ╚══╝╚══╝   " -ForegroundColor Yellow
        Write-Host "==================================================================================" -ForegroundColor DarkCyan
        Write-Host ""
        Write-Host "                       Windows 하드웨어 정보 수집 도구                      " -ForegroundColor Green
        Write-Host "                       (Hardware Information Collection Tool)                     " -ForegroundColor Green
        Write-Host "==================================================================================" -ForegroundColor DarkCyan
        Write-Host ""
    }
    
    # 로딩 애니메이션 표시 함수
    function Show-ProgressSpinner {
        param([string]$StatusMessage, [int]$DurationSeconds = 1)
        
        $spinnerChars = @('⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷')
        $startTime = Get-Date
        $charIndex = 0
        
        while (((Get-Date) - $startTime).TotalSeconds -lt $DurationSeconds) {
            Write-Host "`r$StatusMessage $($spinnerChars[$charIndex])" -NoNewline -ForegroundColor Green
            $charIndex = ($charIndex + 1) % $spinnerChars.Length
            Start-Sleep -Milliseconds 100
        }
        Write-Host "`r$StatusMessage " -ForegroundColor Green
    }
    
    # 시스템 개요 정보 수집
    function Get-SystemSummary {
        Write-Host "`n  시스템 개요 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "시스템 상세 정보 가져오기" -DurationSeconds 1
        
        $osDetails = Get-WmiObject -Class Win32_OperatingSystem
        $computerDetails = Get-WmiObject -Class Win32_ComputerSystem
        
        $summaryOutput = @"
    ╔══════════════════════════════════════════════════════════════════════════════╗
    ║                                  시스템 개요                                
    ╠══════════════════════════════════════════════════════════════════════════════╣
    ║ 운영체제: $($osDetails.Caption)
    ║ OS 버전: $($osDetails.Version)
    ║ 시스템 아키텍처: $($osDetails.OSArchitecture)
    ║ 설치 날짜: $(($osDetails.ConvertToDateTime($osDetails.InstallDate)).ToString("yyyy-MM-dd HH:mm:ss"))
    ║ 최종 부팅: $(($osDetails.ConvertToDateTime($osDetails.LastBootUpTime)).ToString("yyyy-MM-dd HH:mm:ss"))
    ║ 컴퓨터 이름: $($computerDetails.Name)
    ║ 제조업체  : $($computerDetails.Manufacturer)
    ║ 모델명    : $($computerDetails.Model)
    ║ 현재 사용자: $env:USERNAME
    ╚══════════════════════════════════════════════════════════════════════════════╝
    "@
        return $summaryOutput
    }
    
    # CPU 정보 수집
    function Get-ProcessorDetails {
        Write-Host "`n  CPU 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "프로세서 분석" -DurationSeconds 1
        
        $cpuData = Get-WmiObject -Class Win32_Processor
        
        $cpuOutput = @"
    ╔══════════════════════════════════════════════════════════════════════════════╗
    ║                                   CPU 정보                                  
    ╠══════════════════════════════════════════════════════════════════════════════╣
    ║ 프로세서: $($cpuData.Name)
    ║ 코어 수: $($cpuData.NumberOfCores) 물리적 코어 | $($cpuData.NumberOfLogicalProcessors) 논리적 코어
    ║ 최대 주파수: $([math]::Round($cpuData.MaxClockSpeed/1000, 2)) GHz
    ║ 아키텍처: $($cpuData.AddressWidth) 비트
    ║ 제조업체: $($cpuData.Manufacturer)
    ╚══════════════════════════════════════════════════════════════════════════════╝
    "@
        return $cpuOutput
    }
    
    # 메모리 정보 수집
    function Get-MemoryDetails {
        Write-Host "`n  메모리 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "메모리 모듈 감지" -DurationSeconds 1
        
        $ramModules = Get-WmiObject -Class Win32_PhysicalMemory
        $totalRamGB = ($ramModules | Measure-Object -Property Capacity -Sum).Sum / 1GB
        
        $slotDetails = ""
        $index = 1
        foreach ($module in $ramModules) {
            $moduleSizeGB = [math]::Round($module.Capacity / 1GB, 2)
            $slotDetails += "║ 슬롯 $index : $moduleSizeGB GB | $($module.Speed) MHz | $($module.Manufacturer)`n"
            $index++
        }
        $memoryOutput = @"
    ╔══════════════════════════════════════════════════════════════════════════════╗
    ║                                  메모리 정보                                  
    ╠══════════════════════════════════════════════════════════════════════════════╣
    ║ 총 메모리: $([math]::Round($totalRamGB, 2)) GB
    ║ 메모리 슬롯 사용: $($ramModules.Count) / $((Get-WmiObject -Class Win32_PhysicalMemoryArray).MemoryDevices)
    $slotDetails╚══════════════════════════════════════════════════════════════════════════════╝
    "@
        return $memoryOutput
    }
    
    # 디스크 정보 수집
    function Get-DiskDriveDetails {
        Write-Host "`n  디스크 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "저장 장치 스캔" -DurationSeconds 2
        
        $storageDevices = Get-WmiObject -Class Win32_DiskDrive
        
        $diskOutput = "╔══════════════════════════════════════════════════════════════════════════════╗`n"
        $diskOutput += "║                                  디스크 정보                                  `n"
        $diskOutput += "╠══════════════════════════════════════════════════════════════════════════════╣`n"
        
        foreach ($disk in $storageDevices) {
            $diskSizeGB = [math]::Round($disk.Size / 1GB, 2)
            $diskOutput += "║ 모델명: $($disk.Model)`n"
            $diskOutput += "║ 용량: $diskSizeGB GB | 인터페이스: $($disk.InterfaceType)`n"
            $diskOutput += "║ 일련 번호: $($disk.SerialNumber)`n"
            $diskOutput += "║ ------------------------------------------------------------------------ `n"
        }
        $diskOutput += "╚══════════════════════════════════════════════════════════════════════════════╝"
        
        return $diskOutput
    }
    
    # 그래픽 카드 정보 수집
    function Get-GraphicsCardDetails {
        Write-Host "`n  그래픽 카드 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "그래픽 장치 식별" -DurationSeconds 1
        
        $gpuCards = Get-WmiObject -Class Win32_VideoController
        
        $gpuOutput = "╔══════════════════════════════════════════════════════════════════════════════╗`n"
        $gpuOutput += "║                                그래픽 카드 정보                                `n"
        $gpuOutput += "╠══════════════════════════════════════════════════════════════════════════════╣`n"
        
        foreach ($gpu in $gpuCards) {
            if ($gpu.Name -notlike "*Remote*" -and $gpu.Name -notlike "*Microsoft*") {
                $vramSize = if ($gpu.AdapterRAM -gt 1GB) { 
                    "$([math]::Round($gpu.AdapterRAM/1GB, 2)) GB" 
                } else { 
                    "$([math]::Round($gpu.AdapterRAM/1MB, 2)) MB" 
                }
                $gpuOutput += "║ 그래픽 카드: $($gpu.Name)`n"
                $gpuOutput += "║ VRAM: $vramSize | 드라이버 버전: $($gpu.DriverVersion)`n"
                $gpuOutput += "║ ------------------------------------------------------------------------ `n"
            }
        }
        $gpuOutput += "╚══════════════════════════════════════════════════════════════════════════════╝"
        
        return $gpuOutput
    }
    
    # 네트워크 정보 수집
    function Get-NetworkAdapterDetails {
        Write-Host "`n  네트워크 정보 수집 중..." -ForegroundColor Magenta
        Show-ProgressSpinner -StatusMessage "네트워크 어댑터 확인" -DurationSeconds 1
        
        $activeAdapters = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object { $_.NetEnabled -eq $true }
        
        $networkOutput = "╔══════════════════════════════════════════════════════════════════════════════╗`n"
        $networkOutput += "║                                  네트워크 정보                                  `n"
        $networkOutput += "╠══════════════════════════════════════════════════════════════════════════════╣`n"
        
        foreach ($adapter in $activeAdapters) {
            $networkOutput += "║ 어댑터: $($adapter.Name)`n"
            $networkOutput += "║ MAC 주소: $($adapter.MACAddress)`n"
            $networkOutput += "║ ------------------------------------------------------------------------ `n"
        }
        $networkOutput += "╚══════════════════════════════════════════════════════════════════════════════╝"
        
        return $networkOutput
    }
    
    # 보고서 파일 내 ASCII 헤더
    $reportFileHeader = @"
    ==================================================================================
      ___  ___  _   _ _ __    ___  ___ _____ ___ _____ __  __ ____
     / _ \/ __|| | | | '__|  / _ \| __| | __|_ _| __/ _` |/ _|__ /
    | (_) \__ \| |_| | |    | (_) | _|  | _|| || _| (_| | (_| |_ \
     \___/|___/ \___/|_|     \___/|___| |___|___|___\__,_|\__||__ /
    ==================================================================================
                     Windows 시스템 하드웨어 보고서
    ==================================================================================
    "@
    
    # 메인 스크립트 실행
    Clear-Host
    Display-ScriptHeader
    
    Write-Host "시스템 하드웨어 정보 수집을 시작합니다..." -ForegroundColor Yellow
    Write-Host "═══════════════════════════════════════════════════════════════════════════════" -ForegroundColor Gray
    
    # 모든 정보 수집
    $collectedReport = @()
    $collectedReport += $reportFileHeader # 보고서 파일 시작에 헤더 추가
    $collectedReport += Get-SystemSummary
    $collectedReport += Get-ProcessorDetails
    $collectedReport += Get-MemoryDetails
    $collectedReport += Get-DiskDriveDetails
    $collectedReport += Get-GraphicsCardDetails
    $collectedReport += Get-NetworkAdapterDetails
    
    # 파일로 저장
    $reportFilePath = "$env:USERPROFILE\Desktop\시스템_하드웨어_보고서.txt"
    Write-Host "`n  보고서를 바탕 화면에 저장 중..." -ForegroundColor Magenta
    
    # 진행률 표시
    for ($i = 0; $i -le 100; $i += 10) {
        Write-Progress -Activity "하드웨어 정보 보고서 저장" -Status "파일 작성 중..." -PercentComplete $i
        Start-Sleep -Milliseconds 100
    }
    Write-Progress -Activity "하드웨어 정보 보고서 저장" -Completed
    
    $collectedReport | Out-File -FilePath $reportFilePath -Encoding UTF8
    
    # 완료 메시지 및 파일 열기
    Write-Host ""
    Write-Host " 하드웨어 정보 수집이 완료되었습니다!" -ForegroundColor Green
    Write-Host " 보고서가 다음 위치에 저장되었습니다: $reportFilePath" -ForegroundColor Cyan
    Write-Host ""
    
    try {
        $openResponse = Read-Host "보고서 파일을 바로 여시겠습니까? (Y/N)"
        if ($openResponse -eq 'Y' -or $openResponse -eq 'y') {
            Invoke-Item $reportFilePath
        }
    }
    catch {
        Write-Host "파일을 열 수 없습니다. 다음 경로를 수동으로 방문하십시오: $reportFilePath" -ForegroundColor Yellow
    }
    
    Write-Host ""
    Write-Host "아무 키나 눌러 종료..." -ForegroundColor Gray
    $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    
  2. 스크립트 실행
    # 파일을 마우스 오른쪽 버튼으로 클릭하여 "PowerShell로 실행" 선택
    # 또는 관리자 권한으로 PowerShell을 열고 다음 명령 실행:
    .\Get-HardwareReport.ps1
    
  3. 보고서 확인
    • 스크립트 실행 완료 후 바탕 화면에 시스템_하드웨어_보고서.txt 파일이 생성됩니다.
    • 스크립트 실행 종료 시 보고서 파일을 바로 열 것인지 선택할 수 있습니다.

스크립트 실행 요구 사항

  • Windows PowerShell 5.0 이상 버전
  • 더욱 완전한 정보를 얻으려면 관리자 권한으로 실행하는 것이 좋습니다.
  • 추가 소프트웨어 또는 모듈 설치가 필요 없습니다.

기술적 특징

  • 강력한 오류 처리
    try {
        # 하드웨어 정보 수집 코드
        $processorData = Get-WmiObject -Class Win32_Processor
    } catch {
        # 예외 발생 시 처리 (예: 일부 정보 수집 실패 시에도 전체 보고서 생성 유지)
        Write-Host "일부 정보 수집에 실패했으나, 전체 보고서 생성에는 영향을 주지 않습니다." -ForegroundColor Yellow
    }
    
  • 실시간 진행 상황 피드백
    # 동적 로딩 스피너
    $spinnerChars = @('⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷')
    # 진행률 표시줄
    Write-Progress -Activity "하드웨어 정보 보고서 저장" -Status "파일 작성 중..." -PercentComplete $i
    

활용 시나리오

전문가용

  • IT 지원: 고객 시스템 정보 신속 수집으로 문제 진단 효율성 증대
  • 시스템 관리: 여러 장치의 하드웨어 정보 일괄 수집 및 자산 목록 구축
  • 구매 결정: 현재 하드웨어 구성 기반의 업그레이드 계획 수립

개인용

  • 하드웨어 애호가: 자신의 장치 구성에 대한 상세한 이해
  • 게이머: 시스템 성능 평가 및 게임 환경 최적화
  • 학습 및 연구: 컴퓨터 하드웨어 구성 및 작동 원리 파악

태그: PowerShell Windows SystemReport HardwareInfo WMI

8월 10일 15:16에 게시됨