Jump to content

Recommended Posts

Posted (edited)

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
  • Colduction changed the title to WMI Object low speed
Posted (edited)
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
  • Colduction changed the title to [SOLVED] WMI Object low speed
Posted

Thanks to @Subz about his old comment on my blocked account :)

I measured his codes by calling 2000 times, it's faster than netapi32.dll and WMI objects:
 

#Fastest Function: "_GetAccountName"

1) "_GetAccountName" time elapsed: (359.1129) ms ; @Subz codes
2) "netGetJoinInfo" time elapsed: (2304.4145) ms

 

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
×
×
  • Create New...