Sign in to follow this  
Followers 0
DicatoroftheUSA

Computer InfoGatherer

14 posts in this topic

#1 ·  Posted (edited)

This has probably been done before, but I have found this little script handy.

It scans and attempts to collect data from your network, and puts it into a database for future reference.

It makes use of PSEXEC and sqlite.

It is most usefull for small to medium sized networks without an enterprise solution for gathering computer info, and are too paranoid (like me) to use "free" or adware versions of similar tools.

To use it:

Make sure that the #region -environment in _main() matches something that will work with your environment.

Run the program, choose "scan"

Then you can querry, it uses sqlite syntax. The default table is "records"

After querying you can run the results against psexec or mstsc, or export to a CSV file.

Have fun, and I appreciate constructive critisism.

And I apologize as this really is a frankenstien script and I am bad at keeping sources.

Some example queries:

select * from records where lastloggeduser like "%jdoe%"

select name from records where PhysicalMemory > "2048"

#edit, I commented out "fileinstall()" function to make it less confusing, for others to use this I recommend uncommenting it and adjusting it according to your environment.

05/17/12

Simplified script, hopefully fix some bugs.

06/26/12

Fixed some bugs

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=Lookup.exe
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <GuiListView.au3>
#include <Inet.au3>
#include <ListBoxConstants.au3>
#include <ListViewConstants.au3>
#include <Misc.au3>
#include <SQLite.au3>
;~ #include <SQLite.dll.au3>
#include <StaticConstants.au3>
#include <String.au3>
#include <WindowsConstants.au3>


#region -notes
;Please check environments region in main before use
#endregion -notes

If _Singleton("test", 1) = 0 Then
Exit
EndIf

#region -global declarations
Global $ghDB ;handle for database
Global $gsNull ; a string of nulls
Global $gsFields ; Field Labels
#endregion -global declarations

#region options
AutoItSetOption("trayicondebug", True)
OnAutoItExitRegister("_Exit") ;handle exit to vacuume database
#endregion options

_main()



Func _2add($sComputer, $sScandate, $sScanTime, $sName, $sInsert) ;updates a cell
_sqlfieldupdate($sName)
_SQinsert($sName, $sInsert, $sComputer, $sScandate, $sScanTime)
EndFunc ;==>_2add

Func _assume($sComputer, $sScandate, $sScanTime) ; sets basic data in case more usefull information fails to be gathered
Local $sName
$sName = _TCPIpToName($sComputer) ; checks your network for a name
If @error Then SetError(@error)
If Not $sName = "" Then ;"" is a failure of name resolution
_2add($sComputer, $sScandate, $sScanTime, 'name', $sName)
Else
_2add($sComputer, $sScandate, $sScanTime, 'name', 'Pinged- cannot resolve')
EndIf
_2add($sComputer, $sScandate, $sScanTime, 'NameRetrieval', "IpToName")
EndFunc ;==>_assume

Func _CallBack($aRow) ; debuging data for sqlite
For $s In $aRow
ConsoleWrite($s & @TAB)
Next
ConsoleWrite(@CRLF)
EndFunc ;==>_CallBack



Func _collect($sComputer, $oWMIService, $xCollectable, $sScandate, $sScanTime)

_2add($sComputer, $sScandate, $sScanTime, 'IP', TCPNameToIP($sComputer))
If Not $xCollectable Then ;check if details are available
_2add($sComputer, $sScandate, $sScanTime, 'NameRetrieval', 'NoPing')
Return
EndIf

#region -Collection ; connections to various parts of WMI
Local $oColEnclosure = $oWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
Local $oColSystem = $oWMIService.ExecQuery _
("Select * from Win32_computersystem")
Local $oColOperatingSystem = $oWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
Local $oColGroups = $oWMIService.ExecQuery _
('Select * from Win32_GroupUser')
Local $oColNetwork = $oWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapter where NetConnectionStatus=2")
Local $oColPrinter = $oWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")
Local $oColDisplay = $oWMIService.ExecQuery _
("SELECT * FROM Win32_DisplayConfiguration")
Local $oColDisplay = $oWMIService.ExecQuery _
("SELECT * FROM Win32_DisplayConfiguration")

#endregion -Collection ; connections to various parts of WMI


Local $objSMBIOS, $sAdmins, $sDate, $sMac, $sName, $sNetAdaptor, $sPrinter, $sCDate
For $objSMBIOS In $oColPrinter
If $objSMBIOS.DeviceID <> "" Then
$sPrinter &= $objSMBIOS.DeviceID & " - "
$sPrinter &= $objSMBIOS.DriverName & " - "
$sPrinter &= $objSMBIOS.PortName
$sPrinter &= "|"
EndIf
Next
_2add($sComputer, $sScandate, $sScanTime, 'Printers', $sPrinter)

For $objSMBIOS In $oColEnclosure
_2add($sComputer, $sScandate, $sScanTime, 'Serial', $objSMBIOS.SerialNumber)
Next
For $objSMBIOS In $oColSystem
$sName = $objSMBIOS.name
_2add($sComputer, $sScandate, $sScanTime, 'Name', $sName)
_2add($sComputer, $sScandate, $sScanTime, 'NameRetrieval', 'WMI')
_2add($sComputer, $sScandate, $sScanTime, "Lastloggeduser", $objSMBIOS.UserName)
_2add($sComputer, $sScandate, $sScanTime, "PhysicalMemory", Int($objSMBIOS.TotalPhysicalMemory / 1048576))
_2add($sComputer, $sScandate, $sScanTime, "make", $objSMBIOS.Manufacturer)
_2add($sComputer, $sScandate, $sScanTime, "model", $objSMBIOS.Model)
Next
For $objSMBIOS In $oColOperatingSystem
_2add($sComputer, $sScandate, $sScanTime, "Os", $objSMBIOS.Caption)
_2add($sComputer, $sScandate, $sScanTime, "OsBuildNumber", $objSMBIOS.BuildNumber)
_2add($sComputer, $sScandate, $sScanTime, "OsServicePack", $objSMBIOS.CSDversion)
$sDate = $objSMBIOS.InstallDate
$sCDate = (StringMid($sDate, 5, 2) & "/" & StringMid($sDate, 7, 2) & "/" & StringLeft($sDate, 4) & " " & StringMid($sDate, 9, 2) & ":" & StringMid($sDate, 11, 2) & ":" & StringMid($sDate, 13, 2))
_2add($sComputer, $sScandate, $sScanTime, "OsInstallDate", $sCDate)
_2add($sComputer, $sScandate, $sScanTime, "OsDescription", $objSMBIOS.Description)
Next
#region - add admin
Local $aString[1] ;string split for administrators
For $objSMBIOS In $oColGroups
If StringInStr($objSMBIOS.GroupComponent, 'Domain="' & $sName) And StringInStr($objSMBIOS.GroupComponent, 'Name="Administrators"') Then
$aString = StringSplit($objSMBIOS.PartComponent, '"') ; make admin users to be in form domainuser
$sAdmins &= $aString[2] & '' & $aString[4] & '|'
EndIf
Next
_2add($sComputer, $sScandate, $sScanTime, "Admins", $sAdmins)
#endregion - add admin
#region - add network
For $objSMBIOS In $oColNetwork
If $sMac <> "" Then $sMac &= " | "
If $sNetAdaptor <> "" Then $sNetAdaptor &= " | "
$sNetAdaptor &= $objSMBIOS.Description
$sMac &= $objSMBIOS.MACAddress
Next

_2add($sComputer, $sScandate, $sScanTime, "MacAddress", $sMac)
_2add($sComputer, $sScandate, $sScanTime, "NAdaptor", $sNetAdaptor)
#endregion - add network
EndFunc ;==>_collect

Func _consolehelp($sInput, $sDataBaseSwitch, $sQuietSwitch, $sSubnet, $sSubnetSwitch, $sDB) ; help for console command
If StringInStr($sInput, "/") Or StringInStr($sInput, "?") Then
ConsoleWrite(@LF & $sQuietSwitch & ' to set a quiet scan ' & @LF & _
@LF & $sSubnetSwitch & ' to set class c subnet in from of xxx.xxx.xxx, It is defaulted to "' & $sSubnet & '"' & @LF & _
@LF & $sDataBaseSwitch & ' to set database, database defaulted to "' & $sDB & '"' & @LF & _
@LF & "Syntax is lookup.exe [/q /s 'subnet' /d 'database'")
Exit
Else
Return
EndIf
EndFunc ;==>_consolehelp

