본문 바로가기
개발팁

WMIC 사용법, Windows Management Instrumentation Command, 윈도 정보확인하기

by devscb 2022. 11. 12.
반응형
WMIC 사용법, Windows Management Instrumentation Command, 윈도 정보확인하기

 


 

 wmic란?

WMIC란 Windows Management Instrumentation Command의 약자로, WMI에 대한 커맨드라인 툴입니다.

WMI(Windows Management Instrumentation)는 윈도 기반 운영 체제에서 컴퓨터의 관리 데이터와 운영을 위한 인프라입니다.

WMI에는 사용자계정관리, 시스템관리, 프로세스관리, 이벤트로그관리, 서비스관리, 네트워크관리 등등 수 많은 기능이 있습니다.

WMIC가 개발되기전에는 WMI 스크립팅 API 또는 CIM 스튜디오와 같은 도구를 사용하여 WMI가 가능한 컴퓨터를 관리했습니다.

C++, VBScript와 같은 언어와 WMI 네임스페이스에 대한 기본적인 이해가 없다면, 시스템관리하기가 어려웠고 이것이 바로 WMIC가 만들어진 배경입니다.

 

 

 wmic사용법 : 정보확인하기

wmic사용하는법은 간단합니다.명령프롬프트를 켜고, wmic [클래스네임] 을 타이핑 하면됩니다.

 

1. 명령프롬프트 켜기 : 윈도우키 + R 를 누른후, cmd입력하여 실행


 

 

2. wmic [클래스네임] 입력후 엔터예를 들어, os에 대한 정보를 확인하려면 아래와 같이 입력하면 됩니다.

wmic os

 


 

 특정 값만 출력하기 : get 사용

앞선 에제에서 너무 많은 데이터가 한번에 나와서 정보 분간이 잘 안됩니다.

이 때, get을 사용하여 내가 원하는 정보만 확인할 수도 있습니다.

wmic [클래스네임] get [파라미터1,...]

예를 들어, os의 부트디바이스, 빌드넘버, 캡션 정보를 보고 싶으면 아래와 같이 명령어를 입력합니다.

wmic os get bootdevice, buildnumber, caption





 wmic를 통해 확인할 수 있는 항목들

클래스 네임에 해당하는 항목들은 다음과 같이 여러가지가 있습니다. 컴퓨터의 다양한 정보들을 확인할 수 있습니다.

 

