I am writing a powershell script to export the tapes that were written on
the previous day. i can export the tapes that are marked "offsite ready" but
i am trying to find a way to only export the ones that were updated or
written to yesterday or a date that i can define.
also, how do you remove the tapes from teh drives and back in the slots
instead of ejecting them to the I/E port through powershell.
Thanks.
I know more about PowerShell than about DPM (I've actually never seen
DPM). What are some of the cmdlets (aka "commands") you are using in
PowerShell. I know there's a DPM command guide, and I may be able to
help once I re-find the guide...
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Are you going something like a get-tape|...|remove-tape to export the tapes?
If so, can you copy and paste what get-tape|gm gives as output here?
Sorry, as for your 2nd question, I can't help with with what I know
about the app...
Import:
$DPMLib = Get-DPMLibrary -DPMServerName scolbk01.sarcom.sarcom.net
Add-Tape -DPMLibrary $DPMLib[0] -Async
Import and Export works fine but trying to find a way to export only tapes
that were written to yesterday instead of all the tapes.
When i double click the script, screen pops up and goes away. Trying to
figure out how to make ps1 run with DPM instead of just Windows PowerShell.
Thanks.
I would need the output of this
PSH>$Tapes|get-member
This may expose a hidden time/date property.
> When i double click the script, screen pops up and goes away. Trying to
> figure out how to make ps1 run with DPM instead of just Windows PowerShell.
You want to just double-click the .ps1 script and have it run the
commands? This goes against PowerShell's built-in security features,
but there's a workaround. I just don't know the details off hand. I'll
look it up though.
Marco
TypeName:
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.ArchiveMedia
Name MemberType Definition
---- ---------- ----------
add_MediaStateChanged Method System.Void
add_MediaStateChanged(MediaStateChangeEventHandler value)
ChangeType Method System.Boolean ChangeType(Boolean
markAsCleaner)
Dispose Method System.Void Dispose()
Equals Method System.Boolean Equals(Object obj)
GetDatasetLifeStatus Method
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.EngineConstants.DbEnums+Dataset...
GetHashCode Method System.Int32 GetHashCode()
GetHeadlessDataset Method
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.HeadlessDatas...
GetRecoverySourceCollection Method
System.Collections.Generic.IList`1[[Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectM...
GetRunningJobsCollection Method
System.Collections.Generic.ICollection`1[[Microsoft.Internal.EnterpriseStorage.Dls.UI.O...
GetType Method System.Type GetType()
get_BackupLibraryId Method System.Guid get_BackupLibraryId()
get_Barcode Method
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.Barcode get_B...
get_CreationDate Method System.DateTime get_CreationDate()
get_DisplayString Method System.String get_DisplayString()
get_Id Method System.Guid get_Id()
get_IsOffline Method System.Boolean get_IsOffline()
get_IsOffsiteReady Method System.Boolean get_IsOffsiteReady()
get_IsOmidChangeNeeded Method System.Boolean
get_IsOmidChangeNeeded()
get_IsSuspect Method System.Boolean get_IsSuspect()
get_Label Method System.String get_Label()
get_LibraryId Method System.Guid get_LibraryId()
get_LibraryName Method System.String get_LibraryName()
get_Location Method
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.MediaLocation...
get_MediaPoolId Method System.Guid get_MediaPoolId()
get_MediaPoolType Method
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
get_ModifiedDate Method System.DateTime get_ModifiedDate()
get_OmidState Method
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+OmidS...
get_ProtectionGroupName Method System.String
get_ProtectionGroupName()
get_StateInDrive Method
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
get_Type Method
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
HasValidDatasets Method System.Boolean HasValidDatasets()
MarkAsFree Method System.Void MarkAsFree()
remove_MediaStateChanged Method System.Void
remove_MediaStateChanged(MediaStateChangeEventHandler value)
ToString Method System.String ToString()
TriggerErase Method
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.JobManagement.Job
TriggerErase(...
TriggerMediaRecatalog Method
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.JobManagement.Job
TriggerMediaR...
UnmarkAsFree Method System.Void UnmarkAsFree()
BackupLibraryId Property System.Guid BackupLibraryId {get;}
Barcode Property
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.Barcode Barco...
CreationDate Property System.DateTime CreationDate {get;}
DisplayString Property System.String DisplayString {get;}
Id Property System.Guid Id {get;}
IsOffline Property System.Boolean IsOffline {get;}
IsOffsiteReady Property System.Boolean IsOffsiteReady {get;}
IsOmidChangeNeeded Property System.Boolean IsOmidChangeNeeded
{get;}
IsSuspect Property System.Boolean IsSuspect {get;}
Label Property System.String Label {get;}
LibraryId Property System.Guid LibraryId {get;}
LibraryName Property System.String LibraryName {get;}
Location Property
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.MediaLocation...
MediaPoolId Property System.Guid MediaPoolId {get;}
MediaPoolType Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
ModifiedDate Property System.DateTime ModifiedDate {get;}
OmidState Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+OmidS...
ProtectionGroupName Property System.String ProtectionGroupName
{get;}
StateInDrive Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
Type Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
What does this give:
$DPMLib = Get-DPMLibrary -DPMServerName "myserver"
$Tapes = Get-Tape -DPMLibrary $DPMLib[0]
$Tapes | select isoffsiteready,modifieddate
Does modifieddate seem to meet your date requirements?
If so, we will be able to use that!
Marco
$DPMLib = Get-DPMLibrary -DPMServerName "myserver"
$Tapes = Get-Tape -DPMLibrary $DPMLib[0]
$Tapes | select *
With *, it gives all the fields that I can use with Tapes. Following is what
i get for one tape...
MediaPoolId : asdasds-asdas-asd-asdas-asdasdasdasd
BackupLibraryId : asdasdasdad-asds-asdas-asdd-asdasdasdasd
ProtectionGroupName :
MediaPoolType : Imported
OmidState : Unrecognized
IsOmidChangeNeeded : True
IsSuspect : False
IsOffsiteReady : False
CreationDate : 5/9/2008 9:05:10 PM
ModifiedDate : 5/9/2008 9:05:10 PM
DisplayString : Unrecognized
Id : bbbbbbbbbbb-71ce-4bcd-9493-bbbbbbbbbbbbbb
LibraryId : aaaaaaa-aaaaaa-aaa-a-aa-aaaaaaa
LibraryName : Library1
IsOffline : False
Location : Slot-48
Label :
Type : TapeArchiveMedia
StateInDrive : None
Barcode : 000247L2
I am able to script export of the tapes using the where pipe. Two more
questions...
1. May i ask how i can get input while running the script and use that
variable
(Thinking of entering the date while running the script to get tapes older
than X date and then use it in the next step | where ($_.ModifiedDate -like
(or greater than) $DateVar)
2. How can i double click the ps1 file and get it executed?
Thanks.
#1 Use read-host to prompt for a date:
PSH>[datetime]$date=read-host "Enter the date"
Enter the date: May 21, 2008
PSH>$date
Wednesday, May 21, 2008 12:00:00 AM
PSH>
That will only ask for input from the PowerShell console. Were you
looking for a Windows-style popup window?
As for #2, as an MVP, I will not post a method to get around
PowerShell's built-in security features.
http://cid-b03306b628ab886f.office.live.com/self.aspx/.Public/DPMTapeUtil.zip
As for the Powershell itself, I don't think it is good to learn from by means of best practices but it isn't bad either. It does have couple of DPM specifics you may want to look into.
Have fun and let me know what you think of it, particularly if & where it can be improved.
Thanks
Ruud
JoeBut wrote:
PowerSHell Script to export tapes
08-May-08
Hi,
Thanks.
Previous Posts In This Thread:
On Thursday, May 08, 2008 3:06 PM
JoeBut wrote:
PowerSHell Script to export tapes
Hi,
Thanks.
On Monday, May 12, 2008 7:38 AM
Marco Shaw [MVP] wrote:
Re: PowerSHell Script to export tapes
Joe Butt wrote:
I know more about PowerShell than about DPM (I've actually never seen
DPM). What are some of the cmdlets (aka "commands") you are using in
PowerShell. I know there's a DPM command guide, and I may be able to
help once I re-find the guide...
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com
On Monday, May 12, 2008 9:24 AM
Marco Shaw [MVP] wrote:
Re: PowerSHell Script to export tapes
Joe Butt wrote:
Are you going something like a get-tape|...|remove-tape to export the tapes?
If so, can you copy and paste what get-tape|gm gives as output here?
Sorry, as for your 2nd question, I can't help with with what I know
about the app...
Marco
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com
On Monday, May 12, 2008 2:40 PM
JoeBut wrote:
This is what i set me up with.
This is what i set me up with.
Export:
$DPMLib = Get-DPMLibrary -DPMServerName "myserver"
$Tapes = Get-Tape -DPMLibrary $DPMLib[0]
$exports = $Tapes | where {$_.isoffsiteready}
$exports | foreach { "removing tapes"; remove-tape -tape $_ -DPMLibrary
$DPMLib[0]}
Import:
$DPMLib = Get-DPMLibrary -DPMServerName scolbk01.sarcom.sarcom.net
Add-Tape -DPMLibrary $DPMLib[0] -Async
Import and Export works fine but trying to find a way to export only tapes
that were written to yesterday instead of all the tapes.
When i double click the script, screen pops up and goes away. Trying to
figure out how to make ps1 run with DPM instead of just Windows PowerShell.
Thanks.
"Marco Shaw [MVP]" wrote:
On Monday, May 12, 2008 2:48 PM
Marco Shaw [MVP] wrote:
Re: PowerSHell Script to export tapes
Joe Butt wrote:
I would need the output of this
PSH>$Tapes|get-member
This may expose a hidden time/date property.
You want to just double-click the .ps1 script and have it run the
commands? This goes against PowerShell's built-in security features,
but there's a workaround. I just don't know the details off hand. I'll
look it up though.
Marco
On Tuesday, May 13, 2008 5:48 PM
JoeBut wrote:
TypeName:
Microsoft.Internal.EnterpriseStorage.Dls.UI.ObjectModel.LibraryManagement.ArchiveMedia
ModifiedDate Property System.DateTime ModifiedDate {get;}
OmidState Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+OmidS...
ProtectionGroupName Property System.String ProtectionGroupName
{get;}
StateInDrive Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
Type Property
Microsoft.Internal.EnterpriseStorage.Dls.EngineUICommon.LibraryManagement.DbEnums+Media...
"Marco Shaw [MVP]" wrote:
On Tuesday, May 13, 2008 9:41 PM
Marco Shaw [MVP] wrote:
Re: PowerSHell Script to export tapes
What does this give:
$DPMLib = Get-DPMLibrary -DPMServerName "myserver"
$Tapes = Get-Tape -DPMLibrary $DPMLib[0]
$Tapes | select isoffsiteready,modifieddate
Does modifieddate seem to meet your date requirements?
If so, we will be able to use that!
Marco
On Monday, May 19, 2008 12:42 PM
JoeBut wrote:
1. May i ask how i can get input while running the script and use that
variable
(Thinking of entering the date while running the script to get tapes older
than X date and then use it in the next step | where ($_.ModifiedDate -like
(or greater than) $DateVar)
2. How can i double click the ps1 file and get it executed?
Thanks.
On Wednesday, May 21, 2008 8:37 AM
Marco Shaw [MVP] wrote:
Re: PowerSHell Script to export tapes
PSH>[datetime]$date=read-host "Enter the date"
Enter the date: May 21, 2008
PSH>$date
Wednesday, May 21, 2008 12:00:00 AM
PSH>
That will only ask for input from the PowerShell console. Were you
looking for a Windows-style popup window?
As for #2, as an MVP, I will not post a method to get around
PowerShell's built-in security features.
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com
On Saturday, May 24, 2008 2:02 AM
JoeBut wrote:
Re: PowerSHell Script to export tapes
This would do... thank you for all your help.
"Marco Shaw [MVP]" wrote:
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Binding Beyond the Limitation of Name Scopes
http://www.eggheadcafe.com/tutorials/aspnet/ef583104-e507-491d-b05f-49faac8854c8/wpf-binding-beyond-the-li.aspx
Ed,try the solution as linked to below, it does many things amongst which what you want.
http://cid-b03306b628ab886f.office.live.com/self.aspx/.Public/DPMTapeUtil.zip
\R2
EdOlso wrote:
Powershell script to eject "Offsite Ready" tapes
04-Feb-08
Is there a powershell script to automatically eject the "Offsite Ready"
tapes? I imagine this script could be run as a post job script or a
scheduled job on the server.
Thx.
Ed
Previous Posts In This Thread:
On Monday, February 04, 2008 2:16 PM
EdOlso wrote:
Powershell script to eject "Offsite Ready" tapes
Is there a powershell script to automatically eject the "Offsite Ready"
tapes? I imagine this script could be run as a post job script or a
scheduled job on the server.
Thx.
Ed
Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Orchestration And Web Services.
http://www.eggheadcafe.com/tutorials/aspnet/62ffe57e-2853-4188-b14d-9fcbec171393/biztalk-orchestration-and.aspx