thank you... but that script only sees drives already connected to the operating system... it doesn't rescan the scsi bus as you're creating additional physicaldrives... which is what i'm doing. i finally figured out how to send commands to microsoft diskpart and capture the response so i thought i'd post the final script for future reference. please keep in mind i'm a novice... so try not to laugh too hard at my syntax. i'd be very interested if anyone wants to critique my code and provide feedback.
#!c:/Perl/bin/perl.exe -w use strict ; use warnings ; use English ; &send_diskpart_command ("rescan"); &send_diskpart_command ("list disk"); sub send_diskpart_command { my $debug = 0; my ($diskpart_command) = @_; if ($diskpart_command eq "") { print "\n***No command passed to the send_diskpart_comman +d subroutine***\n" ; return ; } # diskpart.exe requires a textfile input # deleting the textfile if it already exists then creating a new textf +ile with the diskpart_command my $file = "diskpart_cmd.txt"; if ($debug) { print "\nSearching for an existing copy of the text file +$file."; if (unlink($file) == 1) { print "\nThe file '$file' was found and deleted."; } else { print "\nThe file '$file' was not detected."; } } open (DPART, ">>$file") || die ("Could not open file. $!"); print DPART ($diskpart_command); if ( $debug ) { print "\nCreated file '$file'." ; } close (DPART); if ( $debug ) { print "\n\nSending $diskpart_command." ; } open ( FH , "diskpart /s diskpart_cmd.txt|" ) || die ("Could not + open file. $!"); print "\nCommand '$diskpart_command' sent to the host.\n"; if ( $debug ) { print "\n"; } my @inFile = <FH> ; # read all at once into array foreach (@inFile) { if ( $debug ) { print $_."\t"; } } close (FH); if ($debug) # delete the textfile { if (unlink($file) == 1) { print "\n\nThe file '$file' was deleted successfully.\ +n"; } else { print "\n\nThe file '$file' was not deleted.\n"; } } }

In reply to Re^2: diskpart.exe and perl (s/and/in/) by neo1491
in thread diskpart.exe and perl by neo1491

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.