That's ok... but again, i'm wondering why the WMIQuery UDF accesses my Floppy Drive while the piece of code WITHOUT WMIQuery() does not...
I've tried it with this one as well
Code:
$colItems = $WMI.ExecQuery("Select FreeSpace from Win32_LogicalDisk WHERE DriveType = 3",,48)
For Each $objItem in $colItems
?"Free Space: " + $objItem.Freespace
?"-----------"
Next
and i even checked the SQL-Statement generated by the WMIQuery
(it generated "Select FreeSpace From Win32_LogicalDisk Where DriveType = '3'" as well) but still there are different outputs.
furthermore i tried to extract the WMIQuery-Part for external Computers like shown below, but it didn't work at all
Code:
$objLocator = CreateObject('WbemScripting.SWbemLocator')
If @ERROR or not $objLocator Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
$SystemSet = $objLocator.ConnectServer($sComputer, $root, $sUserID, $sUserPW)
If @ERROR or not $SystemSet Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
$SystemSet.Security_.ImpersonationLevel = 3
$objEnum = $SystemSet.ExecQuery($sQuery)
FOR EACH $objInstance in $objEnum
$=EXECUTE(CHR(36) + 'sValue = ' + CHR(36) + 'objInstance.' + $sWhat)
IF VARTYPE($sValue) & 8192
$tmp = $tmp +'|' + join($sValue,'|')
ELSE
$tmp = $tmp +'|' + $sValue
ENDIF
Next
? SPLIT(SUBSTR($tmp,2),'|')
Edit: Do i need more then the Variables $sQuery, $sComputer, $root, $sUserID, $sUserPW there?