
meier3283
Active Members-
Posts
35 -
Joined
-
Last visited
Everything posted by meier3283
-
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Setup_McAfee.ico #AutoIt3Wrapper_outfile=DEL_LPC_MA45.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <Array.au3> #Include <File.au3> Global $szDrive, $szDir, $szFName, $szExt ; Validate MA version 4.5.0.1440 or lower $SZProductVer=RegRead("HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\EPOAGENT3000","Version") If $SZProductVer>"4.5.0.1440" Then Exit ; Locate the directory we are going to preserve $szFolder = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "MA_LPC_RUNTIME") $path2 = _PathSplit($szFolder, $szDrive, $szDir, $szFName, $szExt) ; Locate the root directory to start enumerating from. $DataPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "Installed Path") ; Get list of directories $DirList = _FileListToArray($DataPath, "lpc*") ;_ArrayDisplay($DirList,"All folders") ; debug ; Determine array location of directory to preserve $SaveDir = _ArraySearch($DirList, $szFName, 0, 0, 0, 1); partial match flag set ;Msgbox(0,"","Index of Folder to save: " & $SaveDir) ; debug ; Remove target directory from array _ArrayDelete($DirList, $SaveDir) ; _ArrayDisplay($DirList,"Directories flagged for deletion") ; debug $DataPath &= "\" ; only needed if $datapath doesnt already end in a backslash For $i = 1 to $DirList[0] - 1 ; reduce it by one to compensate for the entry we previously removed DirRemove($DataPath & $DirList[$i], 1) ; 1 flag to also delete any subdirectiories Next Here's my final code, it does exactly what I needed, and I couldn't have done it without your help. (no matter how many more hours I spend in the help file) I really appreciate it. - David
-
#Include <Array.au3> #Include <File.au3> Global $szDrive, $szDir, $szFName, $szExt ; Locate the directory we are going to preserve $szFolder = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "MA_LPC_RUNTIME") $path2 = _PathSplit($szFolder, $szDrive, $szDir, $szFName, $szExt) ; Locate the root directory to start enumerating from. $DataPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "Installed Path") ; Get list of directories $DirList = _FileListToArray($DataPath, "lpc*") _ArrayDisplay($DirList,"All folders") ; Determine array location of directory to preserve $SaveDir = _ArraySearch($DirList, $szFName, 0, 0, 0, 1); partial match flag set _ArrayDisplay($SaveDir,"Folder to save") ; Remove target directory from array _ArrayDelete($DirList, $SaveDir) _ArrayDisplay($DirList,"Directories flagged for deletion") Msgbox(0,"","Index of Folder to save: " & $SaveDir) Ok, I added my PathSplit command back in, and now your code is creating an array that shows only the folders I want to delete. So that's perfect. Also, the msgbox does show the proper index number of the "good" folder. Now I'm on to figure out how to delete these folders (man, I really appreciate your help!) Edit: Do I need to worry about the Index=0 that shows up in these arrays? I'm guessing they are "zero" data, and will be ignored. I just don't want to go deleting the root folder or anything
-
#Include <Array.au3> #Include <File.au3> Global $szDrive, $szDir, $szFName, $szExt ; Locate the directory we are going to preserve $szFName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "MA_LPC_RUNTIME") MsgBox(0,"FolderName", $szFName, 2) ; Locate the root directory to start enumerating from. $DataPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "Installed Path") ; Get list of directories $DirList = _FileListToArray($DataPath, "lpc*",2) _ArrayDisplay($DirList,"All folders") ; Determine array location of directory to preserve $SaveDir = _ArraySearch($DirList, $szFName, 0, 0, 0, 1); partial match flag set _ArrayDisplay($SaveDir,"Folder to save") ; Remove target directory from array _ArrayDelete($DirList, $SaveDir) _ArrayDisplay($DirList,"Directories flagged for deletion")The code you pasted is great, and currently the regread to "$szFName = "MA_LPC_RUNTIME")", pulls the entire path. I'm not clear if I need the entire path, or don't need the path. I'm having problems sorting out the logic I need, to effectively preserve one folder, and delete all the others that begin with LPC. The problem with the code right now, is that the array contains all of the folders, including the one I'd like to preserve. (I'm assuming i'll use the resulting array, to form up some code to delete the folders contained in the array) Here is my current diagnostic code, and I can't get the _ArraySearch line, to display any data... could that be hanging us up?
-
#Include <File.au3> #Include <Array.au3> Global $szDrive, $szDir, $szFName, $szExt ; Locate the root directory to start enumerating from. $DataPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "Installed Path") $DirList = _FileListToArray($DataPath, "lpc*",2) _ArrayDelete($DirList, $szFName) _ArrayDisplay($DirList,"All folders") ; Locate the directory we are going to preserve $gooddir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "MA_LPC_RUNTIME") $path2 = _PathSplit($gooddir, $szDrive, $szDir, $szFName, $szExt) ;_ArrayToString($gooddir) _ArrayDisplay($path2,"Demo _PathSplit()") Ok, I have made some modest progress, but am now stuck on how to pull out the data from an array, and set it aside. I'm not sure if I need to write it to clipboard, or assign it to a variable. With the code above, I have two arrays that contain the data I want. I basically need to delete the directory found as szFName in array $gooddir, from array $DirList. Anyone able to get me back on track?
-
So here is what I have so far, and there are a couple of things I need some help with. #Include <File.au3> #Include <Array.au3> ; Locate the root directory by which to begin reading into an array $path1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "Data Path") ; Read in directories only that match LpcRT_*, into the array. $DirList=_FileListToArray($path1 [,$sFilter = "LpcRT_********" [,$iFlag = 2]]) ; If no folders found, then something is very wrong, and the script will exit. If @Error=1 Then Exit EndIf ; Locate the name of the proper folder, that we do not want to delete. (I know that this will pull the entire path, and I need to trim it down to just the final folder name. $gooddir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\Shared Components\Framework", "MA_LPC_RUNTIME") ; Remove the name of the good folder from the array. _ArrayDelete($DirList, $gooddir) ; Deletes all folders under $path1, except for the folder named $gooddir (work in progress) DirRemove("C:\Test", 1) How can I trim the full path that will be returned from my $goodir ? ... guess I only have one question thus far - David
-
So I have a situation where I have a directory, that has several subfolders in it, like "LpcRT_XXXXXXXX" where x is a random character. One of those folders is referenced in a registry key, and must remain on the system, while I need to delete all the others. I figure I can locate the necessary folder, move it elsewhere, delete all the other folders, and then move that needed folder back again. I've found some example scripts that almost get close, but most are using the FilesToArray, and I feel like I need something like FoldersToArray... knowing that doesn't exist, I'm wondering if anyone might have some ideas about how to solve this problem. - David
-
Thanks Stefan, I've always bragged, in the past, about being able to get anything out of google, however, the search on this forum wasn't giving it up without a fight. I searched high and low, without finding anything, prior to posted. ( I too hate people that don't help themselves ) I'll try harder next time. And thank you very much for your code, I'll put it to good use. - David
-
Does anyone have code already built, that will search all user profiles on a Windows system, and delete a certain file? (extend.dat) I'm new to autoit, and surfing the help file to get some ideas, but it doesn't seem to be as easy as I was hoping, unless I've missed a function somewhere. Any help is much appreciated, - David
-
I tried the example from ProgAndy first, and it's working great. So thanks to the both of you for taking the time to help out.
-
right, because when you export from regedit, it converts to hex, yes? I guess that's where I'm stuck, I haven't found a way to get the data from hex to binary. but also, I've read that Autoit does some if this type of conversion automatically... so do I even need to convert first? Trying those examples now... thanks guys,
-
Can I add on a quick question related to this situation? I've tried exporting a binary registry key And then try to do a RegWrite on the same data: Once imported via my au script, the registry data is not the same as I exported: I know I'm bumping up against a conversion problem, either with regedit, or AU, but despite having tried the data several ways (removing commas, etc), i can't get it to work. any ideas are very much appreciated, as I have a project I have to get out the door today, and this is hanging me up thanks all, - David
-
Thanks sir, it's working great from what I can tell. I'll try to learn what each function of this script does - David
-
Rock on, thanks man!
-
Been reading up on Dim and Ubound, and are you saying I just need to change "Global $notesini, $profilelist" to "Dim $notesini, $profilelist" ? I doubt it's that simple
-
compiled it, and I'm seeing an error "Line -1:" "Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded" sorry to be such a dumb ass on this stuff.
-
Sorry, reading your last post now Let me digest it a bit.
-
With this new code, I guess it would be best to remove my previous two hard coded paths, and just search them out with your latest code. I'm still trying to figure out how to get your code into the previous script...
-
would I simply add a third path entry to my existing code? ;1st notes.ini path $notespath1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Lotus\Notes", "Path") & "\notes.ini" ;2nd notes.ini path $notespath2 = @AppDataDir & "\Lotus\Notes\Data" & "\notes.ini" ;3rd notes.ini path $notespath2 = $output Or something similar?
-
I have an additional challenge for you guys I've found that my deployment mechanism runs as the System account, and therefore the script doesn't have access to all the users profiles. ;2nd notes.ini path $notespath2 = @AppDataDir & "\Lotus\Notes\Data" & "\notes.ini" Is there a way I could search for most any notes.ini on the system, and make the necessary changes from there? Or at least search through all user profiles? Is this possible? I really appreciate any thoughts you might have. - David
-
;-)) Stefan Looks fantastic, I'll compile it and make sure it works out. But thank you VERY much for taking the time to update it. Also, thanks for commenting the code, it really helps me learn the functions better. Do you have an archive of scripts you have created in the past? I ask, because for stuff like this, I learn best by stepping through code, to see how it all works. either way, thanks a million. Update - It works like a charm. And, should I need to add another location of the notes.ini, it would be easy. - David