Bilbo_Baggins_Esq
Registered User.
- Local time
- Today, 14:31
- Joined
- Jul 5, 2007
- Messages
- 586
I need to get a list of all the Win32_OperatingSystem properties and their values on various different platforms.
I’ve done some reading and testing and afraid I’ve hit a brick wall.
Running Office 2010 (x86) on Win7 (x64)
I’m able to get the Key Property value for the instance, but then throw an automation error when I try to set an object using that Key Property.
Here is the code:
It seems like it might be a syntax problem but I’ve tried several different combinations and no luck.
I’ve referenced this site for the “GetOperatingSystemInfo”:
http://accesstips.wordpress.com/200...formation-using-microsoft-access-vba-and-wmi/
Any help will be GREATLY appreciated
I’ve done some reading and testing and afraid I’ve hit a brick wall.
Running Office 2010 (x86) on Win7 (x64)
I’m able to get the Key Property value for the instance, but then throw an automation error when I try to set an object using that Key Property.
Here is the code:
Code:
Sub GetSystemInfoTest()
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Dim strComputer As String
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.InstancesOf("Win32_OperatingSystem")
For Each objItem In colItems
MsgBox objItem.name
GetOperatingSystemInfo objItem.name
Next
Set objWMIService = Nothing
Set colItems = Nothing
End Sub
Sub GetOperatingSystemInfo(strKeyValue As String)
Dim objWMIService As Object
Dim colItems As Object
Dim objItem As Object
Dim strWMINamespace As String
Dim strComputer As String
Dim strWMIQuery As String
strComputer = "."
strWMINamespace = "\root\CIMV2"
strWMIQuery = ":Win32_OperatingSystem.Name='" & strKeyValue & "'"
[COLOR="Red"][B]Set objWMIService = GetObject("winmgmts:\\" & strComputer & strWMINamespace & strWMIQuery)[/B][/COLOR]
For Each objItem In objWMIService.Properties_
Debug.Print objItem.name & ": " & objItem.Value
Next
Set objItem = Nothing
Set colItems = Nothing
Set objWMIService = Nothing
End Sub
I’ve referenced this site for the “GetOperatingSystemInfo”:
http://accesstips.wordpress.com/200...formation-using-microsoft-access-vba-and-wmi/
Any help will be GREATLY appreciated