Ghost21
Active Members-
Posts
387 -
Joined
-
Last visited
About Ghost21
- Birthday March 2
Profile Information
-
Location
Vancouver Island
Ghost21's Achievements
Universalist (7/7)
0
Reputation
-
Water and JCHD, With both of your recommendations has resulted in a 200MB file to be completed in under 2mins.. This will be a great time saver of like weeks of manual labor.
-
Thank you both for the insight. In changing the $SIF to open the file and append I went from 3hrs of run time on a 200MB file to 2.75mins of run time.. I appreciate all the help.
-
Well here is the issue I have written a conversion tool for SubinACL. Essentially what I'm doing is exporting all them groups/Members then reading the export file doing some filtering etc. and writing the file back to the clean file. Now in doing this some of the file exports are 1.5GB in size and take many hours to run. Can someone please look at the code and see if you can find anything glaring that I could clean up to improve performance. #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <File.au3> #include <String.au3> Global $LS = InputBox("Local Server Name", "What server are you migrating from local groups:" & @CRLF & "eg. contosofilesvr", "") If $LS = "" Then Exit Global $Domain = InputBox("Domain Name", "What domain are you migrating permissions to:" & @CRLF & "eg. contoso", "") If $Domain = "" Then Exit Global $SEF = FileOpenDialog("SubinACL Export File", @ScriptDir, "Text files (*.txt)", "", "") If FileExists($SEF) Then MsgBox(0, "SubinACL Export File.", "Confirmed. " & $SEF) Else MsgBox(0, "SubinACL Export File is Missing or not created.", "Please correct this issue. Exiting") Exit EndIf Global $SIF = FileOpenDialog("Subinacl Import File", @ScriptDir, "Text files (*.txt)", "", "") If FileExists($SIF) Then MsgBox(0, "SubinACL Import File.", "Confirmed. " & $SIF) Else MsgBox(0, "SubinACL Import File is missing or not created.", "Please correct this issue. Exiting") Exit EndIf Global Const $MF = @ScriptDir & "\" & "Members.csv" If FileExists($MF) Then MsgBox(0, "Local Groups Export File.", "Confirmed. " & $MF) Else MsgBox(0, "Local Groups Export File is missing or not created.", "Please correct this issue. Exiting") Exit EndIf $timer = TimerInit() FindACL() ConsoleWrite(TimerDiff($timer) & @CRLF) Func FindACL() $file = FileOpen($SEF, 512) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $SplitString = StringSplit($line, " ") For $i = 1 To $SplitString[0] $SearchString = StringSplit($SplitString[$i], "\") For $k = 1 To $SearchString[0] If $SearchString[$k] = "=" & $LS Then $lgss = $SearchString[$k + 1] LocalGroups($lgss, $line) EndIf Next Next If StringLeft($line, 9) <> "/pace =S-" Then If StringLeft($line, 15) <> "/pace =everyone" Then If StringLeft($line, 20) <> "/pace =builtin\users" Then If StringLeft($line, 16) <> "/pace =" & $LS Then WriteSameData($line) EndIf EndIf EndIf EndIf WEnd FileClose($file) EndFunc ;==>FindACL Func LocalGroups($lgss, $line) $aInput = "" _FileReadToArray($MF, $aInput) For $i = 2 To UBound($aInput) - 1 $output = StringSplit($aInput[$i], ",") $LG = StringTrimRight(StringTrimLeft($output[2], 1), 1) If $LG = $lgss Then $M = StringTrimRight(StringTrimLeft($output[3], 1), 1) $M = StringSplit($M, ";") For $C = 1 To $M[0] $FM = $M[$C] If $FM <> "" Then If StringLeft($FM, 9) <> "S-1-5-21-" Then $newdata = StringReplace($line, "=" & $LS & "\" & $lgss, "=" & $Domain & "\" & $FM) WriteData($newdata) EndIf EndIf Next EndIf Next EndFunc ;==>LocalGroups Func WriteData($newdata) FileWriteLine($SIF, $newdata) EndFunc ;==>WriteData Func WriteSameData($line) FileWriteLine($SIF, $line) EndFunc ;==>WriteSameData
-
Extracting Profiles that are Listview Checked
Ghost21 replied to Ghost21's topic in AutoIt General Help and Support
I don't know what I was smokin on that one but yours is a sexy thing.. Thank you -
First off I know I have a whole bunch of includes that don't pertain to the script... Its just a testing window I use.. I'm trying to get the users names that appear to show up so then I can move the profiles. But no matter what checkbox I select it doesn't show me the right name back.. ???????????? Help Please!! #include <AD.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <Constants.au3> #include <EditConstants.au3> #include <GUIConstants.au3> #include <GuiConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <GuiToolbar.au3> #include <GuiTreeView.au3> #include <GuiStatusBar.au3> #include <ListViewConstants.au3> #include <Math.au3> #include <Misc.au3> #include <NetShare.au3> #include <Process.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <Timers.au3> #include <TreeViewConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <Mysql.au3> #include <string.au3> #include <GDIPlus.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 700, 438, 192, 124) $Button1 = GUICtrlCreateButton("Remove from Discovery", 510, 8, 169, 25) $ListView1 = GUICtrlCreateListView("User|Sid", 8, 8, 480, 425, BitOR($GUI_SS_DEFAULT_LISTVIEW, $LVS_SORTASCENDING), BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_TRACKSELECT)) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 170) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 378) ;_GUICtrlListView_AddItem( $xx = "" $sids = "" $Checkbox = "" $Userandsid = "" $text = "" $Column = "" $Columns = "" $sArray = "" For $i = 1 To 100 $var = RegEnumKey("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $i) If @error <> 0 Then ExitLoop $sids = $var & "," & $sids Next $sids = StringSplit(StringTrimRight($sids, 1), ",") For $x = $sids[0] To 1 Step -1 $userprofilepath = RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList" & $sids[$x], "ProfileImagePath") $user = StringSplit($userprofilepath, "") $usernumber = $user[0] $Userandsid = $user[$usernumber] & "|" & $sids[$x] & "," & $Userandsid GUICtrlCreateListViewItem($user[$usernumber] & "|" & $sids[$x], $ListView1) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $state = '' For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1 If _GUICtrlListView_GetItemChecked($ListView1, $i) Then $state = $state & ',' & $i EndIf Next $State = StringTrimLeft($state,1) $statesplit = StringSplit($state, ",") For $d = 1 To $statesplit[0] If $statesplit[$d] <> '' Then $number = StringStripWS($statesplit[$d], 15) msgbox(0,"",$number) $item = _GUICtrlListView_GetItemSelected($ListView1, $number) $textofitem = _GUICtrlListView_GetItemText($ListView1, $item) MsgBox(0, $d, $textofitem) EndIf $number = "" Next EndSwitch WEnd
-
Hyper-V & Filecopy Permissions
Ghost21 replied to Ghost21's topic in AutoIt General Help and Support
I am the Domain admin. Thats whats driving me crazy why can't I shut it down with ther permissions I have and Copy them to the location.. Very frustrating. -
I have run into a strange problem maybe its the sleepless nights that are clouding my mind.. Starting and Shutting down Hyper-V VM's - Need Local Administrator Rights but if I use those I can't file copy the shutdown vm to a remote location as it doesn't have permissions.. I'm guessing.. I did think that I could allow everyone to read / write etc. but that isn't good practice and I can't add the local admin to the remote pc ?? Can I add permissions to filecopy or somethign like that ? Any other Ideas are accepted as well
-
Hello everyone Just wondering if anyone has ventured into Backing up Hyper-V Vm machines. I'm wanting to shutdown the VM.. Check its status via Ping or a response from the Hyper-V manager that its fully off and then do a copy to a network drive. Finish the copy and start the machine back up.. Now the status, Shutdown and Startup is my main challenge. Any susgesstions ?? Trying to keep it as simple as possible. I will add some loggin , email functionality etc.. Dim $WMIService Dim $VMList Dim $VMGuid Dim $ShutdownList Dim $Result $VMName = "VM2011" _ShutdownVM($VMName) Func _ShutdownVM($VMName) $WMIService = ObjGet("winmgmts:\\.\root\virtualization") $VMList = $WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem WHERE ElementName='" & $VMName & "'") $VMGuid = $VMList.ItemIndex(0).Name MsgBox(0, "VM GUID", $VMGuid) $ShutdownList = $WMIService.ExecQuery("SELECT * FROM Msvm_ShutdownComponent WHERE SystemName='" & $VMGuid & "'") $Result = $ShutdownList.ItemIndex(0).InitiateShutdown(True, "Because I said so") EndFunc ;==>_ShutdownVM Func _StartupVM($VMName) $WMIService = ObjGet("winmgmts:\\.\root\virtualization") $VMList = $WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem WHERE ElementName='" & $VMName & "'") ; Request a state change on the first VM that is returned' 2 = start, 3 = stop and 32769 = save state $VMList.ItemIndex(0).RequestStateChange(2) EndFunc ;==>_StartupVM
-
I am the Network Admin
-
I'm trying to get results as fast and accurate as possibe. Currentley pinging one pc at a time and retrieving info is great but if I could ping 1000 pcs in like 10seconds then we got some good lovin. I know Autoit Doesn't do MultiTreading but there has got to be a way around this fact.. Always lots a ways to shave a cat..
-
Well HOLLY ....... ....... that worked.... I tried a msgbox , I tried a inputbox .. it looked perfect never showed a thing.. Finally someone thinking way outside the box.. Thank you Thank you..
-
When I'm trying to ping a device in my script I keep getting a error code #4 from ping. Even though in dos it pings fine.. What would make the ping in the script stop working.. If I start a tottally new script it works fine.. Func _RA2011_UpdatedRecords() _dbOpen() $Recordset.Open("Needtoupdate", $Connection) With $Recordset While Not .EOF $device = .Fields("Device").Value $var = Ping($device, 1500) If $var Then; also possible: If @error = 0 Then ... MsgBox(0, "Status", "Online, roundtrip was:" & $var) Else MsgBox(0, "Status", "An error occured with number: " & @error) EndIf MsgBox(0, "info", "Device: " & $device & " IP: " & $IP & " Ping: " & $var) _update_devices($Founddomain, $device, $Ping) If WinActive("RA2012 'Remotely Assited'", "") Then GUICtrlSetData($Edit, "Activity found on pc. Stopping update." & @CRLF, 1) ExitLoop EndIf .MoveNext WEnd EndWith EndFunc ;==>_RA2011_UpdatedRecords This is so freaking simple what in Autoit would cause it to stop. If I use the $device that comes back from a query it returns the device name perfect and sets it as $device which works. But if I use that in the PING line it doesn't... If I don't use the $device at all or any other variable in there and just type it in like "pc001" then ping works again ???? WTF? HELP PLEASE!!!
-
MsgBox(0,"info", "Device: " & $device) <-- I get the device name here no problem $var = Ping($device,250) If $var Then; also possible: If @error = 0 Then ... Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","An error occured with number: " & @error) <--- This message box shows up with a error code 4 even though if I ping it external from autoit it pings no problem.. EndIf PLEASE add this to the bug listing... I changed the $device to just the device name cac713094x and it responded correctley ???? ANYONE ?? SOMEONE ?? HELLO ?? HELp!
-
whats the ping include ? This has got to be a issue with autoit directley ... where are some MVP's that can figure this one out..
-
The bigger question is why would a simple $ping = Ping($device,500) not work and a $ping = Ping("pc001",500) work no problem..