Creating Snapshot of same Volume/Drive Multiple Times Using VSHADOW/DISKSHADOW

Introduction:

In this blog am going to demonstrate how to create multiple snapshots of same volume/Disk/Drive in Windows environment using VSHADOW/DISKSHADOW.

How to Do this?

In order to perform multiple snapshot operations it is must to have VSS tool’s like VSHADOW(in Windows 2003 R2, SP2 and Windows 2008 Standard except Windows 2008 R2) or DISKSHADOW( only Windows 2008 R2).

So we have to write a DOS batch script or DOS command script to accomplish the multiple snapshot creation. Here am going to demonstarte how we can do it using the DOS script. Construct a DOS for loop based on number of times we want to take shadowCopy(Snapshot). Like

FOR /L %%A IN (0 1 32) DO echo “Something”

here something will be printed in Console 32 times.

Using VSHADOW

Find the following DOS batch script to execute it multiple times,  just copy the following lines into a BAT file. Example ( ShadowCopy32.BAT)

@echo OFF
FOR /L %%A IN (1 1 32) DO VSHADOW -p -nw E:

Here we are trying to take Snapshot/ShadowCopy for E drive.

-p Persistent snapshot/ShadowCopy

-nw – No Writer option.

How to do in Windows 2008 R2( using DISKSHADOW):

In windows 2008 R2 we can do it using DISKSHADOW when we are using diskshadow we can only insert script. So for this we need a Two BAT files usually one for running the for loop and another one will be  set of commands DISHSHADOW has to execute.  But am going to demonstrate how to do this using only one BAT file but purly using DOS commands.

Copy and paste the following lines into a BAT file example( ShadowCpy32.BAT) and run it.

@echo OFF
echo set context persistent >> ExecuteScript.cmd
echo add volume E: >> ExecuteScript.cmd
echo create >> ExecuteScript.cmd
echo reset >> ExecuteScript.cmd
FOR /L %%A IN (1 1 32) DO diskshadow /s ExecuteScript.cmd
del ExecuteScript.cmd

Set Context Persistent – Setting the context as persistent

Add Volume E: – Adding the base volume E: to take Snapshot/Shadow Copy

Create – Starts the ShadowCopy process

reset – Between every successive ShadowCopy process a reset is must.

Here we are creating a ExecuteScript.cmd file dynamically and this will be executed by DISKSHADOW 32 time once if it is completed we can delete the file.

Conclusion: 

Feel free to comment and conduct if you have any queries.

Showing Message from Silent Installer Using InstallAnywhere

Introduction:

In this blog, I am going to demonstrate how to show a Message when we trigger the silent installer in InstallAnywhere.

Purpose of the Blog:

When we execute the Installer in silent mode using (-i silent) the installer will not allow you to show any sort of messages to the user. In some cases we might need to display some warning messages to the user in order to notify them about some failure. So this blog will explain you how to show such a Message to the user even at the silent installation.

How to Do It:

In this example am going to show a Warning Message to the user when un Installation is completed.

Adding the Action Items

Add the action item for Modify Text File single file option. And select the Create New option. And enter the name of the file should be created. The following image shows the actual change.

Add the action Item Execute Script to execute the Script file created using Modify Single File.

Delete the Script file created.

The Final Action Item List looks like in the following screen shot.

How To Test It:

This can be tested using the following command while triggering the un installer. Uninstaller.exe -i silent

Conclusion:

A silent installer is always a silent installer. It is not possible to change the silent installer functionality but when needed we can break it according to our needs.

Thanks

Getting List of Host Names in the Subnet – Windows

Getting List of Host Names in the Subnet – Windows

Introduction:

Identifying host name associated with IP Address in Windows is simple work. So here am going to demonstrate how to get multiple host names which are available in the same subnet.

How we can do it:

Usually we can get the Host name associated with the IP address using the following command.

NBTSTAT -a [Computer IP Address]

The Above given command will return the HOST NAME associated with the IP address given.

Mixing it With DOS Batch Script:

By Mixing this command with DOS Batch script we can get multiple Host names available in the SubNet.

For Loop in DOS Script:

FOR /L %%varaible IN ( START STEP END) DO  COMMAND

%%Variable is the Name of the variable

START- Start value for the FOR Loop

STEP- Step value for the FOR Loop

END- End value for the FOR Loop

COMMAND- Command to execute multiple times

Putting it Together:

Save the following code in a file with .BAT extension


FOR /L %%A IN (0 1 255) DO NBTSTAT -A "192.168.1.%%A">>File.txt

Running the program

So now run the bat file and see the File.txt in the current directory of Bat file it will contain details of the Host names in the SubNet

Using Boost Library in Eclipse CDT with Cygwin and MinGW

Using Boost Library with Eclipse

Introduction

The purpose of this blog is to show how to use the boost library in Eclipse CDT plug-in with Cygwin and MinGW compiler.

About Boost Library:

Boost is an Internet community dedicated to building and reviewing C++ libraries. The initial members of Boost were C++ Standards Committee members who wanted to create a forum for developing libraries that might some day become part of the C++ Standard. Boost emphasize libraries that work well with the C++ Standard Library. Boost libraries are intended to be widely useful, and usable across a broad spectrum of applications. The Boost license encourages both commercial and non-commercial use. Boost works on almost any modern operating system, including UNIX and Windows variants. Follow the Getting Started Guide to download and install Boost. Popular Linux and Unix distributions such as Fedora, Debian, and NetBSD include pre-built Boost packages.

