123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- wmic csproduct get UUID
- using System;
- using System.Management;
- class Program
- {
- static void Main()
- {
- // WMI를 사용하여 컴퓨터의 고유 식별자 가져오기
- ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystemProduct");
- foreach (ManagementObject obj in searcher.Get())
- {
- string uniqueId = obj["UUID"].ToString();
- Console.WriteLine($"유일한 식별자 (UUID): {uniqueId}");
- }
- }
- }
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class UniqueIdentifierExample {
- public static void main(String[] args) {
- try {
- Process process = Runtime.getRuntime().exec("wmic csproduct get UUID");
- BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
- String line;
- while ((line = reader.readLine()) != null) {
- if (!line.trim().isEmpty()) {
- System.out.println("유일한 식별자 (UUID): " + line.trim());
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- #include <iostream>
- #include <windows.h>
- #include <intrin.h>
- #include <iphlpapi.h>
- // CPU의 시리얼 번호를 얻는 함수
- void getCPUSerialNumber(std::string& serialNumber)
- {
- int cpuInfo[4] = { 0 };
- __cpuid(cpuInfo, 1);
- serialNumber = std::to_string(cpuInfo[3]) + std::to_string(cpuInfo[0]);
- }
- // MAC 주소를 얻는 함수
- void getMACAddress(std::string& macAddress)
- {
- IP_ADAPTER_INFO adapterInfo[32];
- DWORD bufferSize = sizeof(adapterInfo);
- DWORD status = GetAdaptersInfo(adapterInfo, &bufferSize);
- if (status == ERROR_SUCCESS)
- {
- macAddress = adapterInfo[0].Address;
- }
- }
- int main()
- {
- std::string cpuSerialNumber;
- getCPUSerialNumber(cpuSerialNumber);
- std::cout << "CPU 시리얼 번호: " << cpuSerialNumber << std::endl;
- std::string macAddress;
- getMACAddress(macAddress);
- std::cout << "MAC 주소: " << macAddress << std::endl;
- return 0;
- }
- #include <vcl.h>
- #pragma hdrstop
- #include <tchar.h>
- #include <System.SysUtils.hpp>
- #include <System.Classes.hpp>
- #include <Vcl.Forms.hpp>
- #include <Vcl.Dialogs.hpp>
- #pragma argsused
- int _tmain(int argc, _TCHAR* argv[])
- {
- try
- {
- // WMI를 사용하여 컴퓨터의 고유 식별자 가져오기
- TVarRec args[1];
- args[0] = Variant(L"UUID");
- Variant result = ExecCmdProcess(L"wmic", L"csproduct get %s", args, 1);
- ShowMessage(L"유일한 식별자 (UUID): " + result);
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- return 0;
- }
- #include <vcl.h>
- #include <iostream>
- #include <string>
- #pragma hdrstop
- // 윈도우 컴퓨터의 고유 식별자를 가져오는 함수
- std::string getComputerUUID()
- {
- TGUID guid;
- guid = System::Sysutils::CreateGUID();
- std::wstring uuid = System::Sysutils::GUIDToString(guid).c_bstr();
- return std::string(uuid.begin(), uuid.end());
- }
- int main()
- {
- try
- {
- std::string uuid = getComputerUUID();
- std::cout << "유일한 식별자 (UUID): " << uuid << std::endl;
- }
- catch (Exception &exception)
- {
- Application->ShowException(&exception);
- }
- return 0;
- }
- ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'");
- foreach (ManagementObject currentObject in theSearcher.Get())
- {
- ManagementObject theSerialNumberObjectQuery = new ManagementObject("Win32_PhysicalMedia.Tag='" + currentObject["DeviceID"] + "'");
- MessageBox.Show(theSerialNumberObjectQuery["SerialNumber"].ToString());
- }
|