none
How can I know if a NAS is connected to my Home Network? RRS feed

  • Question

  • Hi Scripting Guys! I have a Scheduled Task that wakes every my PC on my Home Network overnight and runs an Excel macro workbook.  The workbook resides on a NAS which is connected to my Home Network.  Sometimes, when a PC wakes, it is slow to (re)connect to the network.  In that case, the workbook cannot be opened and the script dies.  I'm thinking that, rather than immediately attempt to hit the NAS, I could run a local copy of a VB script which would check network/NAS availability and, if needed, wait a short period for the network connections to be reestablished and, once that happens, the script could kick off the Excel macro workbook.

    I suppose I could just repeatedly attempt to open the Excel file and give up after a minute or so of repeated failures.  But that seems pretty lame.  ;-) 

    So how do I determine if the NAS (or if the Excel file I'm trying to open) is reachable before I attempt to open the Excel macro workbook? 

    Thanks,

    cw

    Thursday, September 10, 2015 5:48 PM

Answers

  • You're welcome.

    The good news is that the two languages can happily coexist. I have plenty of PowerShell scripts that kick off VBScripts and vice versa in my environment. I'm slowly replacing all the VBScripts, but the old saying of 'if it ain't broke, don't fix it' holds true when you're short on time.


    • Marked as answer by CharlieWright Friday, October 9, 2015 3:25 PM
    Wednesday, October 7, 2015 7:37 PM

All replies

  • Hi,

    Here's a PowerShell method you could use:

    http://ss64.com/ps/test-path.html


    Thursday, September 10, 2015 5:53 PM
  • Mike: Thanks.  I really need to learn how to use PowerShell.  But I have so much infrastructure that uses VB script that I can't make the jump just yet.  :-(

    cw

    Wednesday, October 7, 2015 7:34 PM
  • You're welcome.

    The good news is that the two languages can happily coexist. I have plenty of PowerShell scripts that kick off VBScripts and vice versa in my environment. I'm slowly replacing all the VBScripts, but the old saying of 'if it ain't broke, don't fix it' holds true when you're short on time.


    • Marked as answer by CharlieWright Friday, October 9, 2015 3:25 PM
    Wednesday, October 7, 2015 7:37 PM
  • Thanks.  I guess I knew that, but was ignoring it in order to avoid the work of making the transition.  I guess I'll have to drag myself, kicking and screaming, into the PowerShell world.  ;-)
    Friday, October 9, 2015 3:27 PM
  • Thanks.  I guess I knew that, but was ignoring it in order to avoid the work of making the transition.  I guess I'll have to drag myself, kicking and screaming, into the PowerShell world.  ;-)

    I promise that it's worth your time. PowerShell is downright awesome and a 1000x times easier when you compare it to VBScript.

    There's good resources here for getting your feet wet:

    http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx


    Friday, October 9, 2015 4:44 PM