# New project ( was Re: logging off windows users remotely wit

**URL:** <https://www.ruby-forum.com/t/new-project-was-re-logging-off-windows-users-remotely-wit/105741>\
**Category:** Ruby\
**Created:** [June 2, 2007, 12:08am UTC](https://www.ruby-forum.com/t/new-project-was-re-logging-off-windows-users-remotely-wit/105741 "2007-06-02T00:08:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gordon321](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d2c977/32.png) [@gordon321](https://www.ruby-forum.com/u/gordon321)\
**Post date:** [June 2, 2007, 12:08am UTC](https://www.ruby-forum.com/t/new-project-was-re-logging-off-windows-users-remotely-wit/105741/1 "2007-06-02T00:08:25Z")

</div>

> > > Any help? I know it can be done with vbscript and wmi, but I really  
> > > really want to accomplish this using some ruby as I am trying to  
> > > introduce more of it in our company
> 
> Additionally you can use WMI through Win32OLE, and issue the commands that way.

I’ve been playing around with a library that would provide an  
activerecord style interface to WMI. So, instead of this:

`
require 'win32ole'
LOGOFF = 0
computer_name = ‘host’
wmi = WIN32OLE.connect(“winmgmts:\\#{computer_name}\root\cimv2”)
list = wmi.execquery(“Select * from Win32_OperatingSystem”,nil,48)
list.each do |item|
item.win32Shutdown(LOGOFF)
end
`

You’d have something like this:

`
require 'wmi' # or whatever it's going to be called
LOGOFF = 0
computer_name = ‘host’
os = WMI::Win32_OperatingSystem.new(computer_name)
host = os.find(:first, :condition => {:primary => true})
host.win32shutdown(LOGOFF)
`

My aim is to have an easier to read, more rubyesque way to work with  
WMI. I’ve been thinking about opening a rubyforge project if there’s  
any interest. But I don’t know what to call the thing. Here is a list  
of names I’ve come up with. I don’t really like any of them, though, so  
I’m open to other suggestions.

active\_wmi  
ar\_wmi  
wmi\_rb  
ruby-wmi  
rWMI  
wmi4r

Thanks,

Gordon

---

<div class="post-metadata">

**Author:** ![gordon321](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/d2c977/32.png) [@gordon321](https://www.ruby-forum.com/u/gordon321)\
**Post date:** [June 2, 2007, 2:57am UTC](https://www.ruby-forum.com/t/new-project-was-re-logging-off-windows-users-remotely-wit/105741/2 "2007-06-02T02:57:37Z")

</div>

From: Gordon T. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] :

# active\_wmi

# ar\_wmi

# wmi\_rb

# ruby-wmi

# rWMI

# wmi4r

me vote for ruby-wmi
