Saturday, July 24, 2010

Udaan - Choti choti chhitrayi yaadein

Chhoti-chhoti chhitrayi yaadein
Bichhi hui hain lamhon ki lawn par.
Nange pair unpar chalte-chalte
Itni door chale aaye
Ki ab bhool gaye hain –
Joote kahan utaare the.


Aedi komal thi, jab aaye the.
Thodi si naazuk hai abhi bhi.
Aur nazuk hi rahegi
In khatti-meethi yaadon ki shararat
Jab tak inhe gudgudati rahe.

Sach, bhool gaye hain
Ki joote kahan utaare the.
Par lagta hai,
Ab unki zaroorat nahin.

Udaan .....

Jo lehron se aage nazar dekh paati toh tum jaan lete main kya sochta hoon,
Wo aawaz tumko bhi jo bhed jaati toh tum jaan lete main kya sochta hoon.
Zid ka tumhare jo parda sarakta toh khidkiyon se aage bhi tum dekh paate,
Aankhon se aadaton ki jo palken hatate toh tum jaan lete main kya sochta hoon.


Meri tarah khud par hota zara bharosa toh kuchh door tum bhi saath-saath aate,
Rang meri aankhon ka baant-te zara sa toh kuchh door tum bhi saath-saath aate,
Nasha aasmaan ka jo choomta tumhe bhi, hasraten tumhari naya janm paatin,
Khud doosre janam mein meri udaan chhoone kuchh door tum bhi saath-saath aate.

Monday, July 05, 2010

Hope

Someone truly said, 'Ummeed pe duniya kayam hai'. I now know, what 'hope' means.

Thursday, July 01, 2010

Different ways to execute processes remotely

During my stint at executing a given process remotely, I discovered few ways of doing it. For example, if you want to run a particular command or a program on a remote computer how will you do it? Here are few ways which I tried and were useful:

 

1.        Psexec : This is a tool from SysInternals from Microsoft. It comes as a part of PsTools. Using Psexec, one can run a process on any given remote computer.

Syntax:                    psexec \\remote-machine-name –i –u domainname\username –p password name-and-path-of-the-process-to-be-executed

psexec \\client1 –i –u testdomain\administrator –p P@ssword notepad.exe

Advantages:          Works even if the executable or the process to be executed is on the network location. It need not be present on the destination (remote) machine where you want to execute the process. This makes Psexec one of its kind.

Limitations:           Sometimes, psexec does not work with the –i switch which stands for interactive mode. In these cases try without using –i switch.

 

2.        Windows Service: Developing a Windows service which when started (OnStart() event) executes a process or an executable. Push this service on the remote computer and start it remotely.

Syntax:                    sc \\remote-machine-name create service-name binpath= path-of-the-service-executable start= service-start-type obj= domainname\username password= password

sc \\client1 create TestService1 binpath= C::\TestService\TestService.exe start= auto obj= testdomain\administrator password= P@ssword

Advantages:          Can be achieved with pure coding without the need of any third-party tool.

Limitations:           Requires .Net framework to be installed on the destination computer.

 

3.       WMI: Using WMI (Windows Management Instrumentation) class Win32_Process to execute a process on a remote computer.

Syntax:                    string command = "notepad.exe";

                object[] theProcessToRun = { cmd };

                ConnectionOptions theConnection = new ConnectionOptions();

                theConnection.Username = "administrator";

                theConnection.Password = "P@ssword";

                string machineName = "client1";

                ManagementScope theScope = new ManagementScope("\\\\" + machineName + "\\root\\cimv2", theConnection);

                ManagementClass theClass = new ManagementClass(theScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());

theClass.InvokeMethod("Create", theProcessToRun);

                Advantages:          WMI provides one of the best functionalities to monitor and administer remote computers.

                Limitations:           WMI exceptions should be provided in firewall settings of the remote computers.

                                                Win32_Process cannot execute a process which do not reside physically on that computer. For that matter even mapping network drive does not work with Win32_Process.

 

4.       Scheduled Tasks: Creating scheduled tasks on the remote computer and making those tasks to execute a required process or a program.

Syntax:                    For pre-Vista computers

schtasks /Create /S remote-machine-name /RU domainname\username /RP password /U domainname\username /P password /SC ONCE /TN scheduled-task-name /TR file-to-be-executed /ST start-time /V1

schtasks /Create /S client1 /RU testdomain\administrator /RP P@ssword /U testdomain\administrator /P P@ssword /SC ONCE /TN Task001 /TR notepad.exe /ST 15:36 /V1

 

For post-Vista computers

schtasks /Create /S remote-machine-name /U domainname\username /P password /SC ONCE /TN scheduled-task-name /TR file-to-be-executed /ST 16:55

schtasks /Create /S client1 /U testdomain\administrator /P P@ssword /SC ONCE /TN Task001 /TR notepad.exe /ST 16:52

Advantages:          Does not require any pre-requisites such as firewall exceptions, framework or any third-party tool installed.

You can schedule the task according to your timings.

                Limitations:           Nothing as I know of.