baseboard get Manufacturer, Model, Name, PartNumber, slotlayout, serialnumber, poweredon
bios get name, version, serialnumber
bootconfig get BootDirectory, Caption, TempDirectory, Lastdrive
cdrom get Name, Drive, Volumename
computersystem get Name, domain, Manufacturer, Model, NumberofProcessors, PrimaryOwnerName,Username, Roles, totalphysicalmemory /format:list
cpu get Name, Caption, MaxClockSpeed, DeviceID, status
datafile where name=’c:\boot.ini’ get Archive, FileSize, FileType, InstallDate, Readable, Writeable, System, Version
dcomapp get Name, AppID /format:list
desktop get Name, ScreenSaverExecutable, ScreenSaverActive, Wallpaper /format:list
desktopmonitor get screenheight, screenwidth
diskdrive get Name, Manufacturer, Model, InterfaceType, MediaLoaded, MediaType
diskquota get User, Warninglimit, DiskSpaceUsed, QuotaVolume
environment get Description, VariableValue
fsdir where name=’c:\windows’ get Archive, CreationDate, LastModified, Readable, Writeable, System, Hidden, Status
group get Caption, InstallDate, LocalAccount, Domain, SID, Status
idecontroller get Name, Manufacturer, DeviceID, Status
irq get Name, Status
job get Name, Owner, DaysOfMonth, DaysOfWeek, ElapsedTime, JobStatus, StartTime, Status
loadorder get Name, DriverEnabled, GroupOrder, Status
logicaldisk get Name, Compressed, Description, DriveType, FileSystem, FreeSpace, SupportsDiskQuotas, VolumeDirty, VolumeName
memcache get Name, BlockSize, Purpose, MaxCacheSize, Status
memlogical get AvailableVirtualMemory, TotalPageFileSpace, TotalPhysicalMemory, TotalVirtualMemory
memphysical get Manufacturer, Model, SerialNumber, MaxCapacity, MemoryDevices
netclient get Caption, Name, Manufacturer, Status
netlogin get Name, Fullname, ScriptPath, Profile, UserID, NumberOfLogons, PasswordAge, LogonServer, HomeDirectory, PrimaryGroupID
netprotocol get Caption, Description, GuaranteesSequencing, SupportsBroadcasting, SupportsEncryption, Status
netuse get Caption, DisplayType, LocalName, Name, ProviderName, Status
nic get AdapterType, AutoSense, Name, Installed, MACAddress, PNPDeviceID,PowerManagementSupported, Speed, StatusInfo
nicconfig get MACAddress, DefaultIPGateway, IPAddress, IPSubnet, DNSHostName, DNSDomain
nicconfig get MACAddress, IPAddress, DHCPEnabled, DHCPLeaseExpires, DHCPLeaseObtained, DHCPServer
nicconfig get MACAddress, IPAddress, DNSHostName, DNSDomain, DNSDomainSuffixSearchOrder, DNSEnabledForWINSResolution, DNSServerSearchOrder
nicconfig get MACAddress, IPAddress, WINSPrimaryServer, WINSSecondaryServer, WINSEnableLMHostsLookup, WINSHostLookupFile
ntdomain get Caption, ClientSiteName, DomainControllerAddress, DomainControllerName, Roles, Status
ntevent where (LogFile=’system’ and SourceName=’W32Time’) get Message, TimeGenerated
ntevent where (LogFile=’system’ and SourceName=’W32Time’ and Message like ‘%timesource%’) get Message, TimeGenerated
ntevent where (LogFile=’system’ and SourceName=’W32Time’ and EventCode!=’29’) get TimeGenerated, EventCode, Message
onboarddevice get Description, DeviceType, Enabled, Status
os get Version, Caption, CountryCode, CSName, Description, InstallDate, SerialNumber, ServicePackMajorVersion, WindowsDirectory /format:list
os get CurrentTimeZone, FreePhysicalMemory, FreeVirtualMemory, LastBootUpTime, NumberofProcesses, NumberofUsers, Organization, RegisteredUser, Status
pagefile get Caption, CurrentUsage, Status, TempPageFile
pagefileset get Name, InitialSize, MaximumSize
partition get Caption, Size, PrimaryPartition, Status, Type
printer get DeviceID, DriverName, Hidden, Name, PortName, PowerManagementSupported, PrintJobDataType, VerticalResolution, Horizontalresolution
printjob get Description, Document, ElapsedTime, HostPrintQueue, JobID, JobStatus, Name, Notify, Owner, TimeSubmitted, TotalPages
process get Caption, CommandLine, Handle, HandleCount, PageFaults, PageFileUsage, PArentProcessId, ProcessId, ThreadCount
product get Description, InstallDate, Name, Vendor, Version
qfe get description, FixComments, HotFixID, InstalledBy, InstalledOn, ServicePackInEffect
quotasetting get Caption, DefaultLimit, Description, DefaultWarningLimit, SettingID, State
recoveros get AutoReboot, DebugFilePath, WriteDebugInfo, WriteToSystemLog
Registry get CurrentSize, MaximumSize, ProposedSize, Status
scsicontroller get Caption, DeviceID, Manufacturer, PNPDeviceID
server get ErrorsAccessPermissions, ErrorsGrantedAccess, ErrorsLogon, ErrorsSystem, FilesOpen, FileDirectorySearches
service get Name, Caption, State, ServiceType, StartMode, pathname
share get name, path, status
sounddev get Caption, DeviceID, PNPDeviceID, Manufacturer, status
startup get Caption, Location, Command
sysaccount get Caption, Domain, Name, SID, SIDType, Status
sysdriver get Caption, Name, PathName, ServiceType, State, Status
systemenclosure get Caption, Height, Depth, Manufacturer, Model, SMBIOSAssetTag, AudibleAlarm, SecurityStatus, SecurityBreach, PoweredOn, NumberOfPowerCords
systemslot get Number, SlotDesignation, Status, SupportsHotPlug, Version, CurrentUsage, ConnectorPinout
tapedrive get Name, Capabilities, Compression, Description, MediaType, NeedsCleaning, Status, StatusInfo
timezone get Caption, Bias, DaylightBias, DaylightName, StandardName
useraccount get AccountType, Description, Domain, Disabled, LocalAccount, Lockout, PasswordChangeable, PasswordExpires, PasswordRequired, SID



 WMIC로 할 수 있는 그 외 기능들

