?
Solved

Checking for insertion of Backup Tapes by script

Posted on 2003-03-06
13
Medium Priority
?
270 Views
Last Modified: 2011-09-20
Howdy Guys and Girls

I have been hunting around the web for a day to try and find a script to check if a tape is inserted into the tape drive or not. We are unfortunately running Windows 2000 backup but with SDX-420C backup units that take AIT 35GB tapes. Basically we would like to eject the tapes on remote sites after they back up. At say 3pm the next day, run a script to see if there is a tape inserted. If not it would send a NET SEND message to the person responsible, their manager and us. The latter parts are fine to do. I am unaware if the script would be running any backup commands to test for the tape or would you check somewhere in the registry. Any help on where to get started would be magnificent.
Cheers
Creany
0
Comment
Question by:creany
  • 7
  • 6
13 Comments
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8085010
Well here is an API

The GetDriveType function determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.

UINT GetDriveType(

    LPCTSTR lpRootPathName      // address of root path
   );    
 

Parameters

lpRootPathName

Points to a null-terminated string that specifies the root directory of the disk to return information about. If lpRootPathName is NULL, the function uses the root of the current directory.

 

Return Values

The return value specifies the type of drive. It can be one of the following values:

Value     Meaning
0     The drive type cannot be determined.
1     The root directory does not exist.
DRIVE_REMOVABLE     The drive can be removed from the drive.
DRIVE_FIXED     The disk cannot be removed from the drive.
DRIVE_REMOTE     The drive is a remote (network) drive.
DRIVE_CDROM     The drive is a CD-ROM drive.
DRIVE_RAMDISK     The drive is a RAM disk.
0
 
LVL 44

Accepted Solution

by:
CrazyOne earned 400 total points
ID: 8085060
Here is a function I put together using Delphi.

function FindDrive(WhichType: Integer; var sPathandFile: string): string;
//DRIVE_REMOVABLE, DRIVE_FIXED, DRIVE_REMOTE, DRIVE_CDROM, DRIVE_RAMDISK
var
 i: Integer;
 sDrive: string[3];
 
const
     sDrv: array[0..6] of string = ('d:\', 'e:\', 'f:\', 'g:\', 'h:\','i:\', 'Nil');
 
begin

 for i := Low(sDrv) to High(sDrv) do begin
        Result := sDrv[i];
      if GetDriveType(PChar(sDrv[i])) = WhichType then Break;
 end;

 if Trim(Result) = 'Nil' then
      sPathandFile := ''
 else
      sPathandFile := Result + Trim(sPathandFile);
 

end;
0
 

Author Comment

by:creany
ID: 8085143
Crazy One

Thank you for getting back to me on this. While i do alright on the coding front, you are definitely testing my working knowledge with this new area!!

The key thing is the start with GetDriveType Function to kick start what i need. Have you written code like this with Kixtart (being cheeky here)?

Thanks for the response
Cheers
Creany
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:creany
ID: 8085163
While a little overwhelmed with the type of coding, i believe he gave me an example and an area to start looking for the script i need. that is what i asked for and i recieved it.
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8085227
Yeah my VB is really rusty. I use Delphi and haven't done any VB for about 2 years now.
0
 

Author Comment

by:creany
ID: 8085255
Crazy One

What if the backup unit does not have a drive letter associated with it? Zip drives do you give you drive letters but most storage devices tend not to?
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8085310
Hmmm does it have a name rather then a drive letter?
0
 

Author Comment

by:creany
ID: 8085326
Crazy One

What if the backup unit does not have a drive letter associated with it? Zip drives do you give you drive letters but most storage devices tend not to?
0
 

Author Comment

by:creany
ID: 8085825
Crazy One

What if the backup unit does not have a drive letter associated with it? Zip drives do you give you drive letters but most storage devices tend not to?
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8085842
Hmmm does it have a name rather then a drive letter?
0
 

Author Comment

by:creany
ID: 8085854
Yes the tape has a name "MON" for example and the media library has the name "Backup".

Thanks for this. I have been playing around with rsm.exe to return some information. Article http://support.microsoft.com/?kbid=239892. Still it is not returning the answers i require. Any help would be great.
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8085906
Hmm at this time the only tape device I have access to is at a office that I only visit once a month. So I don't have a testing enviroment to work with. But let me take some time to look at the rsm and see what I can come up with. Leave a comment from time to time to remind me to let you know if found something I think will work. :>)
0
 

Author Comment

by:creany
ID: 8085919
i haven't got this to work correctly yet but the following article is another sign in the right direction
http://www.jsiinc.com/SUBJ/tip4500/rh4540.htm
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This installment of Make It Better gives Media Temple customers the latest news, plugins, and tutorials to make their VPS hosting experience that much smoother.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question