Jump to content

Search the Community

Showing results for tags 'execquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 4 results

  1. Hy All, again I got a question. I try to convert wmic PATH Win32_videocontroller GET adapterram i tried to to it like in this example but my knoledge is not good enough Local $oWMI = ObjGet("winmgmts:root\CIMV2") Local $oDisks = $oWMI.ExecQuery("select * from WIN32_DiskDrive") So i tired Local $oWMI = ObjGet("winmgmts:root\CIMV2") Local $oGMRam= $oWMI.ExecQuery("Win32_videocontroller") $Memory=$oGMRam.adapterram but this does not work. I like to understand what i need to do?
  2. Never experienced anything like this before, so to you I come for help... I'm in the process of rewriting my fork of JSThePatriot's excellent Computer Information library, and my current project is rewriting the User profiling function. One of the new features I've added in is gathering the list of groups a particular user profile belongs to, which uses an existing WMI object to run an "ASSOCIATORS OF" query targeting the specified domain and username. When I run the function under my own user account from within ISN/ScITE or compile it and run it via Windows Explorer, my test script collects the information in a fraction of a second. When I compile the script and Right Click -> "Run As Administrator," the script takes almost three and a half minutes to complete. It's literally the exact same code, but running under Administrator has a computed 6320x slowdown. Examining the script running in Process Monitor showed no activity during what I assume are these queries, which boggles my mind. If someone could tell me what I'm doing wrong, that'd be super awesome. Below is the code used, and below that is a log file that I generated to root out what in particular was causing the massive slowdown. It's worth mentioning that I'm currently running Windows 8.1 on this machine, under a user account that is part of both the Administrators and Users groups. ; From CompInfoObject.au3 ; ========================= #include <File.au3> #include <Array.au3> #include <Security.au3> #region Global Variables and Constants If Not(IsDeclared("$cI_CompName")) Then Global $cI_CompName = @ComputerName EndIf Global Const $cI_VersionInfo = "00.03.08" Global Const $cI_aName = 0, _ $cI_aDesc = 4 Global $wbemFlagReturnImmediately = 0x10, _ ;DO NOT CHANGE $wbemFlagForwardOnly = 0x20 ;DO NOT CHANGE Global $ERR_NO_INFO = "Array contains no information", _ $ERR_NOT_OBJ = "$colItems isnt an object" Global Const $VERSION_CIO = "2.1.0.0" #endregion Global Variables and Constants ; Test script ; ========================== Global Const $logPath = "D:\logFile.txt" If IsAdmin() Then FileWriteLine($logPath, "============= RUNNING AS ADMINISTRATOR ============") Else FileWriteLine($logPath, "================= RUNNING AS USER =================") EndIf FileWriteLine($logPath, "") FileWriteLine($logPath, "Starting user profiling...") FileWriteLine($logPath, "") Local $runtime = TimerInit() Local $test = _ComputerGetUsers() FileWriteLine($logPath, "User profiling complete after " & (TimerDiff($runtime) / 1000) & " seconds") FileWriteLine($logPath, "") MsgBox(0, "", "complete", 10) ; From CompInfoObject.au3 Func _ComputerGetUsers() Local $localSIDs[1] Local $i = 0, $x = 1, $sid While 1 $sid = RegEnumKey("HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList", $x) If @error Then ExitLoop If StringInStr($sid, "S-1-5-21-") Then If IsArray(_Security__LookupAccountSid($sid)) Then ReDim $localSIDs[$i + 1] $localSIDs[$i] = $sid $i += 1 EndIf EndIf $x += 1 Wend $i = 0 _ArraySort($localSIDs) Local $colItems, $objWMIService, $objItem, $wqlQuery Local $groups, $userProfile, $userProfileLoaded, $regMountPoint, $runtime Local $users[1] = [ObjCreate("Scripting.Dictionary")] $wqlQuery = "SELECT * FROM Win32_UserAccount" $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2") $colItems = $objWMIService.ExecQuery($wqlQuery, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems ; Restrict users to actual users on the computer If _ArrayBinarySearch($localSIDs, $objItem.SID) <> -1 Then FileWriteLine($logPath, "Collecting basic information for " & $objItem.Name & "...") $runtime = TimerInit() $regMountPoint = Null $userProfileLoaded = False ReDim $users[$i + 1] $users[$i] = ObjCreate("Scripting.Dictionary") $users[$i].Add("Name", StringStripWS($objItem.Name, 3)) $users[$i].Add("Domain", StringStripWS($objItem.Domain, 3)) $users[$i].Add("Status", StringStripWS($objItem.Status, 3)) $users[$i].Add("FullName", StringStripWS($objItem.FullName, 3)) $users[$i].Add("Description", StringStripWS($objItem.Description, 3)) $users[$i].Add("SID", StringStripWS($objItem.SID, 3)) $users[$i].Add("Disabled", $objItem.Disabled) $users[$i].Add("Lockout", $objItem.Lockout) $users[$i].Add("PasswordChangeable", $objItem.PasswordChangeable) $users[$i].Add("PasswordExpires", $objItem.PasswordExpires) $users[$i].Add("PasswordRequired", $objItem.PasswordRequired) FileWriteLine($logPath, "Finished collecting basic information for " & $users[$i].Item("Name") & " in " & (TimerDiff($runtime) / 1000) & " seconds") FileWriteLine($logPath, "") ; Get user group membership FileWriteLine($logPath, "Collecting group information for " & $users[$i].Item("Name") & "...") $runtime = TimerInit() $groups = $objWMIService.ExecQuery("ASSOCIATORS OF {Win32_UserAccount.Domain='" & $objItem.Domain & "',Name='" & $objItem.Name & "'} WHERE ResultClass=Win32_Group", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($groups) Then Local $temp[1] $x = 0 For $group in $groups ReDim $temp[$x + 1] $temp[$x] = ObjCreate("Scripting.Dictionary") $temp[$x].Add("Name", $group.Name) $temp[$x].Add("Domain", $group.Domain) $temp[$x].Add("SID", $group.SID) $x += 1 Next $users[$i].Add("Groups", $temp) EndIf FileWriteLine($logPath, "Finished collecting group information for " & $users[$i].Item("Name") & " in " & (TimerDiff($runtime) / 1000) & " seconds") FileWriteLine($logPath, "") #cs ; First, we need to mount the registry before anything else, or get the registry path if it already is $userProfile = $objWMIService.ExecQuery("SELECT * FROM Win32_UserProfile WHERE SID=""" & $users[$i].Item("SID") & """", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($userProfile) Then For $profile in $userProfile $users[$i].Add("ProfilePath", StringStripWS($profile.LocalPath, 3)) If $profile.Loaded Then $userProfileLoaded = True $regMountPoint = "HKEY_USERS\" & $users[$i].Item("SID") & "\" EndIf ExitLoop Next ; Profile isn't loaded. Load it manually. If $regMountPoint == Null Then If RunWait("reg load HKU\TEMP-&" & $users[$i].Item("SID") & " " & $users[$i].Item("ProfilePath") & "\NTUSER.dat") == 0 Then MsgBox(0, "", "Loaded registry hive for " & $users[$i].Item("Name") & @CRLF, 3) $regMountPoint = "HKEY_USERS\TEMP-" & $users[$i].Item("SID") & "\" Else MsgBox(0, "", "Failed to load registry hive for " & $users[$i].Item("Name") & @CRLF, 3) EndIf EndIf EndIf ; Get user's mapped file shares ; HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\ ; Run regex "\#\#(.+?)\#(.+?)" to get path, then read key _LabelFromReg for any custom drive label applied ; Get user's mapped printers ; https://support.microsoft.com/en-us/kb/102966 ; Unload profile if it wasn't previously loaded If Not $userProfileLoaded And $regMountPoint <> Null Then If RunWait("reg unload " & StringRegExp($regMountPoint, "^(.*)\\$", 1)[0]) Then MsgBox(0, "", "Unloaded registry hive at " & $regMountPoint & @CRLF, 3) Else MsgBox(0, "", "Error: Could not unload registry hive at " & $regMountPoint & @CRLF, 3) EndIf EndIf #ce $i += 1 EndIf Next If $users[Ubound($users) - 1].Count < 1 Then ReDim $users[Ubound($users) - 1] EndIf If Ubound($users) < 1 Then Return SetError(1, 1, 0) EndIf Else Return SetError(1, 2, 0) EndIf Return $users EndFuncAnd here's the log file: ================= RUNNING AS USER ================= Starting user profiling... Collecting basic information for Administrator... Finished collecting basic information for Administrator in 0.000332286438607835 seconds Collecting group information for Administrator... Finished collecting group information for Administrator in 0.0347993066888362 seconds Collecting basic information for <redacted>... Finished collecting basic information for <redacted> in 0.00030855169299299 seconds Collecting group information for <redacted>... Finished collecting group information for <redacted> in 0.0321612217877267 seconds User profiling complete after 0.1464664737096 seconds ============= RUNNING AS ADMINISTRATOR ============ Starting user profiling... Collecting basic information for Administrator... Finished collecting basic information for Administrator in 0.000270383656125874 seconds Collecting group information for Administrator... Finished collecting group information for Administrator in 27.3050492143158 seconds Collecting basic information for <redacted>... Finished collecting basic information for <redacted> in 0.000575407211257197 seconds Collecting group information for <redacted>... Finished collecting group information for <redacted> in 203.270754752081 seconds User profiling complete after 230.621668475639 seconds
  3. Hi folks, I am working with win32_printerconfiguration for checking the duplex option is installed or not in the printers. $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $Error_WMI = @error If IsObj($objWMIService) Then $colItemsa = $objWMIService.ExecQuery ("Select * from Win32_PrinterConfiguration ", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItemsa) Then For $objPrinters In $colItemsa msgbox(0,"check","entering loop") $NameP = $objPrinters.Name If $NameP = $cfgLocPrinterName[$p - 1] Then $DuplexValue = $objPrinters.Duplex EndIf Next EndIf Else LogCreation("DuplexInstalledCheck", "WMI object", "Error in reading WMI object") EndIf script is existing from the for loop. it is not even printing the msg box titled check. any one please help
  4. Hi, Im trying to pull out some network adapter settings, this is my script: $colAdapters = $objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") For $objAdapter in $colAdapters If Not ($objAdapter.IPAddress) = " " Then ConsoleWrite (" ID: " & $objAdapter.NetConnectionid& @CR) ConsoleWrite (" Physical (MAC) address: " & $objAdapter.MACAddress& @CR) ConsoleWrite (" IP Address : " & $objAdapter.IPAddress(0)& @CR) ConsoleWrite (" IP Subnet : " & $objAdapter.IPSubnet(0)& @CR) ConsoleWrite (" IP Default Gateway : " & $objAdapter.DefaultIPGateway(0)& @CR) ConsoleWrite (" IP DNS1 : " & $objAdapter.DNSServerSearchOrder(0)& @CR) ConsoleWrite (" IP DNS2 : " & $objAdapter.DNSServerSearchOrder(1)& @CR) EndIf Next EndFunc The only one not working is 'NetConnectionid' which should bring back the name of the adapter is it appears in network and sharing centre, in my case this is 'Local Area Connect' but it is not returning anything. Anyone got any ideas?
×
×
  • Create New...