Загрузка данных


Register-WmiEvent -Class Win32_DeviceChangeEvent -SourceIdentifier USBWatch -Action {
    $time = Get-Date -Format "HH:mm:ss"
    Write-Host "[$time] USB device change detected"
}