클래스네임에 대해서는 get뿐만이 아니라 다른 명령어들도 수행할 수 있는데요,

아래 형식대로 맞추면 get 대신에 다른 명령어를 써서 여러 기능들도 수행할 수 있습니다.

wmic [클래스네임] [명령어]

명령어에 들어갈 수 있는 항목들과 샘플 명령어는 아래와 같습니다.

 

 명령어  샘플명령어  설명
 Assoc  os assoc  OS와 설치된 패치, hotfix들에 연관된 정보를 보여줌
 Create  environment create name="progloc", username="wkst01\ ethanw",variablevalue= "%programfiles%\prog01"  Progloc이라는 환경변수를 추가하고, 해당 값을 프로그램 파일 폴더 아래의 폴더로 설정합니다. 예를 들어, 샘플은 WKST01 작업 그룹 컴퓨터의 Ethanw 사용자 계정에 이 변수를 추가합니다.
 Delete  environment where(name= "progloc") delete  환경변수를 삭제합니다. 샘플 커맨드는 Progloc 변수를 삭제합니다
 Set  path WIN32_USERACCOUNT where(name="user01") set disabled="true"  변수 값을 세팅합니다. 샘플 커맨드는 User01계정을 비활성화합니다.
 

 


 주의사항

Microsoft에 따르면, Windows 10에서는 WMIC가 deprecate 되었습니다.

그렇다고해서 WMIC를 못 쓰는 것은 아니고, 더 이상의 추가적인 기능개선이 없다고 합니다. 

대신 유사한 동작을 수행하는 파워쉘 cmdlets를 사용할 것을 권장합니다.

PowerShell에서 WMIC와 동일하게 사용할 수 있는 명령어는 get-wmiobject, invoke-wmimethod, Get-wmiobject, gwmi가 있습니다.

 

 총평

어쩌다가 알게된 툴인데, 딱히 크게 활용도가 클것이라는 느낌은 못 받았습니다.

디바이스 정보는 장치관리자통해서 확인할 수 있고, 

프로세스 정보는 작업관리자 창에서 확인할수 있고 하는 여러 대안에 익숙해져서 그런거 같기도 합니다.

만일 커맨드환경으로 제어가 필요한 환경에서는 유용하게 쓰일 수도 있을거 같습니다.

윈도용 클라우드 제어라던지 하는 등에서도 활용하는데 유용하지 않을까 싶은데,

 클라우드는 보통 unix계열을 쓰니 또 활용도가 떨어지는건 아닌가 싶기도 합니다.

단순한 정보제공 위주로 썼지만, 조사하면서 다른 기능도 있는 것으로 확인하였습니다.

다른 기능에 대해서는 기회가 된다면 사용해보고 글을 써보려고합니다.

 

WMIC 사용법, Windows Management Instrumentation Command, 윈도 정보확인하기

 

#wmic,#windows,#microsoft,#management,#instrumentation,#command,#윈도,#윈도우,#wmi,#마소,#마이크로,#소프트,#마이크로소프트

https://devscb.com/post/138

 

How to use WMIC, Windows Management Instrumentation Command, checking Windows information

How to use WMIC, Windows Management Instrumentation Command, checking Windows information What is wmic?WMIC stands for Windows Management Instrumentation Command, and is a command line tool for WMI.W

devscb.com

 

728x90
반응형

댓글