<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>haripotter's technorati</title>
	<atom:link href="http://haripotter.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://haripotter.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 07 Aug 2011 20:28:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='haripotter.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>haripotter's technorati</title>
		<link>http://haripotter.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://haripotter.wordpress.com/osd.xml" title="haripotter&#039;s technorati" />
	<atom:link rel='hub' href='http://haripotter.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to determine the QTP test script name?</title>
		<link>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-qtp-test-script-name/</link>
		<comments>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-qtp-test-script-name/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 18:36:03 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=89</guid>
		<description><![CDATA[For reporting purposes, there may be a need for you to determine the current testscript name within the code. Below is the code. Please see this to get the code for determinining if the test is being executed from QC or not. Public function sGetCurrentTestScriptName() Dim qtApp 'As QuickTest.Application ' Declare the Application object variable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=89&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For reporting purposes, there may be a need for you to determine the current testscript name within the code. Below is the code. Please see <a href="http://haripotter.wordpress.com/2009/04/02/how-to-determine-if-a-test-is-executed-from-quality-center-test-lab/">this</a> to get the code for determinining if the test is being executed from QC or not.</p>
<p><code><br />
Public function sGetCurrentTestScriptName()<br />
	Dim qtApp 'As QuickTest.Application ' Declare the Application object variable<br />
	Dim qtTestName</p>
<p>if(IsExecutedFromQC()) then<br />
	sGetCurrentTestScriptName = qcutil.CurrentTest.Name<br />
else<br />
    Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object<br />
    sGetCurrentTestScriptName = qtApp.Test.Name<br />
    Set qtApp = Nothing ' Release the Application object<br />
end if<br />
End Function<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=89&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-qtp-test-script-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to determine the IP address of local system?</title>
		<link>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-ip-address-of-local-system/</link>
		<comments>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-ip-address-of-local-system/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 18:23:44 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=84</guid>
		<description><![CDATA[Ofcourse, this is trivial. You open a command prompt and type IPCONFIG to see the ip address of the local system. On Linux System you would type ifconfig eth0 in a shell window to see the ip address in eth0. But how do we do this within QTP for automation purposes ? There are many [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=84&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ofcourse, this is trivial. You open a command prompt and type <strong><code>IPCONFIG</code></strong> to see the ip address of the local system. On Linux System you would type <strong><code>ifconfig eth0</code></strong> in a shell window to see the ip address in eth0. But how do we do this within QTP for automation purposes ? There are many ways. Below is one way to get the IP address.</p>
<p>Below is the code to obtain the ipaddress using WMI<br />
<code><br />
Function LocalHostIPAddress()<br />
   strComputer = "."<br />
	Set objWMIService = GetObject("winmgmts:" _<br />
	&amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2")</p>
<p>    Set ColItems = objWMIService.ExecQuery _<br />
	("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")</p>
<p>    For Each objitem In ColItems<br />
		strIP = Join(objitem.IPAddress, ",")<br />
		strIPAddress = strIP<br />
    Next<br />
	LocalHostIPAddress = strIPAddress<br />
End Function<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=84&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-ip-address-of-local-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to determine the date and time on a remote system using WMI ?</title>
		<link>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-date-and-time-on-a-remote-system-using-wmi/</link>
		<comments>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-date-and-time-on-a-remote-system-using-wmi/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 18:18:50 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=81</guid>
		<description><![CDATA[How to determine the date and time on a remote system using WMI ? At times, there may be a need to sync your QTP client systems time with a remote system before executing a test. There are otherways to sync windows system time such as NTP servers. Below is one way to getting the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=81&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How to determine the date and time on a remote system using WMI ?</p>
<p>At times, there may be a need to sync your QTP client systems time with a remote system before executing a test. There are otherways to sync windows system time such as NTP servers. Below is one way to getting the target system time using WMI. Setting the local system time will be another function that I&#8217;ll post later.</p>
<p><code><br />
Function tGetTargetSystemDateTime(ByVal hostname, ByVal username, ByVal password)</p>
<p>Reporter.Filter=3<br />
tGetTargetSystemDateTime = ""<br />
wbemImpersonationLevelImpersonate = 3<br />
wbemAuthenticationLevelPktPrivacy = 6</p>
<p>Set objLocator = CreateObject("WbemScripting.SWbemLocator")<br />
Set objWMIService = objLocator.ConnectServer _<br />
(hostname, "root\cimv2",username ,password)</p>
<p>objWMIService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate<br />
objWMIService.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy<br />
'Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2")</p>
<p>Set colItems = objWMIService.ExecQuery("Select * From Win32_OperatingSystem")</p>
<p>For Each objItem in colItems<br />
	strTime = objItem.LocalDateTime<br />
	tGetTargetSystemDateTime = WMIDateStringToDate(strTime)<br />
	Exit For<br />
Next</p>
<p>Set colItems = nothing<br />
Set objWMIService = nothing<br />
Set objLocator = nothing</p>
<p>Reporter.Filter=0<br />
End Function<br />
</code></p>
<p><code><br />
Private Function WMIDateStringToDate(ByVal strTime)<br />
 WMIDateStringToDate = CDate(Mid(strTime, 5, 2) &amp; "/" &amp; _<br />
 Mid(strTime, 7, 2) &amp; "/" &amp; Left(strTime, 4) _<br />
 &amp; " " &amp; Mid (strTime, 9, 2) &amp; ":" &amp; _<br />
 Mid(strTime, 11, 2) &amp; ":" &amp; Mid(strTime, _<br />
 13, 2))<br />
End Function<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=81&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2010/12/28/how-to-determine-the-date-and-time-on-a-remote-system-using-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to determine if a test is executed from Quality center test lab</title>
		<link>http://haripotter.wordpress.com/2009/04/02/how-to-determine-if-a-test-is-executed-from-quality-center-test-lab/</link>
		<comments>http://haripotter.wordpress.com/2009/04/02/how-to-determine-if-a-test-is-executed-from-quality-center-test-lab/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 20:29:04 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=61</guid>
		<description><![CDATA[Hmmm. I&#8217;m back after a long time.  Okay.. lets get started.. How do we know if the test is being executed from a testset in testlab module of HP Quality center ?.. During development of the test script, we have to execute the code to see if the testscript is performing the test the way [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=61&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hmmm. I&#8217;m back after a long time.  Okay.. lets get started.. How do we know if the test is being executed from a testset in testlab module of HP Quality center ?.. During development of the test script, we have to execute the code to see if the testscript is performing the test the way we wanted it to. We execute them directly from QTP IDE, even though we have connected to QC from QTP IDE. Let&#8217;s say one of your function does something that is dependent on the testscript name. Usually we use qcutil.CurrentTest.Name to determine the testscript name. But if we are not connected to QC, then this call will fail. In that situation, if we want to know if the test is executed from QC or from local system, we can use this function. Here&#8217;s the function. Enjoy.. In another post, I&#8217;ll provide the code for determining the testscript name irespective of whether QTP is connected to QC or not.</p>
<p><span id="more-61"></span><br />
<code><br />
Public function IsExecutedFromQC()<br />
 Dim CurrentTSTest<br />
 if qcutil.IsConnected then<br />
  Reporter.ReportEvent micPass,"Connected to QC", "Connected to Quality Center Server: " &amp; qcutil.QCConnection.ServerName &amp; vbcrlf &amp; _<br />
  "Project : " &amp; qcutil.QCConnection.ProjectName &amp; vbcrlf &amp; " Domain : " &amp; qcutil.QCConnection.DomainName<br />
  Set CurrentTSTest = qcutil.CurrentTestSetTest<br />
  if CurrentTSTest is Nothing then<br />
   Reporter.ReportEvent micFail,"IsExecutedFromQC", "QTP is connected to quality center server. But the test is **not** executed from a Testlab in QC"<br />
   IsExecutedFromQC = FALSE<br />
  else<br />
   Reporter.ReportEvent micPass,"IsExecutedFromQC", "The test is executed from a Testlab in QC"<br />
   IsExecutedFromQC = TRUE<br />
  end if<br />
 else<br />
  Reporter.ReportEvent micDone,"IsExecutedFromQC", "QTP is not connected to quality center server"<br />
  IsExecutedFromQC = FALSE<br />
 end if <br />
   <br />
End Function</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=61&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2009/04/02/how-to-determine-if-a-test-is-executed-from-quality-center-test-lab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How do we send email from QTP ?</title>
		<link>http://haripotter.wordpress.com/2008/08/08/how-do-we-send-email-from-qtp/</link>
		<comments>http://haripotter.wordpress.com/2008/08/08/how-do-we-send-email-from-qtp/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 16:39:09 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[HP Quality Center and QTP]]></category>
		<category><![CDATA[cdo]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[qtp]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=43</guid>
		<description><![CDATA[We can send an email from a QTP testscript by using the below function. It uses CDO.Message object to perform that action. We use the SMTP Server to deliver the email message to the concerned email ID. Please update the values as per your environment. This function sends a email attachment to specified email address. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=43&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We can send an email from a QTP testscript by using the below function. It uses CDO.Message object to perform that action. We use the SMTP Server to deliver the email message to the concerned email ID. Please update the values as per your environment. This function sends a email attachment to specified email address.<br />
<span id="more-43"></span><br />
Call this function as</p>
<blockquote><p>sendEmail(&#8220;c:\testreport.txt&#8221;, &#8220;myemail@mycompany.com&#8221;)</p></blockquote>
<blockquote><p>Function sendEmail(reportfile,sendto)</p>
<p>Set oMessage = CreateObject(&#8220;CDO.Message&#8221;)</p>
<p>&#8216;==This section provides the configuration information for the remote SMTP server.<br />
&#8216;==Normally you will only change the server name or IP.<br />
oMessage.Configuration.Fields.Item _<br />
(&#8220;http://schemas.microsoft.com/cdo/configuration/sendusing&#8221;) = 2</p>
<p>&#8216;Name or IP of Remote SMTP Server<br />
oMessage.Configuration.Fields.Item _<br />
(&#8220;http://schemas.microsoft.com/cdo/configuration/smtpserver&#8221;) = &#8220;Your_smtp_server_name&#8221;</p>
<p>&#8216;Server port (typically 25)<br />
oMessage.Configuration.Fields.Item _<br />
(&#8220;http://schemas.microsoft.com/cdo/configuration/smtpserverport&#8221;) = 25</p>
<p>oMessage.Configuration.Fields.Update<br />
oMessage.Subject = &#8220;Specify the subject here&#8221;<br />
oMessage.Sender = &#8220;Your email ID&#8221;<br />
oMessage.To = sendto<br />
oMessage.CC = &#8220;an email ID&#8221;<br />
oMessage.TextBody = &#8220;Please find the report attached&#8221; &amp;vbcrlf &amp; vbcrlf &amp; &#8220;Thanks&#8221; &amp; vbcrlf &amp; &#8220;your name&#8221;<br />
oMessage.AddAttachment reportfile<br />
oMessage.Send</p>
<p>Set oMessage = Nothing</p>
<p>End Function</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/43/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/43/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=43&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/08/08/how-do-we-send-email-from-qtp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to reboot a Windows System using WMI ?</title>
		<link>http://haripotter.wordpress.com/2008/08/06/how-to-reboot-a-windows-system-using-wmi/</link>
		<comments>http://haripotter.wordpress.com/2008/08/06/how-to-reboot-a-windows-system-using-wmi/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:08:57 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[qtp]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=39</guid>
		<description><![CDATA[If you know the administrator password of a system that you are authorized to use, you can use this function to reboot it for some automation needs. please do not try this on systems that you are not authorized to use. I have shown only the function definition here. You can use this in a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=39&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you know the administrator password of a system that you are authorized to use, you can use this function to reboot it for some automation needs. please do not try this on systems that you are not authorized to use. I have shown only the function definition here. You can use this in a QTP function library.<br />
<span id="more-39"></span></p>
<blockquote><p><code><br />
Sub Reboot_System(ByVal strTargetSystem, ByVal strUserName, ByVal strPassword)</code></p>
<p>Const FORCED_REBOOT = 6<br />
Dim objLocator<br />
Dim objWMIService</p>
<p>wbemImpersonationLevelImpersonate = 3<br />
wbemAuthenticationLevelPktPrivacy = 6<br />
Set objLocator = CreateObject(&#8220;WbemScripting.SWbemLocator&#8221;)<br />
On Error Resume Next<br />
Set objWMIService = objLocator.ConnectServer _<br />
(strTargetSystem, &#8220;root\cimv2&#8243;, strUserName, strPassword)<br />
objWMIService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate<br />
objWMIService.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy</p>
<p>Set colOS = objWMIService.ExecQuery(&#8220;SELECT * FROM Win32_OperatingSystem&#8221;)</p>
<p>For Each objOS In colOS &#8216;only one<br />
intReturn = objOS.Win32Shutdown(FORCED_REBOOT)<br />
If intReturn 0 Then<br />
Reporter.ReportEvent micFail, &#8220;Error: Unable to reboot.&#8221; &amp; VbCrLf &amp; _<br />
&#8220;Return code: &#8221; &amp; intReturn<br />
else<br />
Reporter.ReportEvent micPass, &#8220;Successfully rebooted&#8221; &amp; VbCrLf &amp; _<br />
&#8220;Return code: &#8221; &amp; intReturn<br />
End If<br />
Next</p>
<p>End Sub</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=39&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/08/06/how-to-reboot-a-windows-system-using-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to map a network drive using vbscript ?</title>
		<link>http://haripotter.wordpress.com/2008/08/05/how-to-map-a-network-drive-using-vbscript/</link>
		<comments>http://haripotter.wordpress.com/2008/08/05/how-to-map-a-network-drive-using-vbscript/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 21:40:09 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[map network drive]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=36</guid>
		<description><![CDATA[Sometime back I posted a code to disconnect a network drive using vbscript. Now here is the code to map a local drive to a network path. This again uses WScript.Network object to map the drive. We use the filesystem object to determine if the drive is already mapped. if yes, then disconnect it first [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=36&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometime back I posted a code to disconnect a network drive using vbscript. Now here is the code to map a local drive to a network path. This again uses WScript.Network object to map the drive. We use the filesystem object to determine if the drive is already mapped. if yes, then disconnect it first and then map it to specified path. There are two functions. One will parse the arguments to make sure right number of parameters are passed to the script. Enjoy.<br />
<span id="more-36"></span><br />
<code><br />
'FileName : mapdrive.vbs<br />
'Purpose  : To map a local drive to a network path<br />
'Usage    : cscript //nologo mapdrive.vbs<br />
'To Debug : cscript //D //X //nologo mapdrive.vbs<br />
'Example : cscript //nologo mapdrive.vbs i: \\myserver\data\myshare administrator mypassword<br />
' This code creates a mapped drive to a network path.</p>
<p>Function mapdrive()<br />
' ------ SCRIPT CONFIGURATION ------<br />
strDrive = WScript.Arguments(0)  ' e.g. i:<br />
strPath =  WScript.Arguments(1)<br />
strUser = WScript.Arguments(2)  ' e.g. Administrator<br />
strPassword = WScript.Arguments(3)<br />
boolPersistent = True  ' True = Persistent ; False = Not Persistent<br />
' ------ END CONFIGURATION ---------</p>
<p>set objNetwork = WScript.CreateObject("WScript.Network")<br />
Set ObjFSO = CreateObject("Scripting.FileSystemObject")</p>
<p>'Check and disconnect if the drive is already mapped.<br />
     if(ObjFSO.DriveExists(strDrive)) then<br />
       objNetwork.RemoveNetworkDrive strDrive, True, True<br />
     end if</p>
<p>  objNetwork.MapNetworkDrive strDrive, strPath, boolPersistent, _<br />
                           strUser, strPassword<br />
  if(ObjFSO.DriveExists(strDrive)) then<br />
    WScript.Echo "Successfully mapped drive : " &amp; strDrive &amp; " to " &amp; strPath<br />
  end if</p>
<p>Set ObjFSO = nothing<br />
Set objNetwork = nothing<br />
end function<br />
</code></p>
<p><code><br />
Function parseArgs()<br />
    Dim filelen<br />
    filelen = WScript.Arguments.length<br />
    if filelen &lt; 4	Then<br />
       		WScript.Echo("Usage  : cscript //nologo mapdrive.vbs    ")<br />
       		WScript.Echo("Example : cscript //nologo mapdrive.vbs i: \\myserver\data\myshare administrator mypassword")<br />
    		  WScript.Quit()<br />
    end if<br />
    mapdrive()<br />
End function<br />
</code></p>
<p><code><br />
parseArgs()<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=36&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/08/05/how-to-map-a-network-drive-using-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How do we use QC as Shared repository… ?</title>
		<link>http://haripotter.wordpress.com/2008/08/03/how-do-we-use-qc-as-shared-repository%e2%80%a6/</link>
		<comments>http://haripotter.wordpress.com/2008/08/03/how-do-we-use-qc-as-shared-repository%e2%80%a6/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 06:15:06 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[extended storage]]></category>
		<category><![CDATA[QC]]></category>
		<category><![CDATA[qtp]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=31</guid>
		<description><![CDATA[There was comment posted in this blog asking if we could use QC as a shared repository to store file and update it directly, without downloading to local desktop. I&#8217;m afraid that it is not possible to do without downloading the file to local desktop. But We certainly can use QC as a shared repository [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=31&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There was comment posted in this blog asking if we could use QC as a shared repository to store file and update it directly, without downloading to local desktop. I&#8217;m afraid that it is not possible to do without downloading the file to local desktop. But We certainly can use QC as a shared repository to store files and have it accessible to many tests. There are cases when multiple QTP tests may have a need to access the same file which is stored in the test&#8217;s project repository in QC. When we attach the file to a test, other tests will have to access this attachment through this test. Alternatively, a copy of the same file could be attached to each and every test. That would be a maintenance nightmare. So what would be the solution ? Read on&#8230;<br />
<span id="more-31"></span> </p>
<p>We could use the ExtendedStorage object in OTA API to transport files that are not attachments.<br />
This ExtendedStorage Object allows us to transport files between QTP client and the QC server without having to attach files to specific Quality Center (QC) entities (such as a test).</p>
<p>The following code will upload a file called Trial.mdb from the QTP client to the project repository in QC </p>
<blockquote>
<p>Set currentTest = QCUtil.CurrentTest<br />
Set attachmentFact = currentTest.Attachments<br />
Set extendedStorage = attachmentFact.AttachmentStorage<br />
extendedStorage.serverpath = extendedStorage.serverpath<br />
extendedStorage.clientpath = &#8220;C:\&#8221;<br />
extendedStorage.save &#8220;Trial.mdb&#8221;, true</p>
</blockquote>
<p>The following code can be used to download a file from the project repository to C:\ of the QTP Client: </p>
<blockquote><p>
Set currentTest = QCUtil.CurrentTest<br />
Set attachmentFact = currentTest.Attachments<br />
Set extendedStorage = attachmentFact.AttachmentStorage<br />
extendedStorage.serverpath = extendedStorage.serverpath<br />
extendedStorage.clientpath = &#8220;C:\&#8221;<br />
extendedStorage.load &#8220;trial.mdb&#8221;, true
</p></blockquote>
<p>Notes:</p>
<li>There will not be any error message if the file does not exist in the server.</li>
<li> The file will not be visible from the QC user interface as it is not attached to any QC entity (such as a test). It will, however, exist in the project repository folder on the server. </li>
<li>The QTP test must first be saved in QC for the &#8220;currentTest&#8221; method to return an object. </li>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=31&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/08/03/how-do-we-use-qc-as-shared-repository%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>How to disconnect a network drive using vbscript</title>
		<link>http://haripotter.wordpress.com/2008/08/02/how-to-disconnect-a-network-drive-using-vbscript/</link>
		<comments>http://haripotter.wordpress.com/2008/08/02/how-to-disconnect-a-network-drive-using-vbscript/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 05:47:19 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>
		<category><![CDATA[disconnect]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[qtp]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[WScript.Network]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=29</guid>
		<description><![CDATA[Below is a script to disconnect a network drive using vbscript. We employ the services of WScript.Network object to do the same Enjoy!. There are two functions below. One is the actual disconnect drive and the other one is to parse the command line arguments. We want to make sure the drive letter that has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=29&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Below is a script to disconnect a network drive using vbscript. We employ the services of WScript.Network object to do the same <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Enjoy!. There are two functions below. One is the actual disconnect drive and the other one is to parse the command line arguments. We want to make sure the drive letter that has to be disconnected, is specified as an input parameter to the script.<br />
<span id="more-29"></span></p>
<blockquote><p>
<code><br />
'FileName : disconnectdrive.vbs<br />
'Purpose  : To disconnect specified network drive<br />
'Usage    : Usage  : cscript //nologo disconnectdrive.vbs &lt;drive&gt;<br />
'To Debug : cscript //D //X //nologo disconnectdrive.vbs &lt;drive&gt;<br />
'Example : Usage  : cscript //nologo disconnectdrive.vbs i:<br />
'Date     : 08/01/2008</code></p>
<p>Function disconnectdrive()<br />
set objNetwork = WScript.CreateObject(&#8220;WScript.Network&#8221;)<br />
Set ObjFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
strDrive = WScript.Arguments(0)</p>
<p>     if(ObjFSO.DriveExists(strDrive)) then<br />
       objNetwork.RemoveNetworkDrive strDrive, True, True<br />
       WScript.Echo &#8220;Disconnected network drive : &#8221; &amp; strDrive<br />
     end if</p>
<p>Set ObjFSO = nothing<br />
Set objNetwork = nothing<br />
End function<br />
&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Function parseArgs()<br />
    Dim filelen<br />
    filelen = WScript.Arguments.length    <br />
    if filelen &lt; 1 Then<br />
         WScript.Echo(&#8220;Usage  : cscript //nologo disconnectdrive.vbs &lt;drive&gt;&#8221;)<br />
         WScript.Echo(&#8220;Example : cscript //nologo disconnectdrive.vbs i:&#8221;)<br />
        WScript.Quit()<br />
    end if  <br />
    disconnectdrive()<br />
End function<br />
&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
parseArgs()
</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=29&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/08/02/how-to-disconnect-a-network-drive-using-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
		<item>
		<title>Executing a command on a remote windows system using WMI</title>
		<link>http://haripotter.wordpress.com/2008/07/25/executing-a-command-on-a-remote-windows-system-using-wmi/</link>
		<comments>http://haripotter.wordpress.com/2008/07/25/executing-a-command-on-a-remote-windows-system-using-wmi/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 22:42:11 +0000</pubDate>
		<dc:creator>haripotter</dc:creator>
				<category><![CDATA[HP Quality Center and QTP]]></category>
		<category><![CDATA[qtp]]></category>
		<category><![CDATA[Remote execution]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://haripotter.wordpress.com/?p=25</guid>
		<description><![CDATA[Usually we use psexec tool from sysinternals to execute any program on a remote system. There is another way to execute a command on a remote windows system via WMI (Windows Management Instrumentation). This function would be beneficial to QTP automators because its a vbscript function and can be used in their function libraries (after some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=25&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Usually we use psexec tool from sysinternals to execute any program on a remote system. There is another way to execute a command on a remote windows system via WMI (Windows Management Instrumentation). This function would be beneficial to QTP automators because its a vbscript function and can be used in their function libraries (after some modifications). All you have to do is call this function with the target system name, username, password and the command to execute. The output would be the process if of the process that was initated on the target system. Have fun&#8230;</p>
<p> <span id="more-25"></span><br />
<code><br />
Function RemoteExecute(strServer, strUser, strPassword, strCommand)</p>
<p>Dim objLocator , objWMIService</p>
<p>wbemImpersonationLevelImpersonate = 3<br />
wbemAuthenticationLevelPktPrivacy = 6<br />
RemoteExecute = -1</p>
<p>Set objLocator = CreateObject("WbemScripting.SWbemLocator")</p>
<p>On Error Resume Next<br />
Set objWMIService = objLocator.ConnectServer(strServer,"root\cimv2", strUser,strPassword)</p>
<p>objWMIService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate<br />
objWMIService.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy</p>
<p>If Err.Number &lt;&gt; 0 Then<br />
WScript.Echo "Failed to connect to " &amp;strServer, "Error # " &amp; CStr(Err.Number) &amp; " " &amp; Err.Description &amp; vbcrlf &amp; _<br />
"Please check if " &amp; strServer &amp; " is pingable from this client &amp; credentials are correct"<br />
Err.Clear<br />
On Error GoTo 0<br />
RemoteExecute = -1</p>
<p>Set objWMIService = nothing<br />
Set objLocator = nothing<br />
Exit function<br />
end if</p>
<p>      ' Configure the process to show a window<br />
      Set objStartup = objWMIService.Get("Win32_ProcessStartup")<br />
      Set objConfig = objStartup.SpawnInstance_<br />
      objConfig.ShowWindow = SW_NORMAL<br />
       <br />
        Set Process = objWMIService.Get("Win32_Process")<br />
       <br />
      'Process.Create Syntax: ' <br />
      '       uint32 Create(<br />
      '[in]   string CommandLine,<br />
      '[in]   string CurrentDirectory,<br />
      '[in]   Win32_ProcessStartup ProcessStartupInformation,<br />
      '[out]  uint32 ProcessId<br />
      ');<br />
    <br />
     'Return code Description<br />
      '0     Successful Completion<br />
      '2     Access Denied<br />
      '3     Insufficient Privilege<br />
      '8     Unknown failure<br />
      '9     Path Not Found<br />
      '21    Invalid Parameter<br />
   <br />
        intReturn = Process.Create(strCommand,NULL, objConfig, intProcessID)</p>
<p>        If intReturn &lt;&gt; 0 Then<br />
          Wscript.Echo "Process could not be created." &amp; _<br />
        vbNewLine &amp; "Command line: " &amp; strCommand &amp; _<br />
        vbNewLine &amp; "Return value: " &amp; intReturn<br />
            Wscript.Quit<br />
        Else<br />
          Wscript.Echo "Process created." &amp; _<br />
        vbNewLine &amp; "Command line: " &amp; strCommand &amp; _<br />
        vbNewLine &amp; "Process ID: " &amp; intProcessID<br />
           RemoteExecute = intProcessID<br />
        End If<br />
     </p>
<p>Set objWMIService = nothing<br />
Set objLocator = nothing<br />
 <br />
End Function<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/haripotter.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/haripotter.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haripotter.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haripotter.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haripotter.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haripotter.wordpress.com&amp;blog=2887001&amp;post=25&amp;subd=haripotter&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://haripotter.wordpress.com/2008/07/25/executing-a-command-on-a-remote-windows-system-using-wmi/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9605603d4a15b9a1eb14d3541ea614c9?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haripotter</media:title>
		</media:content>
	</item>
	</channel>
</rss>
