Wmi event when the remote Host is booting up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sakthikumarb
    New Member
    • Sep 2008
    • 19

    Wmi event when the remote Host is booting up

    Hi,

    How can i get event for remote host is booting up,there is any wmi mechanism for the same.if not,what is the other procedure to get a event for remote host bootup/startup time .

    Thanks in advance,

    Regards,
    Sakthi
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    "How can i get event for remote host is booting up,there is any wmi mechanism for the same.if not,what is the other procedure to get a event for remote host bootup/startup time ."

    Code:
    using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\CIMV2\REMOTECOMPUTER NAME", "SELECT LastBootUpTime FROM Win32_OperatingSystem"))
     
                          {
    
                              foreach (ManagementObject queryObj in searcher.Get())
    
                              {
    
                                  strRet = (Convert.ToString(queryObj["LastBootUpTime"]).Trim());
      
                              }
     
                          }

    Comment

    • PRR
      Recognized Expert Contributor
      • Dec 2007
      • 750

      #3
      Check this thread too

      Comment

      • sakthikumarb
        New Member
        • Sep 2008
        • 19

        #4
        Originally posted by dirtbag
        hi dirtbag.. from the code you posted ...i'll get the last bootup time after i connected to the particular host ..but i need to generate a event from remote host after boot up..

        Comment

        • cloud255
          Recognized Expert Contributor
          • Jun 2008
          • 427

          #5
          Not exatly WMI, but you could write a tiny service which launches at startup on the host and contacts your app...

          Comment

          • PRR
            Recognized Expert Contributor
            • Dec 2007
            • 750

            #6
            Originally posted by sakthikumarb
            hi dirtbag.. from the code you posted ...i'll get the last bootup time after i connected to the particular host ..but i need to generate a event from remote host after boot up..
            try what cloud255 said... do a service on local host and after start up connect to server/ application...
            for remote connection usin WMI you also need to use:
            ConnectionOptio n

            i guess you will have to go with a service hosted on localpc .. which then communicates with the server on startup...

            Comment

            Working...