Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 24th, 2008, 03:34 PM
cchipman cchipman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 5 cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 h 10 m 28 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old September 24th, 2008, 05:57 PM
Hangman Hangman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 29 Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 h 56 m 6 sec
Reputation Power: 0
Quote:
Originally Posted by cchipman
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


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
Comments on this post
micky agrees!

Reply With Quote
  #3  
Old September 25th, 2008, 10:32 AM
cchipman cchipman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 5 cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 h 10 m 28 sec
Reputation Power: 0
Thanks. That did help. I should have checked there first. Should I post the script that I worked up?

Reply With Quote
  #4  
Old September 25th, 2008, 10:44 AM
Hangman Hangman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 29 Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level)Hangman User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 h 56 m 6 sec
Reputation Power: 0
Quote:
Originally Posted by cchipman
Thanks. That did help. I should have checked there first. Should I post the script that I worked up?

Well, ... I wouldn't mind seeing it. I like seeing others work. It's always good to learn someth'n new. Thanks.

Reply With Quote
  #5  
Old September 25th, 2008, 11:26 AM
cchipman cchipman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 5 cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 h 10 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by Hangman
Well, ... I wouldn't mind seeing it. I like seeing others work. It's always good to learn someth'n new. Thanks.


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

 

Reply With Quote
  #6  
Old September 26th, 2008, 07:16 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 23 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by cchipman
Code below. It does almost everything I want, except I can't figure out how to tell when the snapshot got made.
Do you want to log it or something? You can grab the current system time using Now().
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #7  
Old September 27th, 2008, 08:31 AM
cchipman cchipman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 5 cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 h 10 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
Do you want to log it or something? You can grab the current system time using Now().


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.

Reply With Quote
  #8  
Old September 27th, 2008, 07:56 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 23 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Be aware of the differences in how dates are stored in WMI. You'll need to convert this date to a VBS format.

Reply With Quote
  #9  
Old September 29th, 2008, 11:05 AM
cchipman cchipman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Posts: 5 cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level)cchipman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 h 10 m 28 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
Be aware of the differences in how dates are stored in WMI. You'll need to convert this date to a VBS format.


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
Comments on this post
Nilpo agrees!

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > General Scripting - Volume Shadow Copies


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |