Hallo zusammen,
ich möchte in einem Listview Subitem Anhand von "Win32_OperatingSystem" den aktuellen User eintragen lassen.
Hier bekomme ich folgende Meldung:
==> The requested action with this object has failed.:
$string = String($wmiObj.UserName)
$selection_mark = _GUICtrlListView_GetSelectionMark($listview)
$str_computer = _GUICtrlListView_GetItemText($listview,$selection_mark)
Ping($str_computer,250)
If Not @error Then
_GUICtrlListView_SetItem($listview, "Online", $selection_mark,3)
Local $wmiColl
$wmiroot = ObjGet("winmgmts:\\"& $str_computer &"\root\CIMV2")
$wmiColl = $wmiRoot.ExecQuery("SELECT * FROM Win32_OperatingSystem")
For $wmiObj In $wmiColl
$string = String($wmiObj.UserName)
_GUICtrlListView_SetItem($listview, $string, $selection_mark,2)
Next
$wmiColl = 0
Gleicher Code nur Zeile 10 abgeändert und das funktioniert.
[autoit]$string = StringTrimLeft(string($wmiObj.Caption),9)
[/autoit]Wieso funktioniert das mit UserName nicht?
Hat einer ne Idee?
Danke und Gruß
Norman