Method: Windows::Group#group_list

Defined in:
lib/beaker/host/windows/group.rb

#group_list(&block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/beaker/host/windows/group.rb', line 4

def group_list(&block)
  execute('cmd /c echo "" | wmic group where localaccount="true" get name /format:value') do |result|
    groups = []
    result.stdout.each_line do |line|
      groups << (line.match(/^Name=(.+)$/) or next)[1]
    end

    yield result if block_given?

    groups
  end
end