Module: Facter::Util::Registrypowershell

Defined in:
lib/facter/util/registrypowershell.rb

Class Method Summary collapse

Class Method Details

.powershell_version_string_from_registryObject



2
3
4
5
6
7
8
9
# File 'lib/facter/util/registrypowershell.rb', line 2

def self.powershell_version_string_from_registry
  require 'win32/registry'
  Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine')['PowerShellVersion']
rescue Win32::Registry::Error => e
  Facter.debug "Accessing SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine gave an error: #{e}"
  Facter.debug 'Powershell is probably v1'
  nil
end