3

Is there a way (powershell, commandline, api, snmp) to list the snapshot timestamps of a file on a network location. So i'm searching for an automation of what windows is doing, when you click properties -> previous versions.

We have a netapp and use these snapshots for easy backup. I've search in the windows tools and the DataOnTap Powershell Module, but so far, now luck.

Serpen
  • 27
  • 2
  • 1
    http://superuser.com/questions/643536/how-to-find-and-open-previous-versions-of-a-folder-programmatically-using-power ?? – ErikE Jul 02 '15 at 20:20
  • Not related, ErikE. That's a windows thing, and he wants to know about the NAS. He already has access (and presumably understands how to use) the windows information. He wants to find a way to write a script using the information about which snapshots are available. – Basil Jul 03 '15 at 12:44

3 Answers3

1

You can do it with the netapp CLI. If it's 7-mode, snap list volumename. If it's CDOT, you do snap show -vserver vservername -volume volumename -fields create-time.

You mentioned that you want to do this for a file on the network. This implies that it may not be obvious which volume contains the file you want. Snapshots in Netapp are taken of an entire volume, and all files in the volume have the same previous versions listed. The way to figure out which volume the file you're looking at is in starts by figuring out the share it's in. Look at the location of the file, go all the way back up to the server, and then look at the first "directory". This is the share. Now you need to know what volume that share is in:

  • For 7-mode, enter cifs shares and look for the share name we just found.
  • For CDOT, enter cifs share show -vserver vservername and look for the share name.

If, on the off chance, your share is pointing to something inside a volume, don't worry, the volume is all that matters. The snapshots on that volume will have the same timestamps you see in windows previous versions.

Basil
  • 8,851
  • 3
  • 38
  • 73
0

I have always used ls ltr --time=atime in the .snapshot directory, as that is a way that doesn't require any particular privilege.

I am fairly sure you can do the same in Windows:

In "Windows Explorer" change to (path)/~snapshot

You'll see a list of the snap names and the date modified will be "when this directory was changed" which isn't too useful.

However if you right click on the column headings, you should be able to add "Date Accessed".

This - on my system at least - matches snapshot timestamps. I suspect this is something you can script - but at a basic level dir /TA ~snapshot does the trick.

Sobrique
  • 3,747
  • 2
  • 15
  • 36
0

As indicated here and here, the volrest commandline utility can be used to browse and restore shadow copies (previous versions) of files. It is available from the Windows 2003 reskit.

ErikE
  • 4,746
  • 1
  • 20
  • 27