Func _ConsoleSwitch($sSubnet, $sDB, $sSQL)
Local $xQuiet = False
Local $sQuietSwitch = '/q'
Local $sSubnetSwitch = '/s'
Local $sDataBaseSwitch = '/d'
For $iX = 1 To UBound($cmdline) - 1
Switch $cmdline[$iX]
Case $sQuietSwitch
$xQuiet = True
Case $sSubnetSwitch
MsgBox(0, $cmdline[$iX], $sSubnetSwitch)
$sSubnet = _NormaliseSubnet($cmdline[$iX + 1])
_consolehelp($cmdline[$iX + 1], $sDataBaseSwitch, $sQuietSwitch, $sSubnet, $sSubnetSwitch, $sDB)
$iX += 1
Case $sDataBaseSwitch
$ghDB = $cmdline[$iX + 1]
_consolehelp($cmdline[$iX + 1], $sDataBaseSwitch, $sQuietSwitch, $sSubnet, $sSubnetSwitch, $sDB)
$iX += 1
Case Else
_consolehelp($cmdline[$iX], $sDataBaseSwitch, $sQuietSwitch, $sSubnet, $sSubnetSwitch, $sDB)
EndSwitch
Next
If $xQuiet Then
_sqlstart($sSQL, $sDB)
_gather($sSubnet, False)
EndIf
Exit
EndFunc ;==>_ConsoleSwitch

Func _DelimArrayFromList($hList, $sInpNull, $sDelim, $x); turns an array into a string for explorting.
Local $sList
Local $aText = _GUICtrlListView_GetItemTextArray($hList, $x)
;~ _Arrayf($aText)
For $x = 1 To $aText[0]
If $aText[$x] <> "" Then
$sList &= $aText[$x] & $sDelim
Else
$sList &= $sInpNull & $sDelim
EndIf
Next
$sList &= @CRLF
Return $sList
EndFunc ;==>_DelimArrayFromList

Func _EA(ByRef $aEasyAccelerator, $sTitleString, $sLettersSkip = "") ; a function to make adding '&' for accelerated buttons easier
Local $sLetter
_ArraySort($aEasyAccelerator)

For $iX = 1 To StringLen($sTitleString)
$sLetter = StringMid($sTitleString, $iX, 1)
If $sLetter = " " Then ContinueLoop
If StringInStr($sLettersSkip, $sLetter) Then ContinueLoop
If _ArrayBinarySearch($aEasyAccelerator, $sLetter) = -1 Then
_ArrayAdd($aEasyAccelerator, $sLetter)
$sTitleString = _StringInsert($sTitleString, "&", $iX - 1)
Return ($sTitleString)
Else
ContinueLoop
EndIf
Next
Return ($sTitleString)
EndFunc ;==>_EA

Func _Exit()
_SQLite_Exec($ghDB, "vacuum")
_SQLite_Close($ghDB)
_SQLite_Shutdown()
EndFunc ;==>_Exit

Func _export($hGUIResult, $oChkHeader, $aHeader, $hResults, $oCMBDelim, $oInpNull, $iRows, $iExport) ; exports results list
Local $sDelim
Local $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}"


Switch GUICtrlRead($oCMBDelim)
Case "tab"
$sDelim = @TAB
Case "Space"
$sDelim = " "
Case "comma"
$sDelim = ","
Case "other"
$sDelim = InputBox("Deliminator", "Enter Deliminator", "|")
If @error Then Return (-1)
EndSwitch
Local $sList = ""
If GUICtrlRead($oChkHeader) = $GUI_CHECKED Then
$sList &= StringReplace($aHeader[0], Chr(127), $sDelim) & @LF
EndIf
Local $aResult = _GUICtrlListView_GetSelectedIndices($hResults, True); so that subsection of list can be selected
Local $sInpNull = GUICtrlRead($oInpNull)
If $aResult[0] = 0 Then

For $x = 0 To $iRows - 1
$sList &= _DelimArrayFromList($hResults, $sInpNull, $sDelim, $x)
Next
;
Else

For $x = 1 To $aResult[0]
$sList &= _DelimArrayFromList($hResults, $sInpNull, $sDelim, $aResult[$x])
Next

EndIf
Switch $iExport
Case 1
ClipPut($sList)
Case 2
Local $sFileSaveDir = FileSaveDialog("Save File Dialog", $MyDocsFolder, "Seperated (*)", 18)
Local $hFile = FileOpen($sFileSaveDir, 10)
FileWrite($hFile, $sList)
FileClose($hFile)
EndSwitch
Return
EndFunc ;==>_export

Func _FetchTableColumns(ByRef $sFields)
Local $aRow[1], $hQuery, $iFieldCount = 0

$sFields = ""
_SQLite_Query($ghDB, "PRAGMA table_info(records);", $hQuery) ; the query
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
$sFields &= $aRow[1] & ","
$iFieldCount += 1
WEnd
Return ($iFieldCount)
EndFunc ;==>_FetchTableColumns

Func _gather($sSubnet, $sShow = True, $iRangeInit = 2, $iRangeEnd = 254) ; cycles through IP for data
Local $lMSG, $iHost, $oLabel3, $oPrgorss, $oTime, $sComputer, $sTime, $oProgressGui, $iPercent
_SQLite_Exec($ghDB, 'begin;') ;inits a transaction to minimize thrashing
$oProgressGui = GUICreate("Progress", 220, 80, 150, 0, BitOR($GUI_SS_DEFAULT_GUI, $WS_EX_TOPMOST))
$oPrgorss = GUICtrlCreateProgress(10, 10, 200, 20, 0x01)
$oLabel3 = GUICtrlCreateLabel("Starting", 10, 40, 200)
If $sShow = True Then GUISetState(@SW_SHOW)
WinSetTrans($oProgressGui, "", 190)
For $iHost = $iRangeInit To $iRangeEnd
$sComputer = $sSubnet & $iHost
$sTime = TimerInit()
$lMSG = GUIGetMsg()
Switch $lMSG
Case $GUI_EVENT_CLOSE
GUIDelete($oProgressGui)
Return
EndSwitch
GUICtrlSetData($oPrgorss, $iPercent)
GUICtrlSetData($oLabel3, $iPercent & "% Done")
_scanit($sComputer, $sSubnet)
$iPercent = _ProgressPercentCalc($iHost - $iRangeInit + 1, $iRangeEnd - $iRangeInit + 1, TimerDiff($sTime))
Next
GUIDelete($oProgressGui)
_SQLite_Exec($ghDB, 'commit;') ;ends the transaction

EndFunc ;==>_gather
Func _getsubnet() ;gets subnet your computer is in.
Local $sIp
While 1
$sIp = @IPAddress1
If $sIp = "127.0.0.1" Or $sIp = "0.0.0.0" Then $sIp = @IPAddress2
If $sIp = "127.0.0.1" Or $sIp = "0.0.0.0" Then $sIp = @IPAddress3
If $sIp = "127.0.0.1" Or $sIp = "0.0.0.0" Then $sIp = @IPAddress4
$sSubnet = $sIp
If $sSubnet = "127.0.0.1" Or $sIp = "0.0.0.0" Then _SetSubnet($sSubnet)
$sSubnet = _NormaliseSubnet($sSubnet)
If @error Then ContinueLoop
ExitLoop
WEnd
Return $sSubnet
EndFunc ;==>_getsubnet

Func _GuiCtrlGetFocus($GuiRef) ; Dont remember
Local $hwnd = ControlGetHandle($GuiRef, "", ControlGetFocus($GuiRef))
Local $result = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
Return $result[0]
EndFunc ;==>_GuiCtrlGetFocus

Func _GuiPSExec($sList = "", $sDelim = "", $sPsexecDirectory = 'C:windows') ; this is a hacked version of a script by somebody else, will comment later.
Local $aEA[1]
Local $DomainList = _NetServerEnum(0x80000000)
Local $iCtrlsInit, $iCtrlsEnd
$DomainList = _ArrayToString($DomainList, '|', 1)
Local $sPSexecPath
If StringInStr($sPsexecDirectory, 'psexec.exe') Then
$sPSexecPath = $sPsexecDirectory
Else
$sPSexecPath = $sPsexecDirectory & 'psexec.exe'
EndIf
Local $oPsGUI = GUICreate("PSexec GUI", 573, 435, -1, -1)
GUICtrlCreateGroup("", 1, 1, 305, 70)
$oRadShell = GUICtrlCreateRadio(_EA($aEA, "Run sequential CMD shells"), 8, 8, 178, 17)
$oRadCommand = GUICtrlCreateRadio(_EA($aEA, "Command to run on remote PC", "Co"), 8, 24, 178, 17)
GUICtrlSetState($oRadCommand, $GUI_CHECKED)

