Attn: VB Coders - Folderexists method timeout?

Discussion in 'Software' started by Mada_Milty, Oct 26, 2006.

  1. Mada_Milty

    Mada_Milty MajorGeek

    Hi All,

    I'm currently making a script that checks for the existence of a folder on each computer account in our domain. I'm using this bit of code:

    Code:
    For Each o_leaf In o_office
         v_source = "\\" & Mid(o_leaf.name, 4) & "\CGL"
         If o_filesys.folderexists (v_source) = True Then
              MsgBox v_source & " found!"
         ElseIf o_filesys.folderexists (v_source) = False Then
              MsgBox v_source & " does not exist or is currently unreachable."
         End If
    Next
    where o_office is an object bound to an OU containing computer accounts in our domain. I have two questions for anyone who can answer.

    1. Notice that I'm using the function Mid(o_leaf.name, 4). This is because o_leaf.name returns a distinguished name like CN=XXXXXX. Is there another property of a computer account object that will return JUST the computer name, and NOT the object type?

    2. When I use the folderexists method on a computer that doesn't exist, or isn't turned on, the script has to wait for this to timeout before continuing execution. As you can imagine, this adds quite a bit to the running time of the script. Is there any way I can change the timeout setting to a lower value?

    Since I have a working method for the first question, it is lower on the priority scale than the second question. Thanks in advance to anyone who offers their thoughts.

    Regards,

    Milty
     
  2. matt.chugg

    matt.chugg MajorGeek

    I am working on something vaugly similair (take my existing software and an AD and put 2 and 2 together ;) ) I found the best thing to do was to ping the computer first. Check its online and then if it is query it.

    I actually invoke the windows ping command with my own timeout using a class I found somewhere.
     
  3. Mada_Milty

    Mada_Milty MajorGeek

    Okay - that makes good sense.

    I assume you output the ping request to text, and use vb to analyze that?

    I kinda like this idea, but I just realized that alot of our actual machines have firewalls configured to NOT respond to ping requests... damn.
     
  4. matt.chugg

    matt.chugg MajorGeek

    Well its .net but you can pipe the output to the program without having to write to text...

    HOWEVER

    I had a dig in my folder of random vb6 stuff thats useful and found a class module for pinging.

    NOTE: I didn't write this, read the comments, you may need to credit someone...
     

    Attached Files:


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds