Jump to content

OneJeremias

Active Members
  • Posts

    24
  • Joined

  • Last visited

OneJeremias's Achievements

  1. Finally getting back to this project after a long hiatus. Just as an FYI to anyone else who may be having this problem: Jos was spot on in his help above. My host name had an additional space at the end of the string that I didn't see until I tried to append my domain name to the end and outputted to a msgbox. Doh. :-) Thanks Jos!
  2. Hmm, not sure what the deal is then. I'll play around with it a little more and see what's up. Thanks.
  3. That seems to break it completely. To clarify what I changed: Old method (worked within my own subnet): Ping("01055w7") where 01055w7 is the host name of the computer to ping. Your method (@ error now set to 4 every time): Ping("01055w7.domain.com") Full disclosure: I am passing Ping a string in this manner: Ping(StringTrimLeft("01055w7.domain.com", 2), because I have a function that returns the computer name. The change I made was to that function, which now appends .domain.com to the end. As I said though, Ping works if I do NOT append .domain.com to the end. Update: I was just doing some more playing around, and noticed that today the @error is coming back as 0. I checked what Ping is returning, and it is also 0. I thought @error was supposed to be set to non-zero if Ping returned 0?
  4. $pingtest = Ping(StringTrimLeft($hosts, 2)) MsgBox(0, "show error", @error) If $pingtest <> 0 Then Run("explorer.exe /root," & $hosts & "\c$") Else MsgBox(0, "Computer unavailable", "Unable to connect to the computer you requested. The computer may be off...") EndIf I'm not sure how to upload an image (image button just asks for a link), but the command line is as follows: C:WindowsSystem32>ping 01055w7 Pinging 01055w7.domain.com [10.21.31.124] with 32 bytes of data: Reply from 10.21.31.124: bytes=32 time=1ms TTL=127 Reply from 10.21.31.124: bytes=32 time=3ms TTL=127 Reply from 10.21.31.124: bytes=32 time=1ms TTL=127 Reply from 10.21.31.124: bytes=32 time=1ms TTL=127 Ping statistics for 10.21.31.124: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 3ms, Average = 1ms
  5. @error contains 4, which according to the documentation is the least helpful possibility: "other errors"
  6. I'm working with the built-in Ping function, and it seems to ping computers on my own subnet just fine, but it fails to ping any computer on a different subnet. I can ping those same computers from the command line just fine. Is this by design, and is there anything I can do about it? Thanks!
  7. Ok that makes sense. Thank you for the help! On to the next piece of this project which will inevitably send me back here :-)
  8. Ok great, that worked! However, I'm not entirely clear on why. When I switched to using a native function, what does that mean in terms of what GUIGetMsg is receiving? It is not getting a control handle anymore? I believe I have a [very] incomplete understanding of how all the pieces work together, so please excuse me if my code indicates that I'm farther along than I actually am :-)
  9. Might someone take a look at my code and tell me why it's not sorting? Nothing happens when I click the column header, although I do believe I have implemented BrewMan's code correctly. I'm wondering if it has anything to do with the data I pull from the excel spreadsheet...can anything from that process cause problems with sorting this way? Thanks for any help: #include <Excel.au3> #include <Array.au3> #include <GuiImageList.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Global $fSortSense = False ; Set initial ascending sort $oExcel = _ExcelBookOpen("c:\users.xls", @SW_HIDE) _ExcelSheetActivate($oExcel, "Sheet1") $result = _ExcelReadSheetToArray($oExcel) _ExcelBookClose($oExcel) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 986, 581, 192, 124) $hListView = _GUICtrlListView_Create($Form1, "Computer name|User|Dept|Location", 20, 15, 500, 170) ; create the list view _GUICtrlListView_SetColumnWidth($hListView, 0, 100) _GUICtrlListView_SetColumnWidth($hListView, 1, 175) _GUICtrlListView_SetColumnWidth($hListView, 2, 130) _GUICtrlListView_SetColumnWidth($hListView, 4, 50) _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT ) ; selecting one item highlights entire row $Button1 = GUICtrlCreateButton("Ninite", 525, 56, 89, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### for $i = 0 to UBound($result,1) - 3 _GUICtrlListView_AddItem($hListView, $result[$i + 2][1], 0) _GUICtrlListView_AddSubItem ($hListView, $i, $result[$i + 2][2], 1) _GUICtrlListView_AddSubItem ($hListView, $i, $result[$i + 2][3], 2) _GUICtrlListView_AddSubItem ($hListView, $i, $result[$i + 2][4], 3) ;Sleep(2000) Next GUISetState() Global $iCol While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hListView $iCol = GUICtrlGetState($hListView) _GUICtrlListView_SimpleSort($hListView, $fSortSense, $iCol) EndSwitch WEnd
  10. Thanks JLogan, I figured that was probably the case after I took a closer look at it. I'll keep that in mind for next time!
  11. Nevermind, I cut the code all the way down to the For loop by itself, and discovered I had missed the "$" in front of the "i". Wow. Nothing like wasting my own darn time. As an FYI, I am aware of a few other problems with the above code, working them out now, and may post later.
  12. Hello all, I'm trying to write an error-handling function that will write to a log file all of the steps that were not completed due to something going wrong. The function accepts a string called $step and a variable called $compFlag that holds the number of steps that have already been completed. I then want to use a For loop to log the uncompleted steps. This is the first time I've used a For loop with AutoIT, and also the first time I've used an array, so I'm not quite sure where I'm going wrong here. The syntax error label shows up right between the For i = $compFlag line and the $step line. Can someone please point me to the fail point? Func ErrChk($step, $compFlag) Dim $theSteps[7] $theSteps[0] = "Enable hidden admin account and set password" $theSteps[1] = "Disable Windows update service" $theSteps[2] = "Enable Remote Registry service" $theSteps[3] = "Enable Remote Desktop connections" $theSteps[4] = "Configure power settings" $theSteps[5] = "Check Device Manager for problems" $theSteps[6] = "Display IP address" _FileWriteLog($thelog, "Failed to " & $step & " Script will terminate.") _FileWriteLog($thelog, "Steps not completed:" & @CRLF & _ For i = $compFlag to 6 Step +1 If i < 6 then $theSteps[i] & @CRLF & Else $theSteps[i] & @CRLF Next ) FileClose($thelog) Exit EndFunc Updated code to include the right variable names, sorry!
  13. Ok, so it turned out that building my own GUI was not that difficult, so I now have a working, compiled script that accepts checkboxes for the software to install and runs through the installations as it should. Thanks again! Somehow I missed the reminder by JLogan to mark this as solved so I am doing that now.
  14. Anyone willing to jump in and answer this?
  15. I hope this is not considered hijacking of a thread, but I'm hoping that Robjong or someone else can clarify something about Robjong's solution. I understand that the OP's main goal was to balance security with convenience, and that in his case he preferred to lean further on convenience, not requiring user intervention, in which case requesting a user to enter a password was undesirable. However, I believe that in my company's case, we would not have a problem with requesting user input at the start of a script. My question is this: Am I correct in believing that requesting a user to enter an actual password, and storing that input into a variable for the duration of the script, is not secure? When Robjong said that "the password is stored in memory", was he referring to the encrypted string stored in the script itself, or was it that once the password is decrypted to cleartext, it resides in memory and is accessible during script execution (or possibly after) by anyone with enough skill and malicious intent to find it? I apologize if these should be obvious; I am fairly new to AutoIT and only have a general background in programming, no real expertise in any language. Thank you in advance!
×
×
  • Create New...