Hi all,

Ruby 1.8.2
Windows XP Pro

I'm trying to add a local user account with the following code:

# adsi_test.rb
require "socket"
require "win32ole"

host = Socket.gethostname

adsi = WIN32OLE.connect("WinNT://#{host},Computer")
u = adsi.create("user","bar")
u.setpassword("999fooBarQ2343")
u.setinfo # Boom!

It chokes on the setinfo call with this:

win32.rb:345:in `method_missing': setinfo (WIN32OLERuntimeError)
    OLE error code:800708C5 in <Unknown>
      <No Description>
    HRESULT error code:0x80020009
      Exception occurred.       from win32.rb:345:in `add_user'
        from win32.rb:385

Where "800708C5" is the error code for a password policy violation,
which generally means it's too short or has been used previously.
However, no matter what password I try, I get the same error.

What am I doing wrong?

Regards,

Dan