Jump to content

[SOLVED] WMI Object low speed


Recommended Posts

Hi AutoIt Programmers! :)

I've seen a code that gives Name of Group by writing it's group's SID, but this one response very slower than Windows Command-Line WMIC :(
 

Func _GetLocalGroupName($sSID = 'S-1-5-18')
    $objWMIService = ObjGet ("winmgmts:\\" & @ComputerName & "\root\cimv2")
    $colItems = $objWMIService.ExecQuery('SELECT Name FROM Win32_Group where SID="' & $sSID & '"')
    For $GroupNames in $colItems
        MsgBox (0,"",$GroupNames.Name)
        ExitLoop
    Next
EndFunc

I don't want call and use any third-party programs even CMD, i just want use from Windows API, netapi32.dll or AutoIt Functions (Standalone).
Do you have any idea to improve speed/performance of this code? I'll happy of your comments :)

 

 

 

====================== SOLOUTION by @Subz ======================

 

Edited by Colduction
Link to comment
Share on other sites

  • Colduction changed the title to WMI Object low speed
1 hour ago, argumentum said:

Thanks @argumentum, that code is very speedy. i measured and compared that with _GetLocalGroupName()  by calling 500 times and results was amazing!:

#Fastest Function: "netGetJoinInfo"

1) "_GetLocalGroupName" time elapsed: (8836.4114) ms
2) "netGetJoinInfo" time elapsed: (601.2863) ms

But it's not what i want, it's just similar, anyway thanks for your comment :)

Edited by Colduction
Link to comment
Share on other sites

  • Colduction changed the title to [SOLVED] WMI Object low speed

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...