Services

By Spartacus on Sep 10, 2007

Usage: /services
Result of use:
Opens window @services if not already open.
(If the window was previously opened, it clears the buffer)
Then the script proceeds to list all currently running services and what the status of those services is.

alias services { 
  var %a,%b,%c,%d,%e
  %a = a $+ $ticks
  %b = b $+ $ticks 
  %c = c $+ $ticks 
  %d = 1
  .comopen %a wbemscripting.swbemlocator
  if (!$comerr) {  
    .comclose %a $com(%a,connectserver,3,dispatch* %b)
    if ($com(%b)) { 
      .comclose %b $com(%b,instancesof,3,bstr,win32_service,dispatch* %c) 
      if ($com(%c)) { 
        noop $com(%c,count,3)
        %e = $com(%c).result
        if (!$window(@services)) { 
          window -ek[0] @services
        }
        else { 
          clear @services
        }
        while (%d <= %e) {  
          aline @services Service Name -> $comval(%c,%d,displayname) 
          aline @services Status -> $comval(%c,%d,state)
          inc %d
        }
        .comclose %c
      }
    }
  }
  else { echo -a * /services: component object model error. }
}

Comments

Sign in to comment.
guest598594   -  Nov 19, 2007

wow i didnt know i had that many services running :P

 Respond  
Korvin   -  Nov 19, 2007

this is a usefull snippet, i dont know why some1 would rate it 4.0 =] 8/10

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.