Home All Groups Group Topic Archive Search About

Scripting the use of Diskpart?

Author
17 Oct 2006 6:45 PM
Corey_in_Canada
Is it possible to create a batch file that will reconnect a dynamic disk
through diskpart? To reconnect a dynamic disk the following commands are
necessary

diskpart
select disk X
online

That command would and does bring an offline dynamic disk back online.
However when I run that through a batch file it hangs at the following
prompt:

Diskpart>

Its almost as if external interactive commands are prohibited from running
for saftey precautions.

Is there a work around to this or can anyone give some advice.

Just FYI, I am trying to do this for an iSCSI SAN that has dynamic disks
configured on a connected server, since Microsoft's iSCSI initator does not
support dynamic disks I am looking for a work around from purchasing an
iSCSI HBA just for dyanmic disk support.

Thanks

Author
17 Oct 2006 10:01 PM
Pegasus (MVP)
Show quote Hide quote
"Corey_in_Canada" <n*@mail.here> wrote in message
news:O0Ah%23xh8GHA.2092@TK2MSFTNGP03.phx.gbl...
> Is it possible to create a batch file that will reconnect a dynamic disk
> through diskpart? To reconnect a dynamic disk the following commands are
> necessary
>
> diskpart
> select disk X
> online
>
> That command would and does bring an offline dynamic disk back online.
> However when I run that through a batch file it hangs at the following
> prompt:
>
> Diskpart>
>
> Its almost as if external interactive commands are prohibited from running
> for saftey precautions.
>
> Is there a work around to this or can anyone give some advice.
>
> Just FYI, I am trying to do this for an iSCSI SAN that has dynamic disks
> configured on a connected server, since Microsoft's iSCSI initator does
not
> support dynamic disks I am looking for a work around from purchasing an
> iSCSI HBA just for dyanmic disk support.
>
> Thanks
>
>

The standard method is to pipe the subcommands into
diskpart via a script file:

@echo off
echo  > c:\script.scr select disk X
echo >> c:\script.scr online
diskpart < c:\script.scr
Are all your drivers up to date? click for free checkup

Author
17 Oct 2006 10:26 PM
Corey_in_Canada
Hi Pegasus,

Thanks for taking the time to reply with an informative answer. Because I am
by no means a scripting guru, in your example, what does script.scr refer
to?

For instance with my very simple and basic batch file, how would I combine
that with the below example to make this work?

I tried looking up some examples but it didnt really touch on the exact
variables...maybe Im just missing the obvious though, and if so I apologize.

Thanks kindly.


Show quoteHide quote
"Pegasus (MVP)" <I.***@fly.com> wrote in message
news:eSBA%23ej8GHA.3644@TK2MSFTNGP03.phx.gbl...
>
> "Corey_in_Canada" <n*@mail.here> wrote in message
> news:O0Ah%23xh8GHA.2092@TK2MSFTNGP03.phx.gbl...
>> Is it possible to create a batch file that will reconnect a dynamic disk
>> through diskpart? To reconnect a dynamic disk the following commands are
>> necessary
>>
>> diskpart
>> select disk X
>> online
>>
>> That command would and does bring an offline dynamic disk back online.
>> However when I run that through a batch file it hangs at the following
>> prompt:
>>
>> Diskpart>
>>
>> Its almost as if external interactive commands are prohibited from
>> running
>> for saftey precautions.
>>
>> Is there a work around to this or can anyone give some advice.
>>
>> Just FYI, I am trying to do this for an iSCSI SAN that has dynamic disks
>> configured on a connected server, since Microsoft's iSCSI initator does
> not
>> support dynamic disks I am looking for a work around from purchasing an
>> iSCSI HBA just for dyanmic disk support.
>>
>> Thanks
>>
>>
>
> The standard method is to pipe the subcommands into
> diskpart via a script file:
>
> @echo off
> echo  > c:\script.scr select disk X
> echo >> c:\script.scr online
> diskpart < c:\script.scr
>
>
Author
17 Oct 2006 10:42 PM
Corey_in_Canada
Hey Pegasus,

I got it working. I was referencing my file wrong.

Thanks a lot for your help. I would assign points if I could!!


