Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Show output of steps of PS script

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-31-2008   #1 (permalink)
LordFox
Guest


 

Show output of steps of PS script

Hi,

I have been looking, but so far have not been able to find, a way to
output the steps of a script, either to screen or to file.

The exact purpose in this case has to do with System Center Data
Protection Manager 2007. We have been able to create a basic script
that will export tapes for the library to the I/E port so we can send
them off-site. However, we would like a per-tape output so we can
monitor (live, with output to screen) or later on (with the output
sent to a logfile) the progress of the script.

Write-Progress can only give me a progressbar, but surely it must be
possible to show something like below?

B00000002
B00000034
B00000067
B00000098
B00000107

As this is more of a general PS question I decided to post it here and
cross-post it to the DPM group.

Kind regards,

LF

My System SpecsSystem Spec
Old 01-31-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Show output of steps of PS script

Quote:

> Write-Progress can only give me a progressbar, but surely it must be
> possible to show something like below?
>
> B00000002
> B00000034
> B00000067
> B00000098
> B00000107
I've no experience with DPM, but will try to help...

Write-host "something"
and
add-content some_file "something"

Are cmdlets that can write information to the screen/console and a file
respectively.

Can we see a copy of this script? Just to know what cmdlets are being used.

Marco

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

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

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-31-2008   #3 (permalink)
LordFox
Guest


 

Re: Show output of steps of PS script

Marco,

Below is the script. It is all still very basic with just doing what
it needs to do - our first goal now is to get a set of working scripts
to get the tape handling right.

=== BOS ===

$DPMLib = Get-DPMLibrary -DPMServerName "DPMServer1"
$Tape = Get-Tape -DPMLibrary $DPMLib
$export = $tape | where-object {$_.isoffsiteready -eq "True"} | where-
object {$_.displaystring -like "*Offsite*"}
remove-tape -tape $export -DPMLibrary $DPMLib

=== OES ===

Tnx,

LF

On 31 jan, 15:05, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com>
wrote:
Quote:
Quote:

> > Write-Progress can only give me a progressbar, but surely it must be
> > possible to show something like below?
>
Quote:

> > B00000002
> > B00000034
> > B00000067
> > B00000098
> > B00000107
>
> I've no experience with DPM, but will try to help...
>
> Write-host "something"
> and
> add-content some_file "something"
>
> Are cmdlets that can write information to the screen/console and a file
> respectively.
>
> Can we see a copy of this script? *Just to know what cmdlets are being used.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp
>
> PowerGadgets MVPhttp://www.powergadgets.com/mvp
>
> Blog:http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-31-2008   #4 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Show output of steps of PS script

Quote:

> $DPMLib = Get-DPMLibrary -DPMServerName "DPMServer1"
> $Tape = Get-Tape -DPMLibrary $DPMLib
> $export = $tape | where-object {$_.isoffsiteready -eq "True"} | where-
> object {$_.displaystring -like "*Offsite*"}
> remove-tape -tape $export -DPMLibrary $DPMLib
I have a feeling that $export is an array of tapes. Try this:

$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
}
My System SpecsSystem Spec
Old 02-02-2008   #5 (permalink)
Keith Hill [MVP]
Guest


 

Re: Show output of steps of PS script

Try wrapping your script in calls to Start-Transcript and Stop-Transcript
e.g.L

Start-Transcript DPM.log
$DPMLib = Get-DPMLibrary -DPMServerName "DPMServer1"
$Tapes = Get-Tape -DPMLibrary $DPMLib
$exports = $tape | where {$_.isoffsiteready -and ($_.displaystring -match
"Offsite")}
$exports | foreach { "output some info here"; remove-tape -tape
$_ -DPMLibrary $DPMLib }
Stop-Transcript

Note: If the remove-tape has a -Verbose parameter you might want to use it.
Also if you already have a transcript running for your shell sesssion you
will need to stop it. There can only be one transcript started at any one
time in a shell session.

--
Keith

"LordFox" <rick.harderwijk@xxxxxx> wrote in message
news:0c730c30-f12b-450b-a932-f65879a4ee0b@xxxxxx
Quote:

> Marco,
>
> Below is the script. It is all still very basic with just doing what
> it needs to do - our first goal now is to get a set of working scripts
> to get the tape handling right.
>
> === BOS ===
>
> $DPMLib = Get-DPMLibrary -DPMServerName "DPMServer1"
> $Tape = Get-Tape -DPMLibrary $DPMLib
> $export = $tape | where-object {$_.isoffsiteready -eq "True"} | where-
> object {$_.displaystring -like "*Offsite*"}
> remove-tape -tape $export -DPMLibrary $DPMLib
>
> === OES ===
>
> Tnx,
>
> LF
My System SpecsSystem Spec
Old 05-09-2008   #6 (permalink)
Newbie


Join Date: May 2008
.
 
Rep Power: 4
MikeP is on a distinguished road
  MikeP is offline

Re: Show output of steps of PS script

LordFox,

Did you manage to get this script running. I too have been searching for a way to eject tapes that are offsite ready via the I/E port on our ADIC Scalar24 SCSI Tape Libray.

I have tried the suggetsed scripts, but they always error on the remove-tape cmdlet section.

If you have had any further success,could you please share it with me

Thanks

Michael
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging output in a Powershell Script Kevin PowerShell 10 10-18-2007 03:44 AM
output .ps1 script to text file Aaron PowerShell 2 07-11-2007 05:30 PM
Hide console and capture output from script? Brian Vallelunga PowerShell 4 04-03-2007 01:43 PM
Send .ps1 script output as e-mail body Stephen Merkel PowerShell 9 02-09-2007 08:59 AM
PS script prints output instead of executing commands Andy Webster PowerShell 4 12-29-2006 10:52 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51