|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
General Scripting - Volume Shadow Copies
We rely upon Volume Shadow Copies to provide immediate recovery vectors for accidentally deleted data. I have a need to script a method to check the status of our volume shadow copies across our multiple servers in our corporation.
While I have found the VSS SDK, and the vshadowe.exe tool, it doesn't appear that the vshadowe.exe allows us to check out the status on remote computers, so I would have to install and run that tool on every computer, and then coallate all the results into a file, and then figure things out. So, does anyone have any recommendations? TIA, Carl |
|
#2
|
|||
|
|||
|
Quote:
I found this on the MSDN script center. See if this doesn't do the trick, or at least point you in the right direction. http://www.microsoft.com/technet/sc...t.mspx?mfr=true Here is the main directory where you may find something useful. http://www.microsoft.com/technet/sc...t.mspx?mfr=true |
|
#3
|
|||
|
|||
|
Thanks. That did help. I should have checked there first. Should I post the script that I worked up?
|
|
#4
|
|||
|
|||
|
Quote:
Well, ... I wouldn't mind seeing it. I like seeing others work. It's always good to learn someth'n new. Thanks. |
|
#5
|
|||
|
|||
|
Quote:
Code below. It does almost everything I want, except I can't figure out how to tell when the snapshot got made. Code:
strComputer = "your_server.domain.tld"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Volume")
For Each objItem In colItems
' WMI queries use the "\" as an escape charcter
deviceID = Replace(objItem.DeviceID, "\", "\\\\")
deviceID2 = Replace(objItem.DeviceID, "\", "\\")
Dim query
query = "Select * from Win32_ShadowStorage WHERE Volume='Win32_Volume.DeviceID=""" & deviceID & """'"
' WScript.Echo query
Set ssItems = objWMIService.ExecQuery(query)
If ssItems.Count Then
Wscript.Echo "--------------------------------------------------------------------"
Wscript.Echo "--------------------------------------------------------------------"
WScript.Echo "Capacity: " & objItem.Capacity
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "Device ID: " & objItem.DeviceID
WScript.Echo "Drive Letter: " & objItem.DriveLetter
WScript.Echo "Drive Type: " & objItem.DriveType
WScript.Echo "Label: " & objItem.Label
WScript.Echo "Maximum File Name Length: " & objItem.MaximumFileNameLength
WScript.Echo "Name: " & objItem.Name
WScript.Echo "Serial Number: " & objItem.SerialNumber
WScript.Echo "Supports Disk Quotas: " & objItem.SupportsDiskQuotas
For Each ssI in ssItems
Wscript.Echo "Allocated space: " & ssI.AllocatedSpace
Wscript.Echo "Differential volume: " & ssI.DiffVolume
Wscript.Echo "Maximum space: " & ssI.MaxSpace
Wscript.Echo "Used space: " & ssI.UsedSpace
Next
WScript.ECho "Shadow Copies"
Set volumeItems = objWMIService.ExecQuery("Select * from Win32_ShadowCopy WHERE VolumeName = '" & deviceID2 & "'")
For Each volItem in volumeItems
Wscript.Echo "************************************************** ******************"
Wscript.Echo "************************************************** ******************"
Wscript.Echo "Client accessible: " & volItem.ClientAccessible
Wscript.Echo "Count: " & volItem.Count
Wscript.Echo "Device object: " & volItem.DeviceObject
Wscript.Echo "Differential: " & volItem.Differential
Wscript.Echo "Exposed locally: " & volItem.ExposedLocally
Wscript.Echo "Exposed name: " & volItem.ExposedName
Wscript.Echo "Exposed remotely: " & volItem.ExposedRemotely
Wscript.Echo "Hardware assisted: " & volItem.HardwareAssisted
Wscript.Echo "Imported: " & volItem.Imported
Wscript.Echo "No auto release: " & volItem.NoAutoRelease
Wscript.Echo "Not surfaced: " & volItem.NotSurfaced
Wscript.Echo "No writers: " & volItem.NoWriters
Wscript.Echo "Originating machine: " & volItem.OriginatingMachine
Wscript.Echo "Persistent: " & volItem.Persistent
Wscript.Echo "Plex: " & volItem.Plex
Wscript.Echo "Provider ID: " & volItem.ProviderID
Wscript.Echo "Service machine: " & volItem.ServiceMachine
Wscript.Echo "Set ID: " & volItem.SetID
Wscript.Echo "State: " & volItem.State
Wscript.Echo "Transportable: " & volItem.Transportable
Wscript.Echo "Volume name: " & volItem.VolumeName
Wscript.Echo "************************************************** ******************"
Wscript.Echo "************************************************** ******************"
Wscript.Echo ""
Next
Wscript.Echo "--------------------------------------------------------------------"
Wscript.Echo "--------------------------------------------------------------------"
End If
Next
|
|
#6
|
||||
|
||||
|
Quote:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#7
|
|||
|
|||
|
Quote:
Actually, I figured it out. The "installdate" field of the Win32_Volume object has the snapshot creation date. I'll post an updated script monday. Basically the whole script queries the servers that I want to have at least 3 active snapshots, and makes sure that they have them and emails details about the snapshots. |
|
#8
|
||||
|
||||
|
Be aware of the differences in how dates are stored in WMI. You'll need to convert this date to a VBS format.
|
|
#9
|
|||
|
|||
|
Quote:
Yah, there's a lazy method that works well, using this: Code:
' Create a new datetime object.
Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
dateTime.Value = volItem.InstallDate
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > General Scripting - Volume Shadow Copies |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|