Show quoteHide quote
"Corey_in_Canada" <n*@mail.here> wrote in message
news:e8fNMtj8GHA.208@TK2MSFTNGP03.phx.gbl...
> Hi Pegasus,
>
> Thanks for taking the time to reply with an informative answer. Because I
> am by no means a scripting guru, in your example, what does script.scr
> refer to?
>
> For instance with my very simple and basic batch file, how would I combine
> that with the below example to make this work?
>
> I tried looking up some examples but it didnt really touch on the exact
> variables...maybe Im just missing the obvious though, and if so I
> apologize.
>
> Thanks kindly.
>
>
> "Pegasus (MVP)" <I.***@fly.com> wrote in message
> news:eSBA%23ej8GHA.3644@TK2MSFTNGP03.phx.gbl...
>>
>> "Corey_in_Canada" <n*@mail.here> wrote in message
>> news:O0Ah%23xh8GHA.2092@TK2MSFTNGP03.phx.gbl...
>>> Is it possible to create a batch file that will reconnect a dynamic disk
>>> through diskpart? To reconnect a dynamic disk the following commands are
>>> necessary
>>>
>>> diskpart
>>> select disk X
>>> online
>>>
>>> That command would and does bring an offline dynamic disk back online.
>>> However when I run that through a batch file it hangs at the following
>>> prompt:
>>>
>>> Diskpart>
>>>
>>> Its almost as if external interactive commands are prohibited from
>>> running
>>> for saftey precautions.
>>>
>>> Is there a work around to this or can anyone give some advice.
>>>
>>> Just FYI, I am trying to do this for an iSCSI SAN that has dynamic disks
>>> configured on a connected server, since Microsoft's iSCSI initator does
>> not
>>> support dynamic disks I am looking for a work around from purchasing an
>>> iSCSI HBA just for dyanmic disk support.
>>>
>>> Thanks
>>>
>>>
>>
>> The standard method is to pipe the subcommands into
>> diskpart via a script file:
>>
>> @echo off
>> echo  > c:\script.scr select disk X
>> echo >> c:\script.scr online
>> diskpart < c:\script.scr
>>
>>
>
>
Author
18 Oct 2006 1:39 AM
Pegasus (MVP)
Thanks for the feedback.

Show quoteHide quote
"Corey_in_Canada" <n*@mail.here> wrote in message
news:uNZ9b2j8GHA.2316@TK2MSFTNGP04.phx.gbl...
> Hey Pegasus,
>
> I got it working. I was referencing my file wrong.
>
> Thanks a lot for your help. I would assign points if I could!!
>
>
> "Corey_in_Canada" <n*@mail.here> wrote in message
> news:e8fNMtj8GHA.208@TK2MSFTNGP03.phx.gbl...
> > Hi Pegasus,
> >
> > Thanks for taking the time to reply with an informative answer. Because
I
> > am by no means a scripting guru, in your example, what does script.scr
> > refer to?
> >
> > For instance with my very simple and basic batch file, how would I
combine
> > that with the below example to make this work?
> >
> > I tried looking up some examples but it didnt really touch on the exact
> > variables...maybe Im just missing the obvious though, and if so I
> > apologize.
> >
> > Thanks kindly.
> >
> >
> > "Pegasus (MVP)" <I.***@fly.com> wrote in message
> > news:eSBA%23ej8GHA.3644@TK2MSFTNGP03.phx.gbl...
> >>
> >> "Corey_in_Canada" <n*@mail.here> wrote in message
> >> news:O0Ah%23xh8GHA.2092@TK2MSFTNGP03.phx.gbl...
> >>> Is it possible to create a batch file that will reconnect a dynamic
disk
> >>> through diskpart? To reconnect a dynamic disk the following commands
are
> >>> necessary
> >>>
> >>> diskpart
> >>> select disk X
> >>> online
> >>>
> >>> That command would and does bring an offline dynamic disk back online.
> >>> However when I run that through a batch file it hangs at the following
> >>> prompt:
> >>>
> >>> Diskpart>
> >>>
> >>> Its almost as if external interactive commands are prohibited from
> >>> running
> >>> for saftey precautions.
> >>>
> >>> Is there a work around to this or can anyone give some advice.
> >>>
> >>> Just FYI, I am trying to do this for an iSCSI SAN that has dynamic
disks
> >>> configured on a connected server, since Microsoft's iSCSI initator
does
> >> not
> >>> support dynamic disks I am looking for a work around from purchasing
an
> >>> iSCSI HBA just for dyanmic disk support.
> >>>
> >>> Thanks
> >>>
> >>>
> >>
> >> The standard method is to pipe the subcommands into
> >> diskpart via a script file:
> >>
> >> @echo off
> >> echo  > c:\script.scr select disk X
> >> echo >> c:\script.scr online
> >> diskpart < c:\script.scr
> >>
> >>
> >
> >
>
>
Author
18 Oct 2006 2:01 AM
Special Access
On Wed, 18 Oct 2006 08:01:02 +1000, "Pegasus \(MVP\)" <I.***@fly.com>
wrote:

<snip>

>The standard method is to pipe the subcommands into
>diskpart via a script file:
>
>@echo off
>echo  > c:\script.scr select disk X
>echo >> c:\script.scr online
>diskpart < c:\script.scr
>

The last line can also be replaced with this:

diskpart /s c:\script.scr

It will do the same thing.  (just learned this, wanted to pass it
along)

Mike
Author
18 Oct 2006 3:04 AM
Pegasus (MVP)
Show quote Hide quote
"Special Access" <nonyabidn***@hotmail.com> wrote in message
news:lm2bj2pcu8cvhhhqr1retk2p89c307oi8o@4ax.com...
> On Wed, 18 Oct 2006 08:01:02 +1000, "Pegasus \(MVP\)" <I.***@fly.com>
> wrote:
>
> <snip>
>
> >The standard method is to pipe the subcommands into
> >diskpart via a script file:
> >
> >@echo off
> >echo  > c:\script.scr select disk X
> >echo >> c:\script.scr online
> >diskpart < c:\script.scr
> >
>
> The last line can also be replaced with this:
>
> diskpart /s c:\script.scr
>
> It will do the same thing.  (just learned this, wanted to pass it
> along)
>
> Mike

Thanks for the tip!

Bookmark and Share