Local $oInpAppCommand = GUICtrlCreateInput("", 16, 42, 195, 21)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Local $oButAppBrouse = GUICtrlCreateButton(_EA($aEA, "Browse"), 218, 42, 75, 23, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel(_EA($aEA, "User Name"), 8, 95, 124, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Local $oInpUserName = GUICtrlCreateInput("", 8, 112, 143, 21)
GUICtrlCreateLabel(_EA($aEA, "Password"), 155, 95, 124, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
Local $oInpPassword = GUICtrlCreateInput("", 155, 112, 143, 21, $ES_PASSWORD)
Local $oChkLimitedUser = GUICtrlCreateCheckbox(_EA($aEA, "Run process as limited user"), 16, 138, 225, 17)
Local $oChkNoLoadPofile = GUICtrlCreateCheckbox(_EA($aEA, "Does not load the specified account's profile"), 16, 154, 226, 17)
$iCtrlsInit = GUICtrlCreateDummy() + 1
GUICtrlCreateGroup("Parameters", 8, 178, 289, 225)
Local $oChkInteract = GUICtrlCreateCheckbox(_EA($aEA, "Interact with the users desktop"), 16, 194, 185, 17)
Local $oChkSystemAccount = GUICtrlCreateCheckbox(_EA($aEA, "Run application in the system account"), 16, 210, 225, 17)
Local $oChkCopyFile = GUICtrlCreateCheckbox(_EA($aEA, "Copy file to remote", "C"), 16, 226, 113, 17)
GUICtrlCreateGroup("Copy Options", 40, 245, 250, 54)
Local $oRadOverWrite = GUICtrlCreateRadio(_EA($aEA, "Overwrite existing file"), 48, 261, 121, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
Local $oRadOnlyNewer = GUICtrlCreateRadio(_EA($aEA, "Copy file only if it is a higher version or newer", "C"), 48, 278, 241, 17)
Local $oRadDontWait = GUICtrlCreateCheckbox(_EA($aEA, "Don't wait for the process to terminate"), 16, 300, 225, 17)
$iCtrlsEnd = GUICtrlCreateDummy() - 1
Local $oSLiderLbl = GUICtrlCreateLabel('Timeount Connecting To Remote 5 Secs.', 16, 318, 275, 21, $SS_CENTER)
Local $oSLider = GUICtrlCreateSlider(16, 335, 275, 21)
GUICtrlSetLimit(-1, 120, 1)
GUICtrlSetData(-1, 5)
Local $oInpWorkingDir = GUICtrlCreateInput("", 16, 378, 201, 21)
Local $oButBrowserWorkingDir = GUICtrlCreateButton(_EA($aEA, "Browse"), 220, 377, 75, 23, 0)
GUICtrlCreateLabel(_EA($aEA, "Working directory on remote PC"), 16, 360, 184, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTab(304, 8, 258, 74)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Local $oAddName = GUICtrlCreateTabItem("Enter Name")
GUICtrlCreateLabel(_EA($aEA, "Remote PC name (or add PC to the list)"), 312, 32, 188, 17)
Local $oInpPCname = GUICtrlCreateInput("", 312, 56, 137, 21)
Local $oButAdd = GUICtrlCreateButton(_EA($aEA, "Add"), 456, 54, 41, 25, 0)

Local $oTabLoadList = GUICtrlCreateTabItem("Load/Save PC List")
GUICtrlCreateLabel(_EA($aEA, "Load text file (one pc name per line)"), 312, 34, 172, 17)
Local $oInpLoadListPath = GUICtrlCreateInput("", 312, 56, 121, 21)
Local $oButBrowse = GUICtrlCreateButton(_EA($aEA, "Browse"), 435, 54, 41, 25, 0)
Local $oButLoadList = GUICtrlCreateButton(_EA($aEA, "Load"), 476, 54, 41, 25, 0)
Local $oButSaveList = GUICtrlCreateButton(_EA($aEA, "Save"), 517, 54, 41, 25, 0)

Local $oTabBrowseNet = GUICtrlCreateTabItem("Browse Net")
GUICtrlCreateLabel(_EA($aEA, "Select Domain", "CT"), 330, 38, 172, 17)
Local $oCMBNetList = GUICtrlCreateCombo("", 310, 56, 121, 21)
GUICtrlSetData($oCMBNetList, $DomainList)

GUICtrlCreateTabItem("")
Local $oListComps = GUICtrlCreateListView("", 310, 85, 200, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $WS_VSCROLL))
_GUICtrlListView_InsertColumn($oListComps, 0, "Machine name or IP", 200)
_GUICtrlListView_SetExtendedListViewStyle($oListComps, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
Local $oButRemoveFromList = GUICtrlCreateButton(_EA($aEA, "Remove from list"), 310, 287, 100, 25, 0)
Local $oButClearList = GUICtrlCreateButton(_EA($aEA, "Clear List"), 440, 287, 70, 25, 0)
Local $oProgress = GUICtrlCreateProgress(520, 85, 20, 200, 0x05)
GUICtrlSetColor(-1, 0xff0000)
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetData(-1, 0)
GUICtrlCreateLabel(_EA($aEA, "Thread priority:", "T"), 350, 325, 74, 17)
Local $oCmbThreadPriority = GUICtrlCreateCombo("", 428, 323, 90, 17)
GUICtrlSetData($oCmbThreadPriority, "Low|Below Normal|Normal|Above Normal|High|Real Time")
_GUICtrlComboBox_SetCurSel($oCmbThreadPriority, 2)

Local $oCMDtest = GUICtrlCreateButton(_EA($aEA, "Put Test>Clip", "T"), 375, 370, 70, 25, 0)

Local $oButExecute = GUICtrlCreateButton(_EA($aEA, "Execute"), 450, 370, 70, 25, 0)
Local $oButExit = GUICtrlCreateButton(_EA($aEA, "Exit", "x"), 310, 370, 41, 25, 0)

GUICtrlSetState(-1, $GUI_DROPACCEPTED)
While $sList <> ""
$iPos = StringInStr($sList, $sDelim)
$sName = StringLeft($sList, $iPos - 1)
$sList = StringTrimLeft($sList, $iPos)
If StringInStr($sName, "NoData") Or StringInStr($sName, "Cannot Resolve") Then ContinueLoop
_GUICtrlListView_AddItem($oListComps, $sName)
WEnd

GUISetState(@SW_SHOW)
If RegRead('HKCUSoftwareSysinternalsPsExec', 'EulaAccepted') = '' Then RegWrite('HKCUSoftwareSysinternalsPsExec', 'EulaAccepted', 'REG_DWORD', 1)
Local $sFileFullName, $sFolderName, $sPCname, $sPCnameLoad, $sPriority, $iCount, $sCMD, $iPID, $hProcessExitCode, $sExitCode, $sIp, $hFile, $iPercent
Local $xHide = @SW_SHOW
While 1

Switch GUIGetMsg()
Case $oRadCommand
For $x = $iCtrlsInit To $iCtrlsEnd
GUICtrlSetState($x, $gui_enable)
;~ GUICtrlSetState($x,$gui_show)
Next
Case $oRadShell
For $x = $iCtrlsInit To $iCtrlsEnd
GUICtrlSetState($x, $gui_disable)
;~ GUICtrlSetState($x,$gui_hide)
Next
Case $oButExit
Exit
Case $GUI_EVENT_CLOSE
GUIDelete($oPsGUI)
Return
Case $oSLider
$nMsg = 0
GUICtrlSetData($oSLiderLbl, 'Timeount Connecting To Remote ' & GUICtrlRead($oSLider) & ' Secs.')
Case $oButBrowse
$sFileFullName = FileOpenDialog("Browse", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "All Files (*.*)")
If @error Then ContinueLoop
If $nMsg = $oButAppBrouse Then
GUICtrlSetData($oInpAppCommand, $sFileFullName)
Else
GUICtrlSetData($oInpLoadListPath, $sFileFullName)
EndIf
Case $oButBrowserWorkingDir
$sFolderName = FileSelectFolder("Browse", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 2)
If @error Then ContinueLoop
GUICtrlSetData($oInpWorkingDir, $sFolderName)
Case $oCMBNetList
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($oListComps))
Local $aCompList = _NetServerEnum(0x1, _GUICtrlComboBox_GetEditText($oCMBNetList))
If IsArray($aCompList) Then
For $x = 1 To $aCompList[0]
_GUICtrlListView_AddItem($oListComps, $aCompList[$x])
Next
EndIf
Case $oButAdd
;check if remote computer was specified
$sPCname = GUICtrlRead($oInpPCname)
_GUICtrlListView_AddItem($oListComps, $sPCname)
GUICtrlSetData($oInpPCname, "")
GUICtrlSetState($oInpPCname, $GUI_FOCUS)
Case $oButClearList
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($oListComps))
Case $oButLoadList
;loads file for load pc list tab list2 box
$sPCnameLoad = GUICtrlRead($oInpLoadListPath)
If $sPCnameLoad <> "" Then _Load($sPCnameLoad, $oListComps)
GUICtrlSetData($oInpLoadListPath, "")
Case $oButSaveList
$sPCnameLoad = GUICtrlRead($oInpLoadListPath)
If $sPCnameLoad = "" Then ContinueLoop
$hFile = FileOpen($sPCnameLoad, 10)
If @error Then ContinueLoop
$iCount = _GUICtrlListView_GetItemCount($oListComps)
If $iCount = 0 Then MsgBox(0, '', 'Need to add a computer name or ip to the list.')
For $item = 0 To $iCount - 1
FileWriteLine($hFile, _GUICtrlListView_GetItemText(GUICtrlGetHandle($oListComps), $item))
;~ ConsoleWrite(_GUICtrlListView_GetItemText(GUICtrlGetHandle($oListComps), $item))
Next
FileClose($hFile)

Case $oButRemoveFromList
$nMsg = 0
GUICtrlSetBkColor($oProgress, 0x0000ff)
_GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($oListComps))
Case $oButExecute
GUICtrlSetData($oButExecute, "S&top!")
If ProcessExists("psexec.exe") Then ProcessClose("psexec.exe")
If ProcessExists("psexesvc.exe") Then ProcessClose("psexesvc.exe")
$iCount = _GUICtrlListView_GetItemCount($oListComps)
If $iCount = 0 Then MsgBox(0, '', 'Need to add a computer name or ip to the list.')
For $item = 0 To $iCount - 1
$sCMD = _PSRunString($sPSexecPath, $oCmbThreadPriority, _GUICtrlListView_GetItemText(GUICtrlGetHandle($oListComps), $item), $GUI_CHECKED, $oChkCopyFile, $oChkInteract, $oChkLimitedUser, $oChkNoLoadPofile, $oChkSystemAccount, $oRadDontWait, $oRadOnlyNewer, $oRadOverWrite, $oListComps, $sPriority, $oInpAppCommand, $oSLider, $oInpWorkingDir, $oInpUserName, $oInpPassword, GUICtrlRead($oRadShell) = $GUI_CHECKED)
If @error Then ExitLoop
$iPercent = Int($item / $iCount * 100)
GUICtrlSetData($oProgress, $iPercent)
If GUICtrlRead($oRadShell) = $GUI_CHECKED Then $xHide = @SW_SHOW
$iPID = RunWait($sCMD, @TempDir, $xHide)
While ProcessExists($iPID)
$nMsg = GUIGetMsg()
If $nMsg <> 0 Then ConsoleWrite(@LF & $nMsg)
If $nMsg = $oButExecute Then ExitLoop (2)
If $nMsg = -3 Then ExitLoop (3)
WEnd
;~
_ProcessCloseHandle($hProcessExitCode)
Next

GUICtrlSetData($oButExecute, "E&xecute")
GUICtrlSetBkColor($oProgress, 0x000000)
GUICtrlSetData($oProgress, 0)

Case $oCMDtest

If @error Then ContinueLoop
$sIp = @IPAddress1
If $sIp = '127.0.0.1' Then $sIp = @IPAddress2
$sCMD = _PSRunString($sPSexecPath, $oCmbThreadPriority, $sIp, $GUI_CHECKED, $oChkCopyFile, $oChkInteract, $oChkLimitedUser, $oChkNoLoadPofile, $oChkSystemAccount, $oRadDontWait, $oRadOnlyNewer, $oRadOverWrite, $oListComps, $sPriority, $oInpAppCommand, $oSLider, $oInpWorkingDir, $oInpUserName, $oInpPassword, GUICtrlRead($oRadShell) = $GUI_CHECKED)
ClipPut($sCMD)
Run(@ComSpec & " /k ")
WinWait(@ComSpec)
Send("!{space}ep")
EndSwitch
WEnd
GUIDelete($oPsGUI)
EndFunc ;==>_GuiPSExec

Func _GuiQuery($sPSEXEC)
Local $oDll = DllOpen('user32.dll') ;for _ispressed function
Local $obcol[1], $aCMDs[1][1], $obutTime[6]
Local $ip[1]
Local $sFields
_FetchTableColumns($gsFields)
Local $DTM_SETFORMAT_
Local $iHW = 80
Local $iVH = 20
Local $iVspace = 5
Local $ihSpace = 5
Local $iRinit = 15
Local $iCinit = 20
Local $iListWidth = 10 * $iHW
Local $iInputHeight = 2 * $iVH
Local $oGUIq = GUICreate('Options', 10 * ($iHW + $ihSpace), 15 * ($iVH + $ihSpace))
Local $iC = $iCinit
Local $iR = $iRinit
GUICtrlCreateLabel('&Input', $iC, $iR)
$iR += $iVH + $iVspace
Local $oInpSelect = GUICtrlCreateInput('select * from records where scandate>' & @YEAR & @MON & @MDAY & ' order by scandate limit 254;', $iC, $iR, $iListWidth, $iInputHeight)
$iR += $iInputHeight + $iVspace
#region action buttons
Local $obQuerry = GUICtrlCreateButton('&Querry', $iC, $iR, $iHW, $iVH)
$iC += $iHW + $ihSpace
Local $obClear = GUICtrlCreateButton('&Clear', $iC, $iR, $iHW, $iVH)
#endregion action buttons
#region - create history
$iC = $iCinit
$iR += $iVH + $iVspace
$iR += $iVH + $iVspace
GUICtrlCreateLabel("&Past Queries", $iC, $iR, $iHW, $iVH)
$iR += $iVH + $iVspace
Local $iListHeight = $iVH * 6
Local $oListPrevious = GUICtrlCreateList("", $iC, $iR, $iListWidth, $iListHeight, BitOR($LBS_DISABLENOSCROLL, $LBS_SORT, $WS_BORDER, $WS_HSCROLL, $WS_VSCROLL))
$iR += $iListHeight
Local $iRows, $iColumns
_SQLite_GetTable2d($ghDB, 'select * from cmds;', $aCMDs, $iRows, $iColumns)
_SQLite_Exec($ghDB, "begin;")
While UBound($aCMDs) - 1 > 40
$aCMDs[1][0] = StringReplace($aCMDs[1][0], '"', '""')
_SQLite_Exec($ghDB, 'delete from cmds where commands= "' & $aCMDs[1][0] & '";')
_ArrayDelete($aCMDs, 1)
WEnd
_SQLite_Exec($ghDB, "commit;")
For $iX = 1 To UBound($aCMDs) - 1
GUICtrlSetData($oListPrevious, $aCMDs[$iX][0])
Next
_GUICtrlListBox_SetHorizontalExtent($oListPrevious, 1000)
GUICtrlCreateLabel('querry is sqlite syntax, the table to use is "records" ie: select * from records ', $iC, 2 * $iR + 10)
#endregion - create history
#region - field helpers
$iR += $iVH + $iVspace
Local $iFieldRow = $iR
GUICtrlCreateLabel("&Fields", $iC, $iR, $iHW, $iVH)
$iC += $iHW + $ihSpace
Local $oComboColumns = GUICtrlCreateCombo("", $iC, $iR, $iHW, $iVH, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST))
$iC += $iHW + $ihSpace
Local $oReCombo1 = GUICtrlCreateButton("Set", $iC, $iR)
$iC = $iCinit
$iR += $iVH + $iVspace
GUICtrlCreateLabel("C&ompare", $iC, $iR, $iHW, $iVH)
$iC += $iHW + $ihSpace
Local $oComboCommands = GUICtrlCreateCombo("", $iC, $iR, $iHW, $iVH, BitOR($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST))
$iC += $iHW + $ihSpace
Local $oReCombo2 = GUICtrlCreateButton("Set", $iC, $iR)
Local $sCommandButs = ' > , < , = ,null , Select * From records, where , like "%%" , delete from records where , vacuum'
Local $aFields = StringSplit($gsFields, ",")

Local $iY = 1
For $iX = 1 To UBound($aFields) - 2 ;-2 cause delim ends in comma cause a blank which destroyes the combolist
GUICtrlSetData($oComboColumns, $aFields[$iX])
Next
Local $aCommandButs = StringSplit($sCommandButs, ",")
For $iX = 1 To UBound($aCommandButs) - 1
$obcol = GUICtrlSetData($oComboCommands, $aCommandButs[$iX])
Next
#endregion - field helpers
#region create calendar
$iR = $iFieldRow
$iC += $iHW + $ihSpace
Local $iTimeRow = $iC
Local $iSmallButtonWidth = 15
$obutTime[0] = GUICtrlCreateButton(">", $iC, $iR, $iSmallButtonWidth, $iVH)
$iC += $iSmallButtonWidth
$obutTime[1] = GUICtrlCreateButton("=", $iC, $iR, $iSmallButtonWidth, $iVH)
$iC += $iSmallButtonWidth
$obutTime[2] = GUICtrlCreateButton("<", $iC, $iR, $iSmallButtonWidth, $iVH)
$iC += $iSmallButtonWidth
Local $iCalWidth = 2 * ($iHW + $ihSpace)
Local $oCalendar = GUICtrlCreateDate("", $iC, $iR, $iCalWidth, $iVH)
$iC = $iTimeRow
$iR += $iVH + $iVspace
$obutTime[3] = GUICtrlCreateButton(">", $iC, $iR, $iSmallButtonWidth, $iVH)
$iC += $iSmallButtonWidth
$obutTime[4] = GUICtrlCreateButton("=", $iC, $iR, $iSmallButtonWidth, $iVH)
$iC += $iSmallButtonWidth
$obutTime[5] = GUICtrlCreateButton("<", $iC, $iR, $iSmallButtonWidth, $iVH)
Local $style = "yyyy/MM/dd"
GUICtrlSendMsg($oCalendar, $DTM_SETFORMAT_, 0, $style)
$iC += $iSmallButtonWidth
Local $oTime = GUICtrlCreateDate("", $iC, $iR, $iCalWidth, $iVH, $DTS_TIMEFORMAT)
$DTM_SETFORMAT_ = 0x1032
$style = "HH:mm:ss"
GUICtrlSendMsg($oTime, $DTM_SETFORMAT_, 0, $style)
#endregion create calendar
GUISetState(@SW_SHOW)
Local $lMSG, $sBUT, $sDate, $sTime, $sTimeString
While 1
$lMSG = GUIGetMsg()
Switch $lMSG
Case $oComboColumns
;~ GUICtrlSetData($oInpSelect, GUICtrlRead($oComboColumns), "test")
Case $obutTime[0] To $obutTime[5]
For $iX = 0 To 5
If $lMSG = $obutTime[$iX] Then

If $iX > 2 Then
$sBUT = " scantime "
$sTemporal = GUICtrlRead($oTime)
Else
$sBUT = " scandate "
$sTemporal = GUICtrlRead($oCalendar)
EndIf
$sBUT &= GUICtrlRead($obutTime[$iX])
$sTimeString = StringReplace($sTemporal, "/", "")
$sTimeString = StringReplace($sTimeString, ":", "")
$sTimeString = $sBUT & $sTimeString
GUICtrlSetData($oInpSelect, $sTimeString, "test")
EndIf
Next
Case $oReCombo1
GUICtrlSetData($oInpSelect, GUICtrlRead($oComboColumns), "test")
Case $oReCombo2
GUICtrlSetData($oInpSelect, GUICtrlRead($oComboCommands), "test")
Case $oComboCommands
;~ GUICtrlSetData($oInpSelect, GUICtrlRead($oComboCommands), "test")
Case $obQuerry
GUISetState(@SW_HIDE, $oGUIq)
_GuiResults(GUICtrlRead($oInpSelect), $sPSEXEC)
If Not @error Then
GUICtrlSetData($oListPrevious, GUICtrlRead($oInpSelect))
_SQLite_Exec($ghDB, 'insert or replace into cmds values (''' & GUICtrlRead($oInpSelect) & ''');')
GUICtrlSetState($oInpSelect, $GUI_FOCUS)
EndIf
GUISetState(@SW_SHOW, $oGUIq)
Case $obClear
GUICtrlSetData($oInpSelect, "")
Case $oListPrevious
GUICtrlSetData($oInpSelect, GUICtrlRead($oListPrevious))
Case $GUI_EVENT_CLOSE
GUIDelete($oGUIq)
ExitLoop
EndSwitch
_HandleBox($oGUIq, $oComboColumns, $oInpSelect, $oDll)
_HandleBox($oGUIq, $oComboCommands, $oInpSelect, $oDll)
WEnd
DllClose($oDll)
GUIDelete()
Return
EndFunc ;==>_GuiQuery
Func _GuiResults($sQuerry, $sPSEXEC)
Local $lFile, $iX, $iY, $sMsg, $sResult, $sSkipApps, $iRows, $iColumns
$sSkipApps = -1
If StringInStr($sQuerry, 'delete') Or StringInStr($sQuerry, 'insert') Or StringInStr($sQuerry, 'update') Or StringInStr($sQuerry, 'replace') Then
$sResult = _SQLite_Exec($ghDB, $sQuerry)
If @error Then
MsgBox(0, 'SQL messege', 'result: ' & $sResult)
Else
MsgBox(0, 'SQL messege', 'Done')
EndIf
Return (1)
EndIf
Local $iGuiWidth = 800
Local $hGUIResult = GUICreate("Result", $iGuiWidth, 600)
Local $iR = 20
Local $iC = 20
Local $iCw = 105
Local $iRh = 20
Local $iCs = 10
Local $iRs = 5
Local $iListViewWidth = 540
Local $iListviewHieth = 560
Local $aHeader[3]
Local $sSqlErr
Local $hResults = _SQLite_SetTable2d($hGUIResult, $iCs, $iR, $iListViewWidth, $iListviewHieth, $ghDB, $sQuerry, $iRows, $iColumns, $aHeader)
If @error Then
$sSqlErr = _SQLite_ErrMsg()
MsgBox(16, "SQLite Error: " & $hResults, $sSqlErr)
If StringInStr($sSqlErr, "Disk") Then
Exit
EndIf
GUIDelete($hGUIResult)
SetError(1)
Return (0)
EndIf
$iC += $iListViewWidth + $iCs
Local $oButPSexec = -1, $oButMSTSC = -1, $oCMBTargetField

ConsoleWrite(@LF & $aHeader[0])
Local $xIP = StringInStr($aHeader[0], "IP")
Local $xName = StringInStr($aHeader[0], "Name")
Local $iCtrlInitC = $iC
Local $irGroupInit = $iR - $iRs
$iR += $iRh
If $xIP Or $xName Then
GUICtrlCreateLabel("&Launch by:", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
$oCMBTargetField = GUICtrlCreateCombo("", $iC, $iR, $iCw, $iRh, $CBS_DROPDOWNLIST)
$iR += $iRh + $iRs
$iC = $iCtrlInitC
If $xIP Then
$oButPSexec = GUICtrlCreateButton("&PSexecGUI: ", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
GUICtrlSetData($oCMBTargetField, "IP", "IP")
EndIf
If $xName Then
$oButMSTSC = GUICtrlCreateButton("&MSTSC: ", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
GUICtrlSetData($oCMBTargetField, "Name", "Name")
EndIf
$iR += $iRh + $iRs
GUICtrlCreateGroup("Launch", $iCtrlInitC - $iCs, $irGroupInit, $iC - $iCtrlInitC + $iCs / 3, $iR - $irGroupInit + $iRs)
EndIf
$iC = $iCtrlInitC
$iR += $iRs
$irGroupInit = $iR - $iRs
$iR += $iRh
GUICtrlCreateLabel("&Delim:", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
Local $oCMBDelim = GUICtrlCreateCombo("", $iC, $iR, $iCw, $iRh, $CBS_DROPDOWNLIST)
GUICtrlSetData($oCMBDelim, "Tab")
GUICtrlSetData($oCMBDelim, "Space")
GUICtrlSetData($oCMBDelim, "Comma", "Comma")
GUICtrlSetData($oCMBDelim, "Other")
$iC = $iCtrlInitC
$iR += $iRh + $iRs

Local $oChkHeader = GUICtrlCreateCheckbox("Include Header", $iC, $iR, $iCw, $iRh)
$iC = $iCtrlInitC
$iR += $iRh + $iRs
GUICtrlCreateLabel("Null String:", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
Local $oInpNull = GUICtrlCreateInput("", $iC, $iR, $iCw, $iRh, $CBS_DROPDOWNLIST)
$iC = $iCtrlInitC
$iR += $iRh + $iRs
Local $oButExportToCSV = GUICtrlCreateButton("&File", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
Local $oButExportToClip = GUICtrlCreateButton("&ClipBoard", $iC, $iR, $iCw, $iRh)
$iC += $iCw + $iCs
$iR += $iRh + $iRs
GUICtrlCreateGroup("Export", $iCtrlInitC - $iCs, $irGroupInit, $iC - $iCtrlInitC + $iCs / 3, $iR - $irGroupInit + $iRs)
For $x = 0 To $iColumns
_GUICtrlListView_SetColumnWidth($hResults, $x, $LVSCW_AUTOSIZE)
Next
GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete($hGUIResult)
Return
Case $oButPSexec
_RunAgainstComputer($hGUIResult, $hResults, $oCMBTargetField, $aHeader, $iRows, 1, $sPSEXEC)
Case $oButMSTSC
_RunAgainstComputer($hGUIResult, $hResults, $oCMBTargetField, $aHeader, $iRows, 2, $sPSEXEC)
Case $oButExportToCSV
_export($hGUIResult, $oChkHeader, $aHeader, $hResults, $oCMBDelim, $oInpNull, $iRows, 2)
Case $oButExportToClip
_export($hGUIResult, $oChkHeader, $aHeader, $hResults, $oCMBDelim, $oInpNull, $iRows, 1)
EndSwitch
WEnd
EndFunc ;==>_GuiResults
Func _GuiSelect($sSubnet, $sDB, $sSQL, $sPSEXEC)
Local $lMSG, $iC, $iDBrow, $iVH, $iQueryRow, $iR, $iHW, $obQuery, $obScan, $obsetDB, $obTarget, $oGUI, $olDatabase, $sFile, $iSubnetrow, $obSetSubNet, $olSubnet
$iHW = 100
$iVH = 20
Local $iCinit = 10
Local $iRinit = 10
$oGUI = GUICreate('Options', 6 * $iHW, 4 * $iVH)
$iC = $iCinit
$iR = $iRinit
$obScan = GUICtrlCreateButton('&Scan', $iC, $iR, $iHW, $iVH)
$iC += $iHW
$obQuery = GUICtrlCreateButton('&Query', $iC, $iR, $iHW, $iVH)
$iC += $iHW
$obTarget = GUICtrlCreateButton('&Target Single', $iC, $iR, $iHW, $iVH)
$iC += $iHW
Local $obPSexec = GUICtrlCreateButton('&Launch PSexec', $iC, $iR, $iHW, $iVH)
$iR += $iVH
$iC = $iCinit
$obsetDB = GUICtrlCreateButton('Set &DB', $iC, $iR, $iHW, $iVH)
$iC += $iHW
$olDatabase = GUICtrlCreateLabel('DB: ' & $sDB, $iC, $iR)
$iC -= $iHW
$iR += $iVH
$obSetSubNet = GUICtrlCreateButton('S&et Subnet', $iC, $iR, $iHW, $iVH)
$iC += $iHW
$olSubnet = GUICtrlCreateLabel('subnet: ' & $sSubnet, $iC, $iR, $iHW, $iVH)
GUISetState(@SW_SHOW)

While 1
$lMSG = GUIGetMsg()
Switch $lMSG
Case $obScan
GUIDelete($oGUI)
_gather($sSubnet)
ExitLoop
Case $obPSexec
GUIDelete($oGUI)
_GuiPSExec()
Return
Case $obQuery
GUIDelete($oGUI)
_GuiQuery($sPSEXEC)
ExitLoop
Case $obTarget
GUIDelete($oGUI)
_target($sPSEXEC, $sSubnet)
ExitLoop
Case $obsetDB
_SQLite_Close()
_SQLite_Shutdown()
GUISetState(@SW_HIDE, $oGUI)
$sFile = FileOpenDialog("Select DB", @ScriptDir, 'sqlite DB (*.lu-sqlite3)', 10, $sDB)
If @error Then
GUISetState(@SW_SHOW, $oGUI)
ContinueLoop
EndIf
$sDB = $sFile
GUICtrlSetData($olDatabase, 'DB:' & $sDB)
_sqlstart($sSQL, $sDB)
GUISetState(@SW_SHOW, $oGUI)
Case $GUI_EVENT_CLOSE
Exit
Case $obSetSubNet
_SetSubnet($sSubnet)
GUICtrlSetData($olSubnet, 'subnet: ' & $sSubnet)
EndSwitch
WEnd
GUIDelete($oGUI)
EndFunc ;==>_GuiSelect
Func _HandleBox($oGUI, $oComboBox, $oInputBox, $oDll)
Local $sRead
If _GuiCtrlGetFocus($oGUI) = $oComboBox Then
If _IsPressed('01', $oDll) Or _IsPressed('0D', $oDll) Then
If GUICtrlRead($oComboBox) <> "" Then
$sRead = GUICtrlRead($oComboBox)
GUICtrlSetData($oComboBox, " ")
While _IsPressed('01', $oDll) Or _IsPressed('0D', $oDll)
Sleep(1)
WEnd
GUICtrlSetData($oInputBox, $sRead, "test")
EndIf
EndIf
EndIf
EndFunc ;==>_HandleBox
Func _Load($sLoadListPath, $oListComps)
Local $file, $FRPCL
$file = FileOpen($sLoadListPath, 0)
If $file = -1 Then
MsgBox(0, 'Error', 'Unable To open file')
EndIf
While 2
$FRPCL = FileReadLine($file)
If @error = -1 Then ExitLoop
_GUICtrlListView_AddItem($oListComps, $FRPCL)
WEnd
EndFunc ;==>_Load

Func _main()
#region -environment
Local $sDB = @ScriptDir & "mainDB.lu-sqlite3"
Local $sSQLpath = @AppDataCommonDir & 'sqlite'
Local $sSQL = $sSQLpath & 'sqlite3.dll'
If Not FileExists($sSQLpath) Then DirCreate($sSQLpath)
;~ FileInstall('C:\Windows\System32\sqlite3.dll', $sSQL)
_sqlstart($sSQL, $sDB)
Local $sPSEXEC = $sSQLpath & 'psexec.exe'
;~ FileInstall('C:\Windows\System32\PsExec.exe', $sPSEXEC)
Local $sSubnet = _getsubnet()
#endregion -environment

Local $xQuiet
If $cmdline[0] > 0 Then
_ConsoleSwitch($sSubnet, $sDB, $sSQL)
Exit
EndIf
While 1
_GuiSelect($sSubnet, $sDB, $sSQL, $sPSEXEC)

WEnd
EndFunc ;==>_main

; Unknown programmer
Func _NetServerEnum($iSrvType = -1, $sDomain = '')
Local $uBufPtr = DllStructCreate("ptr;int;int"), $res[1] = [0], $i
Local $uRecord = DllStructCreate("dword;ptr"), $iRecLen = DllStructGetSize($uRecord)
Local $uString = DllStructCreate("char[16]")
Local $uDomain = DllStructCreate("byte[32]"), $sPriorityDomain = 0
If Not ($sDomain = '' Or $sDomain = '*') Then
DllStructSetData($uDomain, 1, StringToBinary($sDomain, 2))
$sPriorityDomain = DllStructGetPtr($uDomain)
EndIf
Local $ret = DllCall("netapi32.dll", "int", "NetServerEnum", _
"ptr", 0, "int", 100, _
"ptr", DllStructGetPtr($uBufPtr, 1), "int", -1, _
"ptr", DllStructGetPtr($uBufPtr, 2), _
"ptr", DllStructGetPtr($uBufPtr, 3), _
"int", $iSrvType, "ptr", $sPriorityDomain, "int", 0)
If $ret[0] Then Return SetError(1, $ret[0], '')
Local $res[DllStructGetData($uBufPtr, 3) + 1] = [DllStructGetData($uBufPtr, 3)]
For $i = 1 To DllStructGetData($uBufPtr, 3)
Local $uRecord = DllStructCreate("dword;ptr", DllStructGetData($uBufPtr, 1) + ($i - 1) * $iRecLen)
Local $sNBName = DllStructCreate("byte[32]", DllStructGetData($uRecord, 2))
DllStructSetData($uString, 1, BinaryToString(DllStructGetData($sNBName, 1), 2))
$res[$i] = DllStructGetData($uString, 1)
Next
$ret = DllCall("netapi32.dll", "int", "NetApiBufferFree", "ptr", DllStructGetData($uBufPtr, 1))
Return $res
EndFunc ;==>_NetServerEnum
Func _NormaliseSubnet($sInpSubnet)
Local $aSubnet
$aSubnet = StringRegExp($sInpSubnet, 'b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)b', 2)
If IsArray($aSubnet) Then
If UBound($aSubnet) > 0 Then
$sInpSubnet = $aSubnet[0]
If Not StringRight($sInpSubnet, ".") Then $sInpSubnet &= "."
Else
MsgBox(0, "error", "subnet malforemed?")
SetError(1)
Return
EndIf
Else
MsgBox(0, "error", "subnet malformed, must be in form xxx.xxx.xxx")
SetError(1)
Return
EndIf
Return ($sInpSubnet)
EndFunc ;==>_NormaliseSubnet
Func _ProcessCloseHandle($h_Process)
; Close the process handle of a PID
DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $h_Process)
If Not @error Then Return 1
Return 0
EndFunc ;==>_ProcessCloseHandle
Func _ProgressPercentCalc($iCurrent, $iEnd, $iTime)
Local $iAverageTime, $iExpectedTime
$iAverageTime = ($iTime / $iCurrent)
$iExpectedTime = $iAverageTime * $iEnd
$iPercent = Round($iTime / $iExpectedTime * 100, 1)
Return $iPercent
EndFunc ;==>_ProgressPercentCalc

Func _PSRunString($sPSexecPath, $oCmbThreadPriority, $sTarget, $GUI_CHECKED, $oChkCopyFile, $oChkInteract, $oChkLimitedUser, $oChkNoLoadPofile, $oChkSystemAccount, $oRadDontWait, $oRadOnlyNewer, $oRadOverWrite, $oListComps, $sPriority, $oInpAppCommand, $oSLider, $oInpWorkingDir, $oInpUserName, $oInpPassword, $xShellOnly = 0)
Local $d = '', $c = '', $v = '', $f = '', $e = '', $s = '', $i = '', $w = '', $l = '', $USN = '', $sPriorityAS = '', $TO = '', $sParams
;Don't wait for process to terminate
If BitAND(GUICtrlRead($oRadDontWait), $GUI_CHECKED) = $GUI_CHECKED Then $d = ' -d'
;Copy file to remote machine
If BitAND(GUICtrlRead($oChkCopyFile), $GUI_CHECKED) = $GUI_CHECKED Then $c = ' -c'
;Copy if newer or higher version
If BitAND(GUICtrlRead($oRadOnlyNewer), $GUI_CHECKED) = $GUI_CHECKED And BitAND(GUICtrlRead($oChkCopyFile), $GUI_CHECKED) = $GUI_CHECKED Then $v = ' -v'
;Overwrite existing file
If BitAND(GUICtrlRead($oRadOverWrite), $GUI_CHECKED) = $GUI_CHECKED And BitAND(GUICtrlRead($oChkCopyFile), $GUI_CHECKED) = $GUI_CHECKED Then $f = ' -f'
;Run application in the system account
If BitAND(GUICtrlRead($oChkSystemAccount), $GUI_CHECKED) = $GUI_CHECKED Then $s = ' -s'
;Interact with the users desktop
If BitAND(GUICtrlRead($oChkInteract), $GUI_CHECKED) = $GUI_CHECKED Then $i = ' -i'
;Does not load the speified account's profile.
If BitAND(GUICtrlRead($oChkNoLoadPofile), $GUI_CHECKED) = $GUI_CHECKED Then $e = ' -e'
;Run process as limeted user
If BitAND(GUICtrlRead($oChkLimitedUser), $GUI_CHECKED) = $GUI_CHECKED Then $e = ' -l'
Local $sRunCMD = StringStripWS(GUICtrlRead($oInpAppCommand), 3)


;reads any command line options were specified
;Specifies what priority was selectedg
$sPriority = StringLower('-' & StringReplace(_GUICtrlComboBox_GetEditText($oCmbThreadPriority), ' ', ''))
;Timeout connecting to remote machine
$TO = ' -n ' & GUICtrlRead($oSLider)
;Depending which tab is active create the correct computer list
;checks if alternate username was specified
If GUICtrlRead($oInpWorkingDir) <> '' Then $w = ' -w "' & GUICtrlRead($oInpWorkingDir) & '"'
$USN = GUICtrlRead($oInpUserName)
If $USN <> '' Then
$USN = ' -u ' & GUICtrlRead($oInpUserName) & ''
$sPriorityAS = ' -p ' & GUICtrlRead($oInpPassword)
EndIf
;Execution loop
If $xShellOnly = 0 Then
If $sRunCMD = '' Then
MsgBox(0, "", "No application was specified.")
SetError(1)
Return (0)
EndIf
$sParams = $e & $c & $v & $f & $w & $d & ' ' & $sPriority & ' '
Else
$sRunCMD = "cmd.exe"
EndIf
Return (@ComSpec & " /c " & '"' & $sPSexecPath & '" ' & $sTarget & $USN & $sPriorityAS & $s & $i & $TO & $sParams & ' ' & $sRunCMD)
EndFunc ;==>_PSRunString
Func _RunAgainstComputer($hGUIResult, $hResults, $oCMBTargetField, $aHeader, $iRows, $iLaunch, $sPSEXEC)
Local $sSplitString = '|'
Local $iTargetIndex, $sList, $sText, $sSplitString, $aResult, $iPos, $sTarget, $iPID

If GUICtrlRead($oCMBTargetField) = "IP" Then
$iTargetIndex = $aHeader[1]
Else
$iTargetIndex = $aHeader[2]
EndIf
$aResult = _GUICtrlListView_GetSelectedIndices($hResults, True)
If $aResult[0] = 0 Then
$sList = ""
For $x = 0 To $iRows
$sText = _GUICtrlListView_GetItemText($hResults, $x, $iTargetIndex)
If Not StringInStr($sList, $sText) And $sText <> "" Then $sList &= $sText & $sSplitString
Next
;
Else
$sList = ""
For $x = 1 To $aResult[0]
$sText = _GUICtrlListView_GetItemText($hResults, $aResult[$x], $iTargetIndex)
If Not StringInStr($sList, $sText) And $sText <> "" Then $sList &= $sText & $sSplitString
Next

EndIf
Switch $iLaunch
Case 1 ;psexec
GUISetState(@SW_HIDE, $hGUIResult)
_GuiPSExec($sList, $sSplitString, $sPSEXEC)
GUISetState(@SW_SHOW, $hGUIResult)
Case 2 ;mstsc

GUISetState()
While 1
$iPos = StringInStr($sList, $sSplitString)
If $iPos = 0 Then Return
$sTarget = StringLeft($sList, $iPos - 1)
$sList = StringTrimLeft($sList, $iPos)
Switch MsgBox(3, "Connecting", "Connecting to " & $sTarget & ", Proceed?")
Case 6 ;yes
$iPID = RunWait("cmd /c mstsc /admin /v " & $sTarget)
Case 7 ;no
ContinueLoop
Case 2 ;cancel
Return
EndSwitch
WEnd
EndSwitch
EndFunc ;==>_RunAgainstComputer
Func _scanit($sComputer, $sSubnet)


Local $sScandate = @YEAR & @MON & @MDAY
Local $sScanTime = @HOUR & @MIN
_write($sComputer, $sScandate, $sScanTime)
Local $oWMIService
If Ping($sComputer, 100) Then
$oWMIService = _startWMI($sComputer)
If IsObj($oWMIService) Then
_collect($sComputer, $oWMIService, True, $sScandate, $sScanTime)
Else
_assume($sComputer, $sScandate, $sScanTime)
EndIf
Else
_collect($sComputer, $oWMIService, False, $sScandate, $sScanTime)
EndIf

EndFunc ;==>_scanit


Func _SetSubnet(ByRef $sSubnet)
Local $sSubnetAnswer
$sSubnetAnswer = InputBox("Set Subnet", "Please enter the subnet, in the form xxx.xxx.xxx. (three dots), class c support only ATM.", $sSubnet)
If @error Then Return
$sSubnet = _NormaliseSubnet($sSubnetAnswer)
EndFunc ;==>_SetSubnet
Func _SQinsert($sSetColumn, $sValue, $sComputer, $sScandate, $sScanTime)
Local $hQuery, $aRow[1], $sMsg
Local $sFields
$sCMD = 'update or replace records set ' & $sSetColumn & '="' & $sValue & '" where scandate="' & $sScandate & '" and scantime="' & $sScanTime & '" and IP="' & $sComputer & '";'
_SQLite_Query($ghDB, $sCMD, $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[0]
WEnd
ConsoleWrite(@LF & "Debug query:" & $sMsg)
ConsoleWrite(@LF & "debug Inserting: " & $sCMD)
EndFunc ;==>_SQinsert
Func _sqlfieldupdate($sSetColumn) ; checks to see if field exists, else creates it.

If Not StringInStr($gsFields, $sSetColumn) Then
_FetchTableColumns($gsFields)
If StringInStr($gsFields, $sSetColumn) Then Return
Local $hQuery, $aRow[1], $sMsg
_SQLite_Query($ghDB, "commit;", $hQuery)
_SQLite_Query($ghDB, "BEGIN TRANSACTION;", $hQuery)
_SQLite_Query($ghDB, 'Alter Table records add column ' & $sSetColumn, $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[0]
WEnd
_SQLite_Query($ghDB, "commit;", $hQuery)
_SQLite_Query($ghDB, "BEGIN TRANSACTION;", $hQuery)
_FetchTableColumns($gsFields)
EndIf
EndFunc ;==>_sqlfieldupdate
Func _SQLite_SetTable2d($hGUIResult, $iLeft, $iTop, $iWidth, $iHeight, $hDB, $sSQL, ByRef $iRows, ByRef $iColumns, ByRef $aHeader)
Local $sRow, $iIndex
Local $sSeperator = Chr(127)
Opt("GUIDataSeparatorChar", $sSeperator)
$aHeader[0] = "Row "
#region - sqlstuff
If __SQLite_hChk($hDB, 3) Then Return SetError(@error, 0, $SQLITE_MISUSE)
Local $sCallBack = "", $fCallBack = False
Local $hQuery
Local $r = _SQLite_Query($hDB, $sSQL, $hQuery)
If @error Then Return SetError(@error, 0, $r)
If $r <> $SQLITE_OK Then
__SQLite_ReportError($hDB, "_SQLite_GetTable2d", $sSQL)
_SQLite_QueryFinalize($hQuery)
Return SetError(-1, 0, $r)
EndIf
Local $iRval_ColCnt = DllCall($g_hDll_SQLite, "int:cdecl", "sqlite3_column_count", "ptr", $hQuery)
Local $err = @error
If $err Then
_SQLite_QueryFinalize($hQuery)
Return SetError(1, $err, $SQLITE_MISUSE) ; Dllcall error
EndIf
$iColumns = $iRval_ColCnt[0]
If $iColumns <= 0 Then
_SQLite_QueryFinalize($hQuery)
Return SetError(-1, 0, $SQLITE_DONE)
EndIf
$iRows = 0
Local $iRval_Step
While True
$iRval_Step = DllCall($g_hDll_SQLite, "int:cdecl", "sqlite3_step", "ptr", $hQuery)
$err = @error
If $err Then
_SQLite_QueryFinalize($hQuery)
Return SetError(1, $err, $SQLITE_MISUSE) ; Dllcall error
EndIf
Switch $iRval_Step[0]
Case $SQLITE_ROW
$iRows += 1
Case $SQLITE_DONE
ExitLoop
Case Else
_SQLite_QueryFinalize($hQuery)
Return SetError(-1, $err, $iRval_Step[0])
EndSwitch
WEnd
Local $ret = _SQLite_QueryReset($hQuery)
$err = @error
If $err Then
_SQLite_QueryFinalize($hQuery)
Return SetError($err, 0, $ret)
EndIf
Local $aDataRow[$iColumns]
If Not $fCallBack Then
$r = _SQLite_FetchNames($hQuery, $aDataRow)
$err = @error
If $err Then
_SQLite_QueryFinalize($hQuery)
Return SetError($err, 0, $r)
EndIf
For $x = 0 To $iColumns - 1
$aHeader[0] &= $sSeperator & $aDataRow[$x]
If $aDataRow[$x] = "IP" Then $aHeader[1] = $x + 1
If $aDataRow[$x] = "Name" Then $aHeader[2] = $x + 1
Next
Local $hList = GUICtrlCreateListView($aHeader[0], $iLeft, $iTop, $iWidth, $iHeight, $LVS_SHOWSELALWAYS, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP))
GUISetState(@SW_SHOW)
Else
Local $iCbRval
EndIf
If $iRows > 0 Then
_GUICtrlListView_SetItemCount($hList, $iRows)
For $i = 1 To $iRows
$r = _SQLite_FetchData($hQuery, $aDataRow)
$err = @error
If $err Then
_SQLite_QueryFinalize($hQuery)
Return SetError($err, 0, $r)
EndIf
If $fCallBack Then
$iCbRval = Call($sCallBack, $aDataRow)
If $iCbRval = $SQLITE_ABORT Or $iCbRval = $SQLITE_INTERRUPT Or @error Then
$err = @error
_SQLite_QueryFinalize($hQuery)
Return SetError(4, $err, $iCbRval)
EndIf
Else
$iIndex = _GUICtrlListView_AddItem($hList, $i)
For $y = 0 To $iColumns - 1
_GUICtrlListView_AddSubItem($hList, $iIndex, $aDataRow[$y], $y + 1)
Next
EndIf
Next
_SQLite_QueryFinalize($hQuery)
Return ($hList)
EndIf
#endregion - sqlstuff
Return (_SQLite_QueryFinalize($hQuery))
EndFunc ;==>_SQLite_SetTable2d
Func _sqlstart($sSQL, $sDB)
Local $lDll, $iX, $iRows, $iColumns, $hQuery, $aRow[1]
_SQLite_Close()
_SQLite_Shutdown()
$lDll = _SQLite_Startup($sSQL)
If @error Then MsgBox(0, "Error!", "SQLite could not start, it is looking for the DLL at " & $sSQL)
If Not FileExists($sDB) Then
Global $ghDB = _SQLite_Open($sDB)
_SQLite_Exec($ghDB, 'Create table records (scandate ,scantime ,IP text, name );')
_SQLite_Exec($ghDB, 'Create table cmds (commands);')
Else
Global $ghDB = _SQLite_Open($sDB)
EndIf

EndFunc ;==>_sqlstart
Func _startWMI($sComputer)
Local $var = RegRead("" & $sComputer & "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWBEM", "Installation Directory")
ConsoleWrite(@LF & "RegRead: " & $var)
If $var = "" Then

Return (0)
EndIf
$oWMIService = ObjGet("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& $sComputer & "rootcimv2")
If IsObj($oWMIService) Then
Return ($oWMIService)
Else
Return 0
EndIf
EndFunc ;==>_startWMI
Func _target($sPSEXEC, $sSubnet)
Local $ip
$ip = InputBox('Target', 'Enter target Name or IP to scan, shorthand for three octet can be entered as "..." , ie ...127', '...127')
If @error Then Return
If StringRegExp($ip, "...(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)") Then
$ip = StringReplace($ip, "...", "")
$ip = $sSubnet & $ip
EndIf
_scanit($ip, $sSubnet)
_GuiResults('select * from records where scandate=' & @YEAR & @MON & @MDAY & ' and scantime>' & @HOUR & "00", $sPSEXEC)
Return
EndFunc ;==>_target
Func _write($sComputer, $sScandate, $sScanTime)
Local $iX, $sReturn, $sCallBack
Local $sBaseQuery = 'insert into records values ( "' & $sScandate & '","' & $sScanTime & '","' & $sComputer & '" ,"NoData"'

$sReturn = _SQLite_Exec($ghDB, $sBaseQuery & $gsNull & ' );')
;~ ConsoleWrite(@LF & "Return:" & $sReturn)
While $sReturn = 1
$gsNull = ""
For $x = 5 To _FetchTableColumns($gsFields)
$gsNull &= ",null"
Next
$sReturn = _SQLite_Exec($ghDB, $sBaseQuery & $gsNull & ');', "_CallBack")
Sleep(100)
WEnd

EndFunc ;==>_write#region ;**** Directives created by AutoIt3Wrapper_GUI ****
Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm always looking for tools like yours, however there are a couple of things:

First, you can trim out a lot of your includes. I often find that when I am "done" with a project there are lots of unneeded includes left over that I no longer need, or whose required functions seem to exist in another include. By commenting them out one by one and running a Syntax Check looking for failures I trimmed 13 of your includes. That will really reduce the size of the compiled project.

Also, since #region -environment contains information that we might have to adjust to fit our needs, consider putting that section at the top of the script so we don't have to travel so far to find it.

Next, when I try running Scan I get the following error:

RegRead:

adding:nameole-drippystuffCodeAudit Toolfrankenstein.au3 (42) : ==> Array variable subscript badly formatted.:

ReDim $aStat[$iColCount][2]

ReDim $aStat[^ ERROR

Lastly, when I tried to compile I got a fail on "C:\Windows\System32\sqlite3.dll" even though it does exist and I made sure to have a copy in @AppDataCommonDir as per #region -environment. Maybe you could use the inline dll with #include <SQLite.dll.au3> or mention in your post if the latest build from www.sqlite.org is needed (though mine is....).

I would like to see what your script offers - anything that runs via PSExec has my interest ;)

Thanks

Ian

Edited by llewxam

My projects:

  • IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged.
  • INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them.
  • PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses.
  • Sync Tool - Folder sync tool with lots of real time information and several checking methods.
  • USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions.
  • Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent.
  • CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction.
  • MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app.
  • 2048 Game - My version of 2048, fun tile game.
  • Juice Lab - Ecigarette liquid making calculator.
  • Data Protector - Secure notes to save sensitive information.
  • VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive.
  • Find in File - Searches files containing a specified phrase.

Share this post


Link to post
Share on other sites

RegRead:

adding:nameole-drippystuffCodeAudit Toolfrankenstein.au3 (42) : ==> Array variable subscript badly formatted.:

ReDim $aStat[$iColCount][2]

ReDim $aStat[^ ERROR

I was able to reproduce the above by "trimming" misc.au3

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Lastly, when I tried to compile I got a fail on "C:\Windows\System32\sqlite3.dll" even though it does exist and I made sure to have a copy in @AppDataCommonDir

The "C:\Windows\System32\sqlite3.dll" is in the Fileinstall() function in the environment. Which happens to be where I keep it on my computer because I have a 3rd party application that requires it there (stupid). Fileinstall() does not accept relative paths in the version I am running. So make sure it points to where your dll is. The $sSQLpath is where the DLL gets installed too.

Perfect example on how I need to comment things better.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

Recommendation: Add Active Directory info


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites

Your script has sparked an interest, since I've got a script to extract the computer info as well.

Curious to compare the two...

I'm still stepping through the code, but as for the whole "includes" and determining which ones you really need:

Take a look at Xenobiologist's OrganizeIncludes -

Can't say how much time this has saved me in my scripting!


If you try to fail and succeed which have you done?AutoIt Forum Search

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Update: Fixed it not picking up printers.

@country73 Feel free to ask questions , sometimes I code with my head screwed on backwards so not everything may not make sense.

I tried that includes organizer, it seemed to work. Thanks.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Recommendation: Add Active Directory info

Could you give me example? Maybe a tool for a searchable ldap catalog might be useful, and have it run at the same time as backups run?

I actually started this tool to help me clean up a craptastic directory, and help with a rollout.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

My Active Directory UDF has a lot of functions you could use in your tool.

In Addition please check my Example section. Maybe the functionality you search is already there.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Could you give me example? Maybe a tool for a searchable ldap catalog might be useful, and have it run at the same time as backups run?

I actually started this tool to help me clean up a craptastic directory, and help with a rollout.

Nevermind, I just found there is a built in function for taking a snapshot of the AD database.

I just don't see any useful info that can be gathered in tandem with active directory, that is better than using AD itself.

I may put in function to run against active directory from query results.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

Well I tried Your Code .............

I'm getting the Following Error on pressing the Scan Button..........

RegRead:

adding:nameC:UsersabhishekDesktopPresentationAbhishekSCriptsTesting........Doubt Forum.au3 (39) : ==> Array variable subscript badly formatted.:

ReDim $aStat[$iColCount][2]

ReDim $aStat[^ ERROR

->11:40:49 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 21.589

Regards

Phoenix XL


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Well I tried Your Code .............

Unfortunately I cannot recreate the error. When I get some time, I will add some more error handling to see if I can root out the cause.

I have only tested it on XP, are you running windows 7? Also could you check to make the variables in #region -environment will match your setup.

Also, I came to realise that the $astat variable is completely unnescessessary extra step and will be eliminated.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Everything now works good..................

Your Script wasnt able to get the SQLite.dll (coz of Windows7 different Directory)

This Time(After U Updated the Post) I got the Msgbox giving me the Error ..........

I changed the Directory ................

n Everything Works F9 now........

Thnx For your Script

Regards

Phoenix XL

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0