<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7846901549365114431</id><updated>2011-12-26T02:58:22.503-08:00</updated><category term='start'/><title type='text'>Hey, Programming Guy</title><subtitle type='html'>This is a blog discussing the techniques in window management using various tools</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-8633740866476628367</id><published>2010-01-22T00:54:00.001-08:00</published><updated>2010-01-22T00:54:55.008-08:00</updated><title type='text'>ASP JScript for restarting IIS</title><content type='html'>&lt;pre&gt;&amp;lt;script language="JScript" runat="server"&gt;&lt;br /&gt;try{&lt;br /&gt;  var fullPath = "IIS://localhost/W3svc/1",&lt;br /&gt;  oServer = GetObject(fullPath);&lt;br /&gt;  Response.write("Restarting web server in progress.&lt;br/&gt;");&lt;br /&gt;  Response.write(" Please connect later!");&lt;br /&gt;  oServer.Stop();&lt;br /&gt;  oServer.Start();&lt;br /&gt;}catch(e){&lt;br /&gt;  Response.write("Can't stop web server");&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-8633740866476628367?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/8633740866476628367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=8633740866476628367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/8633740866476628367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/8633740866476628367'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2010/01/asp-jscript-for-restarting-iis.html' title='ASP JScript for restarting IIS'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-3487937032796828007</id><published>2010-01-22T00:05:00.000-08:00</published><updated>2010-01-22T00:07:03.571-08:00</updated><title type='text'>ASP JScript for Reboot a computer</title><content type='html'>&lt;pre&gt;&amp;lt;script language="JScript" runat="server"&gt;&lt;br /&gt;var objWMIService=GetObject(&lt;br /&gt;  "winmgmts:{(Shutdown)}\\\\.\\root\\cimv2"&lt;br /&gt;);&lt;br /&gt;var colItems=objWMIService.ExecQuery(&lt;br /&gt;  "Select * from Win32_OperatingSystem"&lt;br /&gt;);&lt;br /&gt;var items = new Enumerator(colItems);&lt;br /&gt;while (!items.atEnd()){&lt;br /&gt;  items.item().Win32Shutdown(6);&lt;br /&gt;  exit;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-3487937032796828007?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/3487937032796828007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=3487937032796828007' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/3487937032796828007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/3487937032796828007'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2010/01/asp-jscript-for-reboot-computer.html' title='ASP JScript for Reboot a computer'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-7915773431606738853</id><published>2009-08-31T21:01:00.000-07:00</published><updated>2009-09-11T01:12:37.422-07:00</updated><title type='text'>How do I write an ActiveX Ping Object?</title><content type='html'>I provide the source code first, and I will explain it later:&lt;br /&gt;&lt;p class="hello-world"&gt;Hello&lt;/p&gt;&lt;pre&gt;VERSION 5.00&lt;br /&gt;Begin VB.UserControl PingObj &lt;br /&gt;   ClientHeight    =   3600&lt;br /&gt;   ClientLeft      =   0&lt;br /&gt;   ClientTop       =   0&lt;br /&gt;   ClientWidth     =   4800&lt;br /&gt;   InvisibleAtRuntime=   -1  'True&lt;br /&gt;   ScaleHeight     =   3600&lt;br /&gt;   ScaleWidth      =   4800&lt;br /&gt;   Windowless      =   -1  'True&lt;br /&gt;End&lt;br /&gt;Attribute VB_Name = "PingObj"&lt;br /&gt;Attribute VB_GlobalNameSpace = False&lt;br /&gt;Attribute VB_Creatable = True&lt;br /&gt;Attribute VB_PredeclaredId = False&lt;br /&gt;Attribute VB_Exposed = True&lt;br /&gt;Private Const IP_SUCCESS As Long = 0&lt;br /&gt;Private Const IP_STATUS_BASE As Long = 11000&lt;br /&gt;Private Const IP_BUF_TOO_SMALL As Long = (11000 + 1)&lt;br /&gt;Private Const IP_DEST_NET_UNREACHABLE As Long = (11000 + 2)&lt;br /&gt;Private Const IP_DEST_HOST_UNREACHABLE As Long = (11000 + 3)&lt;br /&gt;Private Const IP_DEST_PROT_UNREACHABLE As Long = (11000 + 4)&lt;br /&gt;Private Const IP_DEST_PORT_UNREACHABLE As Long = (11000 + 5)&lt;br /&gt;Private Const IP_NO_RESOURCES As Long = (11000 + 6)&lt;br /&gt;Private Const IP_BAD_OPTION As Long = (11000 + 7)&lt;br /&gt;Private Const IP_HW_ERROR As Long = (11000 + 8)&lt;br /&gt;Private Const IP_PACKET_TOO_BIG As Long = (11000 + 9)&lt;br /&gt;Private Const IP_REQ_TIMED_OUT As Long = (11000 + 10)&lt;br /&gt;Private Const IP_BAD_REQ As Long = (11000 + 11)&lt;br /&gt;Private Const IP_BAD_ROUTE As Long = (11000 + 12)&lt;br /&gt;Private Const IP_TTL_EXPIRED_TRANSIT As Long = (11000 + 13)&lt;br /&gt;Private Const IP_TTL_EXPIRED_REASSEM As Long = (11000 + 14)&lt;br /&gt;Private Const IP_PARAM_PROBLEM As Long = (11000 + 15)&lt;br /&gt;Private Const IP_SOURCE_QUENCH As Long = (11000 + 16)&lt;br /&gt;Private Const IP_OPTION_TOO_BIG As Long = (11000 + 17)&lt;br /&gt;Private Const IP_BAD_DESTINATION As Long = (11000 + 18)&lt;br /&gt;Private Const IP_ADDR_DELETED As Long = (11000 + 19)&lt;br /&gt;Private Const IP_SPEC_MTU_CHANGE As Long = (11000 + 20)&lt;br /&gt;Private Const IP_MTU_CHANGE As Long = (11000 + 21)&lt;br /&gt;Private Const IP_UNLOAD As Long = (11000 + 22)&lt;br /&gt;Private Const IP_ADDR_ADDED As Long = (11000 + 23)&lt;br /&gt;Private Const IP_GENERAL_FAILURE As Long = (11000 + 50)&lt;br /&gt;Private Const MAX_IP_STATUS As Long = (11000 + 50)&lt;br /&gt;Private Const IP_PENDING As Long = (11000 + 255)&lt;br /&gt;Private Const PING_TIMEOUT As Long = 500&lt;br /&gt;Private Const WS_VERSION_REQD As Long = &amp;H101&lt;br /&gt;Private Const MIN_SOCKETS_REQD As Long = 1&lt;br /&gt;Private Const SOCKET_ERROR As Long = -1&lt;br /&gt;Private Const INADDR_NONE As Long = &amp;HFFFFFFFF&lt;br /&gt;Private Const MAX_WSADescription As Long = 256&lt;br /&gt;Private Const MAX_WSASYSStatus As Long = 128&lt;br /&gt;&lt;br /&gt;Public Type ICMP_OPTIONS&lt;br /&gt;    Ttl             As Byte&lt;br /&gt;    Tos             As Byte&lt;br /&gt;    Flags           As Byte&lt;br /&gt;    OptionsSize     As Byte&lt;br /&gt;    OptionsData     As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type ICMP_ECHO_REPLY&lt;br /&gt;    Address         As Long&lt;br /&gt;    Status          As Long&lt;br /&gt;    RoundTripTime   As Long&lt;br /&gt;    DataSize        As Long 'formerly integer&lt;br /&gt;   'Reserved        As Integer&lt;br /&gt;    DataPointer     As Long&lt;br /&gt;    Options         As ICMP_OPTIONS&lt;br /&gt;    Data            As String * 250&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type WSADATA&lt;br /&gt;   wVersion As Integer&lt;br /&gt;   wHighVersion As Integer&lt;br /&gt;   szDescription(0 To MAX_WSADescription) As Byte&lt;br /&gt;   szSystemStatus(0 To MAX_WSASYSStatus) As Byte&lt;br /&gt;   wMaxSockets As Long&lt;br /&gt;   wMaxUDPDG As Long&lt;br /&gt;   dwVendorInfo As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Declare Function IcmpCreateFile Lib "icmp.dll" () As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function IcmpCloseHandle Lib "icmp.dll" _&lt;br /&gt;   (ByVal IcmpHandle As Long) As Long&lt;br /&gt;   &lt;br /&gt;Private Declare Function IcmpSendEcho Lib "icmp.dll" _&lt;br /&gt;   (ByVal IcmpHandle As Long, _&lt;br /&gt;    ByVal DestinationAddress As Long, _&lt;br /&gt;    ByVal RequestData As String, _&lt;br /&gt;    ByVal RequestSize As Long, _&lt;br /&gt;    ByVal RequestOptions As Long, _&lt;br /&gt;    ReplyBuffer As ICMP_ECHO_REPLY, _&lt;br /&gt;    ByVal ReplySize As Long, _&lt;br /&gt;    ByVal Timeout As Long) As Long&lt;br /&gt;    &lt;br /&gt;Private Declare Function WSAGetLastError Lib "wsock32" () As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function WSAStartup Lib "wsock32" _&lt;br /&gt;   (ByVal wVersionRequired As Long, _&lt;br /&gt;    lpWSADATA As WSADATA) As Long&lt;br /&gt;    &lt;br /&gt;Private Declare Function WSACleanup Lib "wsock32" () As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function gethostname Lib "wsock32" _&lt;br /&gt;   (ByVal szHost As String, _&lt;br /&gt;    ByVal dwHostLen As Long) As Long&lt;br /&gt;    &lt;br /&gt;Private Declare Function gethostbyname Lib "wsock32" _&lt;br /&gt;   (ByVal szHost As String) As Long&lt;br /&gt;&lt;br /&gt;Private Declare Sub CopyMemory Lib "kernel32" _&lt;br /&gt;   Alias "RtlMoveMemory" _&lt;br /&gt;  (xDest As Any, _&lt;br /&gt;   xSource As Any, _&lt;br /&gt;   ByVal nbytes As Long)&lt;br /&gt;   &lt;br /&gt;Private Declare Function inet_addr Lib "wsock32" _&lt;br /&gt;   (ByVal s As String) As Long&lt;br /&gt;Private ECHO As ICMP_ECHO_REPLY&lt;br /&gt;Dim StatusCode As String&lt;br /&gt;Dim Address As String&lt;br /&gt;Dim RTT As Long&lt;br /&gt;Dim Size As Long&lt;br /&gt;Dim ReceiveData As String&lt;br /&gt;Dim Pointer As Long&lt;br /&gt;&lt;br /&gt;Public Function Ping(IPAddress, Content)&lt;br /&gt;   Dim pos As Long&lt;br /&gt;   Dim success As Long&lt;br /&gt;   If SocketsInitialize() Then&lt;br /&gt;     'ping the IP by passing the address,&lt;br /&gt;     'text to send, and the ECHO structure.&lt;br /&gt;      success = Pinging((IPAddress), (Content), ECHO)&lt;br /&gt;     'display the results&lt;br /&gt;      StatusCode = GetStatusCode(success)&lt;br /&gt;      Address = "" &amp; ECHO.Address&lt;br /&gt;      RTT = ECHO.RoundTripTime&lt;br /&gt;      Size = ECHO.DataSize&lt;br /&gt;      If Left$(ECHO.Data, 1) &lt;&gt; Chr$(0) Then&lt;br /&gt;         pos = InStr(ECHO.Data, Chr$(0))&lt;br /&gt;         ReceiveData = Left$(ECHO.Data, pos - 1)&lt;br /&gt;      End If&lt;br /&gt;      Pointer = ECHO.DataPointer&lt;br /&gt;      SocketsCleanup&lt;br /&gt;   End If&lt;br /&gt;   Ping = StatusCode&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Public Function GetStatusCode(Status As Long) As String&lt;br /&gt;&lt;br /&gt;   Dim msg As String&lt;br /&gt;   &lt;br /&gt;   Select Case Status&lt;br /&gt;      Case IP_SUCCESS:               msg = "ip success"&lt;br /&gt;      Case INADDR_NONE:              msg = "inet_addr: bad IP format"&lt;br /&gt;      Case IP_BUF_TOO_SMALL:         msg = "ip buf too_small"&lt;br /&gt;      Case IP_DEST_NET_UNREACHABLE:  msg = "ip dest net unreachable"&lt;br /&gt;      Case IP_DEST_HOST_UNREACHABLE: msg = "ip dest host unreachable"&lt;br /&gt;      Case IP_DEST_PROT_UNREACHABLE: msg = "ip dest prot unreachable"&lt;br /&gt;      Case IP_DEST_PORT_UNREACHABLE: msg = "ip dest port unreachable"&lt;br /&gt;      Case IP_NO_RESOURCES:          msg = "ip no resources"&lt;br /&gt;      Case IP_BAD_OPTION:            msg = "ip bad option"&lt;br /&gt;      Case IP_HW_ERROR:              msg = "ip hw_error"&lt;br /&gt;      Case IP_PACKET_TOO_BIG:        msg = "ip packet too_big"&lt;br /&gt;      Case IP_REQ_TIMED_OUT:         msg = "ip req timed out"&lt;br /&gt;      Case IP_BAD_REQ:               msg = "ip bad req"&lt;br /&gt;      Case IP_BAD_ROUTE:             msg = "ip bad route"&lt;br /&gt;      Case IP_TTL_EXPIRED_TRANSIT:   msg = "ip ttl expired transit"&lt;br /&gt;      Case IP_TTL_EXPIRED_REASSEM:   msg = "ip ttl expired reassem"&lt;br /&gt;      Case IP_PARAM_PROBLEM:         msg = "ip param_problem"&lt;br /&gt;      Case IP_SOURCE_QUENCH:         msg = "ip source quench"&lt;br /&gt;      Case IP_OPTION_TOO_BIG:        msg = "ip option too_big"&lt;br /&gt;      Case IP_BAD_DESTINATION:       msg = "ip bad destination"&lt;br /&gt;      Case IP_ADDR_DELETED:          msg = "ip addr deleted"&lt;br /&gt;      Case IP_SPEC_MTU_CHANGE:       msg = "ip spec mtu change"&lt;br /&gt;      Case IP_MTU_CHANGE:            msg = "ip mtu_change"&lt;br /&gt;      Case IP_UNLOAD:                msg = "ip unload"&lt;br /&gt;      Case IP_ADDR_ADDED:            msg = "ip addr added"&lt;br /&gt;      Case IP_GENERAL_FAILURE:       msg = "ip general failure"&lt;br /&gt;      Case IP_PENDING:               msg = "ip pending"&lt;br /&gt;      Case PING_TIMEOUT:             msg = "ping timeout"&lt;br /&gt;      Case Else:                     msg = "unknown  msg returned"&lt;br /&gt;   End Select&lt;br /&gt;   &lt;br /&gt;   GetStatusCode = CStr(Status) &amp; "   [ " &amp; msg &amp; " ]"&lt;br /&gt;   &lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Private Function Pinging(sAddress As String, _&lt;br /&gt;                     sDataToSend As String, _&lt;br /&gt;                     ECHO As ICMP_ECHO_REPLY) As Long&lt;br /&gt;&lt;br /&gt;  'If Ping succeeds :&lt;br /&gt;  '.RoundTripTime = time in ms for the ping to complete,&lt;br /&gt;  '.Data is the data returned (NULL terminated)&lt;br /&gt;  '.Address is the Ip address that actually replied&lt;br /&gt;  '.DataSize is the size of the string in .Data&lt;br /&gt;  '.Status will be 0&lt;br /&gt;  '&lt;br /&gt;  'If Ping fails .Status will be the error code&lt;br /&gt;   &lt;br /&gt;   Dim hPort As Long&lt;br /&gt;   Dim dwAddress As Long&lt;br /&gt;   &lt;br /&gt;  'convert the address into a long representation&lt;br /&gt;   dwAddress = inet_addr(sAddress)&lt;br /&gt;   &lt;br /&gt;  'if a valid address..&lt;br /&gt;   If dwAddress &lt;&gt; INADDR_NONE Then&lt;br /&gt;   &lt;br /&gt;     'open a port&lt;br /&gt;      hPort = IcmpCreateFile()&lt;br /&gt;      &lt;br /&gt;     'and if successful,&lt;br /&gt;      If hPort Then&lt;br /&gt;      &lt;br /&gt;        'ping it.&lt;br /&gt;         Call IcmpSendEcho(hPort, _&lt;br /&gt;                           dwAddress, _&lt;br /&gt;                           sDataToSend, _&lt;br /&gt;                           Len(sDataToSend), _&lt;br /&gt;                           0, _&lt;br /&gt;                           ECHO, _&lt;br /&gt;                           Len(ECHO), _&lt;br /&gt;                           PING_TIMEOUT)&lt;br /&gt;&lt;br /&gt;        'return the status as ping succes and close&lt;br /&gt;         Pinging = ECHO.Status&lt;br /&gt;         Call IcmpCloseHandle(hPort)&lt;br /&gt;      &lt;br /&gt;      End If&lt;br /&gt;      &lt;br /&gt;   Else:&lt;br /&gt;        'the address format was probably invalid&lt;br /&gt;         Pinging = INADDR_NONE&lt;br /&gt;         &lt;br /&gt;   End If&lt;br /&gt;  &lt;br /&gt;End Function&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;Private Sub SocketsCleanup()&lt;br /&gt;   &lt;br /&gt;   If WSACleanup() &lt;&gt; 0 Then&lt;br /&gt;       MsgBox "Windows Sockets error occurred in Cleanup.", vbExclamation&lt;br /&gt;   End If&lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Private Function SocketsInitialize() As Boolean&lt;br /&gt;&lt;br /&gt;   Dim WSAD As WSADATA&lt;br /&gt;   &lt;br /&gt;   SocketsInitialize = WSAStartup(WS_VERSION_REQD, WSAD) = IP_SUCCESS&lt;br /&gt;    &lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-7915773431606738853?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/7915773431606738853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=7915773431606738853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/7915773431606738853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/7915773431606738853'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2009/08/how-do-i-write-activex-ping-object.html' title='How do I write an ActiveX Ping Object?'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-6213830876029603521</id><published>2009-08-31T20:52:00.000-07:00</published><updated>2009-08-31T20:52:03.248-07:00</updated><title type='text'>How do I check the disk space of a remote computer within my domain?</title><content type='html'>&lt;em&gt;Hey, Programming Guy! How do I check the disk space of a remote computer within my domain?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Leonardo&lt;/em&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp&lt;/p&gt;&lt;br /&gt;Leonardo, you can use the WMIService's Win32_LogicalDisk. Say, if you want to check the size of the c:, you can use the following query:&lt;br /&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;Select * from Win32_LogicalDisk Where DeviceID = 'C:'&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Thus, if you want to check the drive c's diskspace remotely, the following code should be convenient for you:&lt;br /&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;    Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")&lt;br /&gt;    Set objWMIService = objWbemLocator.ConnectServer(strComputer, "root\cimv2",strUser,strPass)&lt;br /&gt;    Set colOSName = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DeviceID = 'C:'")&lt;br /&gt;    For Each objItem in colOSName&lt;br /&gt;      WScript.Echo strComputer &amp; ": " &amp; objItem.Caption&lt;br /&gt;    Next&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Or, you can wrap everything together to become a command. Save the following code into a file with filename: disspace.wsf:&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&amp;lt;?xml version="1.0"?&gt;&lt;br /&gt;&amp;lt;package&gt;&lt;br /&gt;&amp;lt;job&gt;&lt;br /&gt;&amp;lt;script language="vbscript"&gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;  syntax = false&lt;br /&gt;  If WScript.arguments.count = 3 Then&lt;br /&gt;    strComputer = WScript.arguments(0)&lt;br /&gt;    strUser = WScript.arguments(1)&lt;br /&gt;    strPass = WScript.arguments(2)&lt;br /&gt;    syntax = True&lt;br /&gt;  ElseIf WScript.arguments.count = 1 Then&lt;br /&gt;    strComputer = WScript.arguments(0)&lt;br /&gt;    WScript.StdOut.write "User name:"&lt;br /&gt;    strUser = WScript.StdIn.ReadLine&lt;br /&gt;    WScript.StdOut.write "Password:"&lt;br /&gt;    strPass = WScript.StdIn.ReadLine&lt;br /&gt;    syntax = True&lt;br /&gt;  ElseIf WScript.arguments.count = 0 Then&lt;br /&gt;    WScript.StdOut.Write "Computer Name or IP:"&lt;br /&gt;    strComputer = WScript.StdIn.ReadLine&lt;br /&gt;    WScript.StdOut.write "User name:"&lt;br /&gt;    strUser = WScript.StdIn.ReadLine&lt;br /&gt;    WScript.StdOut.write "Password:"&lt;br /&gt;    strPass = WScript.StdIn.ReadLine&lt;br /&gt;    syntax = True&lt;br /&gt;  End If&lt;br /&gt;  If syntax Then&lt;br /&gt;    Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")&lt;br /&gt;    Set objWMIService = objWbemLocator.ConnectServer(strComputer, "root\cimv2",strUser,strPass)&lt;br /&gt;    Set colOSName = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DeviceID = 'C:'")&lt;br /&gt;    For Each objItem in colOSName&lt;br /&gt;      WScript.Echo strComputer &amp; ": " &amp; objItem.Caption&lt;br /&gt;    Next&lt;br /&gt;  Else&lt;br /&gt;    WScript.Echo "diskspace.wsf [ip] [user] [password]"&lt;br /&gt;  End If&lt;br /&gt;]]&gt;&lt;br /&gt;&amp;lt;/script&gt;&lt;br /&gt;&amp;lt;/job&gt;&lt;br /&gt;&amp;lt;/package&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-6213830876029603521?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/6213830876029603521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=6213830876029603521' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/6213830876029603521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/6213830876029603521'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2009/08/how-do-i-check-disk-space-of-remote.html' title='How do I check the disk space of a remote computer within my domain?'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-7439603293025613657</id><published>2009-07-14T22:48:00.000-07:00</published><updated>2009-07-14T23:04:50.865-07:00</updated><title type='text'>How can I ping an ip address remotely by ASP</title><content type='html'>&lt;em&gt;Hey, Programming Guy! How can I ping an ip address remotely by ASP from an IIS server?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Jennifer&lt;/em&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp&lt;/p&gt;&lt;br /&gt;Hi, Jennifer, we can use WScript.Shell to run a shell command to achieve this. Suppose the IIS have the access right for ping.exe which is located at system32 path inside windows. You can use the following VBScript by setting the id as a parameter to the destinated computer:&lt;br/&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;&amp;lt;%&lt;br /&gt;url = Trim(Request("ip"))&lt;br /&gt;if url&lt;&gt;"" Then&lt;br /&gt;  Set objWShell = CreateObject("WScript.Shell") &lt;br /&gt;  Set objCmd = objWShell.Exec("ping " &amp; url) &lt;br /&gt;  strPResult = objCmd.StdOut.Readall() &lt;br /&gt;  set objCmd = nothing: Set objWShell = nothing &lt;br /&gt; &lt;br /&gt;  strStatus = "offline" &lt;br /&gt;  if InStr(strPResult,"TTL=")&gt;0 then strStatus = "online" &lt;br /&gt; &lt;br /&gt;  response.write  strStatus &lt;br /&gt;End If&lt;br /&gt;%&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-7439603293025613657?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/7439603293025613657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=7439603293025613657' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/7439603293025613657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/7439603293025613657'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2009/07/how-can-ping-ip-address-remotely-by-asp.html' title='How can I ping an ip address remotely by ASP'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-6207341625052272119</id><published>2009-07-14T04:29:00.000-07:00</published><updated>2009-07-14T23:18:59.583-07:00</updated><title type='text'>Latest Resources</title><content type='html'>&lt;strong&gt;Other Resources&lt;/strong&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://cloudgen.pbworks.com"&gt;Cloudgen PBWorks&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://cloudgen.w0ng.hk"&gt;Cloudgen Demonstration Center I&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://twitter.com/cloudgen"&gt;Cloudgen twitter&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://cloudgen.spaces.live.com/"&gt;Cloudgen spaces&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://programmingguy.blogspot.com/"&gt;Cloudgen programming blog: Hey,Programming Guy&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://www.wretch.cc/blog/cloudgen"&gt;Cloudgen Javascript Laboratory&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://hk.myblog.yahoo.com/cloudgen-blog"&gt;Cloudgen Javascript Laboratory (Chinese Version)&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://www.facebook.com/people/Cloudgen-Cf-Wong/100000055807219"&gt;Cloudgen Facebook&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://www.bytemycode.com/members/member/Cloudgen/"&gt;Cloudgen byteMyCode&lt;/a&gt;&lt;/li&gt; &lt;br /&gt;&lt;li&gt;&lt;a href="http://sites.google.com/site/cloudgen0/"&gt;Cloudgen Google site&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://my.opera.com/cloudgen/blog/"&gt;My opera, Cloudgen current project&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://cloudgen.brinkster.net/"&gt;Fans of Classic ASP (FOCA)&lt;/a&gt; by Cloudgen&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;strong&gt;Latest Blog Articles from &lt;a href="http://www.wretch.cc/blog/cloudgen"&gt;Cloudgen Javascript Laboratory&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;July 15, 2009: "&lt;a href="http://www.wretch.cc/blog/cloudgen/418742"&gt;One line properties setter and getter for Javascript class&lt;/a&gt;"&lt;/li&gt;&lt;br /&gt;&lt;li&gt;July 14, 2009: "&lt;a href="http://www.wretch.cc/blog/cloudgen/415573"&gt;A javascript class for retrieving query string&lt;/a&gt;"&lt;/li&gt;&lt;br /&gt;&lt;li&gt;July 7, 2009: "&lt;a href="http://www.wretch.cc/blog/cloudgen/382688"&gt;Load a cross-server javascript dynamically&lt;/a&gt;"&lt;/li&gt;&lt;br /&gt;&lt;li&gt;July 6, 2009: "&lt;a href="http://www.wretch.cc/blog/cloudgen/379350"&gt;Make a javascript function lazy&lt;/a&gt;"&lt;/li&gt;&lt;br /&gt;&lt;li&gt;July 6, 2009: "&lt;a href="http://www.wretch.cc/blog/cloudgen/379282"&gt;Add property to Javascript Object in "jQuery" style&lt;/a&gt;"&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;strong&gt;Latest Blog Articles from &lt;a href="http://cloudgen.spaces.live.com/"&gt;Cloudgen spaces&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;July 13, 2009: "&lt;a href="http://cloudgen.spaces.live.com/blog/cns!1A5E93007A672FCB!127.entry"&gt;The regular expression for validation of the format of email with checking TLDs&lt;/a&gt;"&lt;br /&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-6207341625052272119?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/6207341625052272119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=6207341625052272119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/6207341625052272119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/6207341625052272119'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2009/07/latest-resources.html' title='Latest Resources'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-4909395815007405875</id><published>2009-07-01T23:35:00.000-07:00</published><updated>2009-07-01T23:39:26.517-07:00</updated><title type='text'>How can I write a VB 6.0 program showing icons in Systray?</title><content type='html'>&lt;em&gt;Hey, Programming Guy! How can I write a program showing an icon in system tray automatically involve the notepad.exe to open a file, sending keys to close the notepad and check if any virus such as W32.virut.CF has modified an html file?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- K.O.&lt;/em&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;Dim Counter&lt;br /&gt;' Type passed to Shell_NotifyIcon&lt;br /&gt;Private Type NotifyIconData&lt;br /&gt;  Size As Long&lt;br /&gt;  Handle As Long&lt;br /&gt;  ID As Long&lt;br /&gt;  Flags As Long&lt;br /&gt;  CallBackMessage As Long&lt;br /&gt;  Icon As Long&lt;br /&gt;  Tip As String * 64&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;' Constants for managing System Tray tasks, foudn in shellapi.h&lt;br /&gt;Private Const AddIcon = &amp;H0&lt;br /&gt;Private Const ModifyIcon = &amp;H1&lt;br /&gt;Private Const DeleteIcon = &amp;H2&lt;br /&gt;&lt;br /&gt;Private Const WM_MOUSEMOVE = &amp;H200&lt;br /&gt;Private Const WM_LBUTTONDBLCLK = &amp;H203&lt;br /&gt;Private Const WM_LBUTTONDOWN = &amp;H201&lt;br /&gt;Private Const WM_LBUTTONUP = &amp;H202&lt;br /&gt;&lt;br /&gt;Private Const WM_RBUTTONDBLCLK = &amp;H206&lt;br /&gt;Private Const WM_RBUTTONDOWN = &amp;H204&lt;br /&gt;Private Const WM_RBUTTONUP = &amp;H205&lt;br /&gt;&lt;br /&gt;Private Const MessageFlag = &amp;H1&lt;br /&gt;Private Const IconFlag = &amp;H2&lt;br /&gt;Private Const TipFlag = &amp;H4&lt;br /&gt;&lt;br /&gt;Private Declare Function Shell_NotifyIcon _&lt;br /&gt;  Lib "shell32" Alias "Shell_NotifyIconA" ( _&lt;br /&gt;  ByVal Message As Long, Data As NotifyIconData) As Boolean&lt;br /&gt;&lt;br /&gt;Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _&lt;br /&gt;(ByVal lpClassName As String, ByVal lpWindowName As String) As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function PostMessage Lib "user32" _&lt;br /&gt;   Alias "PostMessageA" _&lt;br /&gt;  (ByVal hwnd As Long, _&lt;br /&gt;   ByVal wMsg As Long, _&lt;br /&gt;   ByVal wParam As Long, _&lt;br /&gt;   lParam As Long) As Long&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Const WM_CLOSE = &amp;H10&lt;br /&gt;Private Data As NotifyIconData&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Private Sub Form_Load()&lt;br /&gt;    &lt;br /&gt;    If App.PrevInstance Then&lt;br /&gt;        MsgBox "The checking has been started alreay.", vbCritical&lt;br /&gt;        End&lt;br /&gt;    End If&lt;br /&gt;    Counter = 10&lt;br /&gt;    AddIconToTray&lt;br /&gt;    Visible = False&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Form_Terminate()&lt;br /&gt;  DeleteIconFromTray&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub AddIconToTray()&lt;br /&gt;&lt;br /&gt;  Data.Size = Len(Data)&lt;br /&gt;  Data.Handle = hwnd&lt;br /&gt;  Data.ID = vbNull&lt;br /&gt;  Data.Flags = IconFlag Or TipFlag Or MessageFlag&lt;br /&gt;  Data.CallBackMessage = WM_MOUSEMOVE&lt;br /&gt;  Data.Icon = Icon&lt;br /&gt;  Data.Tip = "Checking Files" &amp; vbNullChar&lt;br /&gt;  Call Shell_NotifyIcon(AddIcon, Data)&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub DeleteIconFromTray()&lt;br /&gt;  Call Shell_NotifyIcon(DeleteIcon, Data)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Form_MouseMove(Button As Integer, _&lt;br /&gt;  Shift As Integer, X As Single, Y As Single)&lt;br /&gt;&lt;br /&gt;  Dim Message As Long&lt;br /&gt;  Message = X / Screen.TwipsPerPixelX&lt;br /&gt;&lt;br /&gt;  Select Case Message&lt;br /&gt;    Case WM_LBUTTONDBLCLK&lt;br /&gt;      Visible = Not Visible&lt;br /&gt;      WindowState = Abs(Not Visible)&lt;br /&gt;  End Select&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Timer1_Timer()&lt;br /&gt;    Dim UIHandle As Long&lt;br /&gt;    Dim tmp As String, content As String&lt;br /&gt;    Dim n As Integer&lt;br /&gt;    Counter = Counter - 1&lt;br /&gt;    If Counter = 0 Then&lt;br /&gt;        Timer1.Interval = 60000&lt;br /&gt;        Counter = 10&lt;br /&gt;        Shell "Notepad.exe c:\test.html", vbNormalFocus&lt;br /&gt;        &lt;br /&gt;        UIHandle = FindWindow(vbNullString, "test.html - Notepad")&lt;br /&gt;        PostMessage UIHandle, WM_CLOSE, 0&amp;, 0&amp;&lt;br /&gt;        content = ""&lt;br /&gt;    &lt;br /&gt;        n = FreeFile&lt;br /&gt;        Open "C:\test.html" For Input As #n&lt;br /&gt;        Do While Not EOF(1)&lt;br /&gt;            Line Input #n, tmp&lt;br /&gt;            content = content &amp; tmp&lt;br /&gt;        Loop&lt;br /&gt;        Close #n&lt;br /&gt;        If InStr(1, content, "&lt;" &amp; "iframe") &gt; 0 Then MsgBox "Virus found! Please contact IT Staff!", vbCritical, "Virus Checker"&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-4909395815007405875?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/4909395815007405875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=4909395815007405875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/4909395815007405875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/4909395815007405875'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2009/07/how-can-i-write-vb-60-program-showing.html' title='How can I write a VB 6.0 program showing icons in Systray?'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-4891125392645649421</id><published>2008-01-29T01:07:00.000-08:00</published><updated>2008-01-29T17:44:53.606-08:00</updated><title type='text'>How can I access the System Time on a Remote PC using Iron Python?</title><content type='html'>&lt;em&gt;Hey, Programming Guy! How can I access the system time on a remote computer using Iron Python?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- K.O.&lt;/em&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size:8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;import clr, time, sys&lt;br /&gt;sys.stdout.write( "Computer Name or IP:")&lt;br /&gt;computername = sys.stdin.readline().replace("\n","")&lt;br /&gt;sys.stdout.write( "Login name:")&lt;br /&gt;username = sys.stdin.readline().replace("\n","")&lt;br /&gt;sys.stdout.write( "Password:")&lt;br /&gt;password = sys.stdin.readline().replace("\n","")&lt;br /&gt;clr.AddReference("System.Management")&lt;br /&gt;from System.Management  import *&lt;br /&gt;connOpts = ConnectionOptions()&lt;br /&gt;connOpts.Username = username&lt;br /&gt;connOpts.Password = password&lt;br /&gt;scope = ManagementScope("\\\\" + computername + "\\root\\cimv2", connOpts)&lt;br /&gt;scope.Connect()&lt;br /&gt;query = ManagementObjectSearcher("Select * from win32_OperatingSystem")&lt;br /&gt;query.Scope = scope&lt;br /&gt;for result in query.Get():&lt;br /&gt;  strTime = time.strptime(result.GetPropertyValue("LocalDateTime")[0:14],"%Y%m%d%H%M%S")&lt;br /&gt;  print time.strftime("%Y/%m/%d %H:%M:%S",strTime)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-4891125392645649421?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/4891125392645649421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=4891125392645649421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/4891125392645649421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/4891125392645649421'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2008/01/how-can-i-access-system-time-on-remote_29.html' title='How can I access the System Time on a Remote PC using Iron Python?'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7846901549365114431.post-2521835081312256246</id><published>2008-01-28T22:57:00.000-08:00</published><updated>2008-02-08T22:15:04.037-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='start'/><title type='text'>How can I access the System Time on a Remote PC using VB.NET?</title><content type='html'>&lt;em&gt;Hey, Programming Guy! How can I access the system time on a remote computer using VB.Net?&lt;/em&gt;&lt;br /&gt;&lt;em&gt;- Sweena&lt;/em&gt;&lt;br /&gt;Hi, Sweena, there are two different techniques for accessing the resources of a remote computer using Visual Basic Dot Net, namely: WMI Scripting and Dot Net's Management package. The first example demonstrate how to retrieve the system time of a remote computer using WMI Scripting Object. The second example uses the Dot Net's Management package for accessing the system time of a remote computer:&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size: 8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;Imports System.Net.NetworkInformation&lt;br /&gt;Imports WbemScripting&lt;br /&gt;&lt;br /&gt;Public Class Form1&lt;br /&gt;&lt;br /&gt;    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;        MsgBox(getSystemTime("192.168.1.1", "Administrator", "password"))&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Private Function getSystemTime(ByVal TargetIP As String, ByVal LoginName As String, ByVal Password As String) As String&lt;br /&gt;        Dim oPing As Ping&lt;br /&gt;        oPing = New Ping&lt;br /&gt;        getSystemTime = ""&lt;br /&gt;        If oPing.Send(TargetIP).Status = IPStatus.Success Then&lt;br /&gt;            Dim objWbemLocator As SWbemLocator&lt;br /&gt;            Dim objWMIservice As SWbemServices&lt;br /&gt;            Dim objWMIobjectSet As SWbemObjectSet&lt;br /&gt;            Dim objColumn As SWbemObject&lt;br /&gt;            Dim strTime As String&lt;br /&gt;            objWbemLocator = New SWbemLocator&lt;br /&gt;            objWMIservice = objWbemLocator.ConnectServer(TargetIP, "root\cimv2", LoginName, Password)&lt;br /&gt;            objWMIobjectSet = objWMIservice.ExecQuery("Select * from Win32_OperatingSystem")&lt;br /&gt;            strTime = ""&lt;br /&gt;            For Each objColumn In objWMIobjectSet&lt;br /&gt;                strTime = objColumn.Properties_.Item("LocalDateTime").Value&lt;br /&gt;            Next&lt;br /&gt;            getSystemTime = strTime.Substring(8, 2) &amp;amp; ":" &amp;amp; strTime.Substring(10, 2) &amp;amp; ":" &amp;amp; strTime.Substring(12, 2)&lt;br /&gt;        End If&lt;br /&gt;    End Function&lt;br /&gt;End Class&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="display: block;font-family: Courier New;font-size: 8pt; overflow:auto;background: #fff url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y;border: 1px solid #f2984c;padding: 10px 10px 10px 21px;max-height:200px;line-height: 1.2em;"&gt;&lt;br /&gt;Imports System.Net.NetworkInformation&lt;br /&gt;Imports System.Management&lt;br /&gt;&lt;br /&gt;Public Class Form1&lt;br /&gt;    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;        MsgBox(getSystemTime("192.168.1.1", "Administrator", "password"))&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Private Function getSystemTime(ByVal TargetIP As String, ByVal LoginName As String, ByVal Password As String) As String&lt;br /&gt;        Dim oPing As Ping&lt;br /&gt;        Dim strTime&lt;br /&gt;        oPing = New Ping&lt;br /&gt;        getSystemTime = ""&lt;br /&gt;        strTime = ""&lt;br /&gt;        If oPing.Send(TargetIP).Status = IPStatus.Success Then&lt;br /&gt;            Dim connOpts As ConnectionOptions&lt;br /&gt;            Dim scope As ManagementScope&lt;br /&gt;            Dim query As ManagementObjectSearcher&lt;br /&gt;            Dim objColumn As ManagementBaseObject&lt;br /&gt;            connOpts = New ConnectionOptions&lt;br /&gt;            connOpts.Username = LoginName&lt;br /&gt;            connOpts.Password = Password&lt;br /&gt;            scope = New ManagementScope("\\" &amp; TargetIP &amp; "\root\cimv2", connOpts)&lt;br /&gt;            scope.Connect()&lt;br /&gt;            query = New ManagementObjectSearcher("Select * from Win32_OperatingSystem")&lt;br /&gt;            query.Scope = scope&lt;br /&gt;            For Each objColumn In query.get&lt;br /&gt;                strTime = objColumn.GetPropertyValue("LocalDateTime").ToString&lt;br /&gt;            Next&lt;br /&gt;            getSystemTime = strTime.Substring(8, 2) &amp; ":" &amp; strTime.Substring(10, 2) &amp; ":" &amp; strTime.Substring(12, 2)&lt;br /&gt;        End If&lt;br /&gt;    End Function&lt;br /&gt;End Class&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7846901549365114431-2521835081312256246?l=programmingguy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programmingguy.blogspot.com/feeds/2521835081312256246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7846901549365114431&amp;postID=2521835081312256246' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/2521835081312256246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7846901549365114431/posts/default/2521835081312256246'/><link rel='alternate' type='text/html' href='http://programmingguy.blogspot.com/2008/01/how-can-i-access-system-time-on-remote.html' title='How can I access the System Time on a Remote PC using VB.NET?'/><author><name>Cloudgen</name><uri>http://www.blogger.com/profile/05042641227630203267</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
