Method: Windows::Group#group_list_using_powershell

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

#group_list_using_powershellObject

using powershell commands as wmic is deprecated in windows 2025



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/beaker/host/windows/group.rb', line 18

def group_list_using_powershell
  execute('cmd /c echo "" | powershell.exe "Get-LocalGroup | Select-Object -ExpandProperty Name"') do |result|
    groups = []
    result.stdout.each_line do |line|
      groups << line.strip or next
    end

    yield result if block_given?

    groups
  end
end