Eclipse CDT:

The CDT Project provides a fully functional C and C++ Integrated Development Environment based on the Eclipse platform. Features include: support for project creation and managed build for various toolchains, standard make build, source navigation, various source knowledge tools, such as type hierarchy, call graph, include browser, macro definition browser, code editor with syntax highlighting, folding and hyperlink navigation, source code refactoring and code generation, visual debugging tools, including memory, registers, and disassembly viewers.

( click here to download eclipse for C++)

Cygwin:

Cygwin is a Linux-like environment for Windows. It consists of two parts:

  • A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools which provide Linux look and feel.

The Cygwin DLL currently works with all recent, commercially released x86 32 bit and 64 bit versions of Windows, with the exception of Windows CE.

MinGW:

  • MinGW, a contraction of “Minimalist GNU for Windows”, is a minimalist development environment for native Microsoft Windows applications.
  • MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs (only the Microsoft C runtime, MSVCRT).

Downloading and Installing Cyginwin:

Note: click here to download cygwin

Follow the following steps to install cygwin,

  1. Run the Cyginwin setup.
  2. Select install from Internet
  3. Set the root directory as C:\cygwin
  4. Set the local directory for the installation files
  5. Configure the internet settings, Direction connection or Proxy settings.
  6. Select the mirror site
  7. Select the core components or allow the default selection and give next.

Download and Install MinGW compiler:

Click here to download MinGW compiler

Download the MinGW compiler and accept the default settings and install the MinGW compiler

Make sure to select the GCC compler

Download boost Source and bjam tool:

Click here to download the boost source and bjam tool.

Installing Boost library:

  • Add the path of the cygwin in environment variable
  • Add the path of minGW compiler in environment variable
  • Extract the Eclipse in C:\Eclipse directory
  • Extract the boost package in C:\Program Files\boost\
  • Extract the bjam tool in C:\Program Files\boost\boostxxx.\
  • Go to the command prompt give the following command

C:\Program Files\boost\boost_1_44_0>bjam --toolset=gcc --build-type=complete

Note: build process will take lot of time to finish. Wait patiently.

Using Boost lib in Eclipse

  • Open Eclipse->File -> New -> C++ project
  • Empty project and accept other default options
  • Right click the project and add new Source file ( shown in the screen shot )

 

 

 

 

 

 

 

 

 

  • Select the project Properties
  • Select the path and Symbol’s under C/C++ General category.
  • Select GNU C and click add button

Now you can enter the boost path or explore the path using File System button. it show like as follows.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Repeat the same process for GNU C++

 

 

 

 

 

 

 

 

 

 

 

 

 

Adding the code:

Add the following code in main.cpp file

#include <iostream>
#include <boost/foreach.hpp>
using namespace std;

int main() {
 cout<<"Boost Demo"<<endl;
 int a[10];
 for(int i=0;i<10;i++)
 {
 a[i]=i+10;
 }
 BOOST_FOREACH(int k, a)
 {
 cout<<"\t"<<k;
 }
 return 0;
}

Build and Run the Project:

Click project-> Build Project

Click Run Command to run the project

See the output in Console tab

Handling properties file using Java

Handling properties file using Java

Introduction:

Properties are configuration values managed as key/value pairs. In each pair, the key and value are both String values. The key identifies, and is used to retrieve, the value, much as a variable name is used to retrieve the variable’s value. For example, a Client Server application should communicate with each other,so the Server information has to be stored in Client in  order to establish the communication with the Server. The server information like IP Address can be stored and retrieved from the Properties file.

Basics on Handling Properties file:

The following procedures has to be followed in order to write Properties to Properties file.

The following procedures has to be followed in order to Read Properties from Properties file.

  • Create instance of Properties file.
  • Load the FileInput Stream Object
  • Read the Value using the Key value. ( using getProperties method )
  • Close the Input Stream Object

Click here to see more details on Properties class.

Example:

The following example shows how to Write Properties into Properties file.

/* PropTest.java by elangovan */
import java.util.*;
import java.io.*;
class PropTest
{
	public static void main(String args[]) throws IOException
	{
		if( args.length < 2)
		{
			System.out.println("Usage: PropTest <UserName> <FavColor>");
			System.exit(0);
		}
		Properties prop=new Properties();
		FileOutputStream out=new FileOutputStream(new File("UserSetting.ini"));
		prop.setProperty("UserName",args[0]);
		prop.setProperty("FavColor",args[1]);
		prop.store(out,"");
		out.close();
	}
}

Running the program

javac PropTest.java
java PropTest MyName Blue

The following example shows how to Read from Properties file.

/* PropTest.java by elangovan */
import java.util.*;
import java.io.*;
class PropReadTest
{
	public static void main(String args[]) throws IOException
	{
		String UserName="",FavColor="";
		Properties prop=new Properties();
		FileInputStream fin=new FileInputStream(new File("UserSetting.ini"));
		prop.load(fin);
		UserName = prop.getProperty("UserName");
		FavColor = prop.getProperty("FavColor");
		fin.close();
		System.out.println("User name is:"+UserName);
		System.out.println("Favourte Color is:"+FavColor);
	}
}

Running the program

javac PropReadTest.java
java PropReadTest

Follow

Get every new post delivered to your Inbox.