Jump to content

Checking to see whether an external drive is attached


Recommended Posts

Guest Andrew Williams
Posted

I have a client who uses an external drive for backup purposes. The backup is

scheduled to run every night and backup to drive E: which is the external USB

drive.

 

The problem is that he alternates between 2 identical drives and keeps one

in a safe in case of disaster. When he unplugs the USB cable and power cable

on one drive and swaps it for the other drive, sometimes Windows does not

recognise the drive and the backup fails. 80% of the time, the drive is

mounted and the backup works. I'm looking for much better availability than

this though.

 

My question is, is there a way of notifying the user that the drive is not

attached properly? I want a 'ping' for checking hard drive availability! So

if the drive was swapped and could not be mounted properly, a beep would

sound (or an e-mail sent) to notify user.

 

Any help with this would be great. Thanks.

  • Replies 2
  • Created
  • Last Reply

Popular Days

Guest Nick Payne
Posted

Re: Checking to see whether an external drive is attached

 

Have a look at the batch IF EXIST and ERRORLEVEL commands.

 

"Andrew Williams" <AndrewWilliams@discussions.microsoft.com> wrote in

message news:7460E4AE-F109-47E7-9400-6B7B531E2C94@microsoft.com...

>I have a client who uses an external drive for backup purposes. The backup

>is

> scheduled to run every night and backup to drive E: which is the external

> USB

> drive.

>

> The problem is that he alternates between 2 identical drives and keeps one

> in a safe in case of disaster. When he unplugs the USB cable and power

> cable

> on one drive and swaps it for the other drive, sometimes Windows does not

> recognise the drive and the backup fails. 80% of the time, the drive is

> mounted and the backup works. I'm looking for much better availability

> than

> this though.

>

> My question is, is there a way of notifying the user that the drive is not

> attached properly? I want a 'ping' for checking hard drive availability!

> So

> if the drive was swapped and could not be mounted properly, a beep would

> sound (or an e-mail sent) to notify user.

>

> Any help with this would be great. Thanks.

Guest Pegasus \(MVP\)
Posted

Re: Checking to see whether an external drive is attached

 

 

"Andrew Williams" <AndrewWilliams@discussions.microsoft.com> wrote in

message news:7460E4AE-F109-47E7-9400-6B7B531E2C94@microsoft.com...

>I have a client who uses an external drive for backup purposes. The backup

>is

> scheduled to run every night and backup to drive E: which is the external

> USB

> drive.

>

> The problem is that he alternates between 2 identical drives and keeps one

> in a safe in case of disaster. When he unplugs the USB cable and power

> cable

> on one drive and swaps it for the other drive, sometimes Windows does not

> recognise the drive and the backup fails. 80% of the time, the drive is

> mounted and the backup works. I'm looking for much better availability

> than

> this though.

>

> My question is, is there a way of notifying the user that the drive is not

> attached properly? I want a 'ping' for checking hard drive availability!

> So

> if the drive was swapped and could not be mounted properly, a beep would

> sound (or an e-mail sent) to notify user.

>

> Any help with this would be great. Thanks.

 

Try this:

 

@echo off

:Again

dir Q: 1>nul 2>nul

if ErrorLevel 1 (

net send %ComputerName% "%time:~0,5%: Please connect the USB backup disk!"

ping localhost -n 600 > nul

)

{Your backup commands go here}

 

Make sure that the Messenger service is active on the client's PC.


×
×
  • Create New...