Sprache: VB
Ermittelt den Ländercode eines Rechners
Private Function GetCountryCode(ByVal Computer As String) As String
Dim objWMIService As Object
Dim objItems As Object
Dim objItem As Object
GetCountryCode = ""
objWMIService = GetObject("winmgmts:\" & Computer & "rootCIMV2")
objItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In objItems
GetCountryCode = objItem.CountryCode
Next
objWMIService = Nothing
objItems = Nothing
objItem = Nothing
End Function
Private Function GetCountryCode(ByVal Computer As String) As String
Dim objWMIService As Object
Dim objItems As Object
Dim objItem As Object
GetCountryCode = ""
objWMIService = GetObject("winmgmts:\" & Computer & "rootCIMV2")
objItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For Each objItem In objItems
GetCountryCode = objItem.CountryCode
Next
objWMIService = Nothing
objItems = Nothing
objItem = Nothing
End Function
Alte URL:
/snippet/ermitteln-des-laendercodes-per-wmi/1534