Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: No -Confirm parameter on Remove-Tape

0 views
Skip to first unread message

Marco Shaw [MVP]

unread,
Feb 6, 2008, 8:48:22 AM2/6/08
to

> Also I'm desparatly seaching for a (Temporary) workaround for this issue to
> get it working for now , but can't seem to find an other way to supress this
> prompt. (Hence the crossposting in the PowerSHell NG )

Are you able to use sendkeys?

PSH>[system.windows.forms.sendkeys]::sendwait("y"+{ENTER}")

Otherwise, maybe AutoIt:

PSH>$autoit=new-object -comobject autoitx3.control
PSH>$autoit.send("write-host `"test`"");$autoit.send("{ENTER}")
PSH> write-host "test"
test
PSH>

Or even Jaykul's WASP codeplex project (but perhaps you aren't looking
to add a snapin.

Marco


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com

/\/\o\/\/ [MVP]

unread,
Feb 6, 2008, 9:35:01 AM2/6/08
to
Marco,
thanks I must admid I did think about this but need a second shell and the
Problem is that this is supposed to become a Production script,

Greetings /\/\o\/\/

Marco Shaw [MVP]

unread,
Feb 6, 2008, 10:07:05 AM2/6/08
to
//o// [MVP] wrote:
> Marco,
> thanks I must admid I did think about this but need a second shell and the
> Problem is that this is supposed to become a Production script,

There was a question on remove-tape last week or so. I didn't see any
mention of a confirm request.

I could be wrong though... Can you post the relevant part of the script
where remove-tape is called?

This is the code the other person posted after I showed them how to loop:
$DPMLib = Get-DPMLibrary -DPMServerName "DPMServer1"
$Tape = Get-Tape -DPMLibrary $DPMLib
$export = $tape | where-object {$_.isoffsiteready -eq "True"} | where-
object {$_.displaystring -like "*Offsite*"}
foreach($tape in $export){
write-host "Removing $tape..."
remove-tape -tape $tape -DPMLibrary $DPMLib
}

Maybe the confirm prompt has to do with whether the tape is ready for
"offsite"?

Marco

/\/\o\/\/ [MVP]

unread,
Feb 6, 2008, 10:30:01 AM2/6/08
to
Marco, I think I know who did send you that he is standing next to me ;-)

The problem is that the script should be able to run unattended,
relevant part :

# Bug, as Confirm parameter not available on Remove-Tape, can'ty
supress confirm prompt.
# remove-tape -tape $_ -DPMLibrary $DPMLib -Confirm:$false

remove-tape -tape $_ -DPMLibrary $DPMLib

I want to first option , but gives error as confirm is not imlemented

Gr /\/\o\/\/

Kiron

unread,
Feb 6, 2008, 10:53:04 AM2/6/08
to
Have you tried setting $ConfirmPreference to 'None' or 'High'?

--
Kiron

/\/\o\/\/ [MVP]

unread,
Feb 6, 2008, 1:11:02 PM2/6/08
to
Kiron,

I changed the $confirmPreference,
but at end of day I did see that I might have set $verbosepreference by
accident in script (As I did override both in script with parameters )

I don't think it did/will work but to make absolutely sure I checked all
preferences as I might have missed a setting by accident ( 'High' is default
so kinda sure about that one but need to check 'none' again.

I will ask to check this again tomorrow, as I can't test anymore no DPM
available here.


Greetings /\/\o\/\/

Mohit [MSFT]

unread,
Feb 7, 2008, 6:34:14 AM2/7/08
to
Hi,
The cmdlet will work w/o showing a prompt if you set the global variable
$ConfirmPreference to either 'None' or 'High'.

--
Mohit
"/\/\o\/\/ [MVP]" <oM...@discussions.microsoft.com> wrote in message
news:D5486B18-E85B-42FA...@microsoft.com...

0 new messages