strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel = impersonate}!\" & strComputer & "
ootcimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo "Caption: " & objOperatingSystem.Caption
Wscript.Echo "Debug: " & objOperatingSystem.Debug
Wscript.Echo "Version: " & objOperatingSystem.Version
Next
VBS 한 번도 써본 적이 없는데 음 이렇게 쓰는거였나;
WMI를 이용해서 Win32_OperatingSystem 클래스를 써먹는 예제다.
Windows Internals에서 발췌함.
C:>cscript osversion.vbs
Microsoft (R) Windows Script Host 버전 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Caption: Microsoft Windows XP Professional
Debug: False
Version: 5.1.2600




덧글