gcue Posted August 6, 2008 Share Posted August 6, 2008 im not sure what conditions to put here that will make this go faster... i know i can decrease the for loop to a shorter number but i just want to make sure all the keys are covered... For $i = 1 To 100 $b = _HKCU_EnumKey("\\\" & $sComputer & "\Network", $i) $iProd = 1 For $j = 1 To $b[0][0] $iProd *= $b[$j][2] Next ;If $iProd <> 0 Then ExitLoop ;If $iProd <> 0 Then MsgBox(0,"",$iProd) If $iProd <> 0 Then ContinueLoop _ArrayDisplay($b, $i) If $b[$i][2]=0 Then ; $path= _HKCU_Read("\\\" & $sComputer & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") $path= _HKCU_Read("\\\" & $sComputer & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") MsgBox(0, "", "User: " & $b[$i][0] & @CRLF & _ "Drive: " & $b[$i][1] & @CRLF & _ "Path: " & $path) EndIf WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 6, 2008 Share Posted August 6, 2008 (edited) im not sure what conditions to put here that will make this go faster... i know i can decrease the for loop to a shorter number but i just want to make sure all the keys are covered... For $i = 1 To 100 $b = _HKCU_EnumKey("\\\" & $sComputer & "\Network", $i) $iProd = 1 For $j = 1 To $b[0][0] $iProd *= $b[$j][2] Next ;If $iProd <> 0 Then ExitLoop ;If $iProd <> 0 Then MsgBox(0,"",$iProd) If $iProd <> 0 Then ContinueLoop _ArrayDisplay($b, $i) If $b[$i][2]=0 Then ; $path= _HKCU_Read("\\\" & $sComputer & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") $path= _HKCU_Read("\\\" & $sComputer & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") MsgBox(0, "", "User: " & $b[$i][0] & @CRLF & _ "Drive: " & $b[$i][1] & @CRLF & _ "Path: " & $path) EndIf WEnd You could have at least run Tidy on your demo... DOC_FileName$:c:\temp\test_tidy.txt c:\temp\test.au3(26) : ### Tidy Error -> "wend" is closing previous "for" !> there were 1 error(s) encountered. look in your source for:### Tidy Error: Post a working demo that we can talk about. Edited August 6, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
gcue Posted August 6, 2008 Author Share Posted August 6, 2008 (edited) sorry bout that here it is For $i = 1 To 100 $b = _HKCU_EnumKey("\\\" & $sComputer & "\Network", $i) $iProd = 1 For $j = 1 To $b[0][0] $iProd *= $b[$j][2] Next If $iProd <> 0 Then ExitLoop _ArrayDisplay($b, $i) If $b[$i][2] = 0 Then $path = _HKCU_Read("\\\" & $sComputer & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") MsgBox(0, "", "User: " & $b[$i][0] & @CRLF & _ "Drive: " & $b[$i][1] & @CRLF & _ "Path: " & $path) EndIf Next Edited August 6, 2008 by gcue Link to comment Share on other sites More sharing options...
DW1 Posted August 6, 2008 Share Posted August 6, 2008 We still need to see what these functions are doing and how they are building the array: _HKCU_EnumKey() _HKCU_Read() AutoIt3 Online Help Link to comment Share on other sites More sharing options...
gcue Posted August 7, 2008 Author Share Posted August 7, 2008 (edited) here are engine's UDFShttp://www.autoitscript.com/forum/index.ph...mp;#entry545798thank you for your help! Edited August 7, 2008 by gcue Link to comment Share on other sites More sharing options...
gcue Posted August 9, 2008 Author Share Posted August 9, 2008 i still cant figure this out.. anyone else have any ideas? -many thanks- Link to comment Share on other sites More sharing options...
weaponx Posted August 9, 2008 Share Posted August 9, 2008 I don't even understand what the problem is. When you are enumerating registry keys, you don't use For...Next because there is no predetermined count. You use RegEnumKey() with an incremented index until it returns an error. $index = 1 While 1 $key = RegEnumKey() If @ERROR Then ExitLoop $index += 1 WEnd Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2008 Author Share Posted August 11, 2008 (edited) didn't work =/here's what im trying to do using engine's UDFs:i am trying to check a remote machine's registry for all the users' who have logged into that machine via their hkcurrent user registry entry (engine's UDF can do this!) and identify WHO has a mapped drive locally (instead of thru a logic script) and WHAT LETTER and PATH they have mapped.here's whats currently happening with the code below:an arraydisplay (http://www.postyourimage.com/view_image.php?img_id=JgwVTaSkXEaVMi1217861795) shows which users currently have mapped drives (indicated by the letter they have mapped and also the 3rd column of the array that has a value of 0)the csv file produced however only shows the first user who has the mapped drive and no one else...===perhaps someone else who has used engine's UDFs is experiencing the same challenges?many thankshere is the code with some minor changesexpandcollapse popup#include <Array.au3> #include "HKCUReg.au3" $asset = "d0058256" $toolsdir=@ScriptDir $file = FileOpen($toolsdir & "\maps.csv", 1) If $file = -1 Then MsgBox(0, "Local Mapped Drives", 'CSV log file is in use.'&@CRLF & _ 'Please close it before continuing.') Return EndIf FileClose($file) $file = $toolsdir & "\maps.csv" If FileExists($file) Then FileDelete ($file) EndIf FileWrite($file, "User, Drive, Path") For $i = 1 To 10 $b = _HKCU_EnumKey("\\\" & $asset & "\Network", $i) $iProd = 1 For $j = 1 To $b[0][0] $iProd *= $b[$j][2] Next If $iProd <> 0 Then ExitLoop _ArrayDisplay($b, $i) If $b[$i][2] = 0 Then ;$path= _HKCU_Read("\\\" & $asset & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") ;$path = _HKCU_Read("\\\" & $asset & "\\" & $b[$i][0] & "\Network\" & $b[$i][1], "RemotePath") $path = _HKCU_Read("\\\" & $asset & "\Network\" & $b[$i][1], "RemotePath") FileWrite($file, '' &@CRLF & _ $b[$i][0] & "," & $b[$i][1] & "," & $path) EndIf Next ShellExecute($file) Edited August 11, 2008 by gcue Link to comment Share on other sites More sharing options...
engine Posted August 11, 2008 Share Posted August 11, 2008 Hi gcue.This code should report all mapped drives per user on the target computer.#include <Array.au3> #include "HKCUReg.au3" $sComputer = @ComputerName $a = GetProfile("", $sComputer) Dim $k, $aUser[1] For $i = 1 To $a[0][0] While 1 $k += 1 $b = _HKCU_EnumKey("\\\" & $sComputer & "\\" & $a[$i][0] & "\Network", $k) If $b[1][2] Then ExitLoop $iUBound = UBound($aUser) ReDim $aUser[$iUBound + 1] $aUser[$iUbound] = $b WEnd _ArrayDisplay($aUser, $a[$i][0]) NextPlease try it and report back. Since there are no mapped drives on my personal computer.Please note that I am using an internal use only function from HKCUReg.au3 UDF, GetProfile() to determine the users that logged to that computer at least once. That way I can use _HKCU_EnumKey for each user at a time and determine all the mapped drives for that user.Also, I am sure there are others ways to get what you need.Regards. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2008 Author Share Posted August 11, 2008 thanks for responding engine!unfortunately, it did not work. it reports an empty array for each user - wether they have a mapped drive or not. (each of the arrays had an empty row as shown below) http://www.postyourimage.com/view_image.ph...oWfZh1218468354 Link to comment Share on other sites More sharing options...
engine Posted August 11, 2008 Share Posted August 11, 2008 Sorry. I made a stupid mistake! #include <Array.au3> #include "HKCUReg.au3" $sComputer = @ComputerName $a = GetProfile("", $sComputer) Dim $k, $aUser[1] For $i = 1 To $a[0][0] While 1 $k += 1 $b = _HKCU_EnumKey("\\\" & $sComputer & "\\" & $a[$i][0] & "\Network", $k) If $b[1][2] Then ExitLoop $iUBound = UBound($aUser) ReDim $aUser[$iUBound + 1] $aUser[$iUbound] = $b[1][1] WEnd _ArrayDisplay($aUser, $a[$i][0]) Next Please try it again. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
gcue Posted August 11, 2008 Author Share Posted August 11, 2008 hmm that shows that everyone has the same mapping... which i think is carried over from the first person's result Link to comment Share on other sites More sharing options...
engine Posted August 11, 2008 Share Posted August 11, 2008 Try this one #include <Array.au3> #include "HKCUReg.au3" $sComputer = @ComputerName $a = GetProfile("", $sComputer) Dim $k, $asAll[$a[0][0] + 1] $asAll[0] = $a[0][0] For $i = 1 To $a[0][0] Dim $asUser[1] While 1 $k += 1 $b = _HKCU_EnumKey("\\\" & $sComputer & "\\" & $a[$i][0] & "\Network", $k) If $b[1][2] <> 0 Then $asUser[0] = UBound($asUser) - 1 ExitLoop EndIf $iUBound = UBound($asUser) ReDim $asUser[$iUBound + 1] $asUser[$iUbound] = $b[1][1] $b = 0 WEnd $asAll[$i] = $asUser $asUser = 0 _ArrayDisplay($asAll[$i], $a[$i][0]) Next My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now