module ChefUtils::DSL::Windows

Public Instance Methods

powershell_version(node = __getnode) click to toggle source

Determine the installed version of PowerShell.

@param [Chef::Node] node the node to check @since 15.8

@return [ChefUtils::VersionString]

# File lib/chef-utils/dsl/windows.rb, line 79
def powershell_version(node = __getnode)
  ChefUtils::VersionString.new(node["languages"]["powershell"]["version"])
end
windows_nt_version(node = __getnode) click to toggle source

Determine the current Windows NT version. The NT version often differs from the marketing version, but offers a good way to find desktop and server releases that are based on the same codebase. For example NT 6.3 corresponds to Windows 8.1 and Windows 2012 R2.

@param [Chef::Node] node the node to check @since 15.8

@return [ChefUtils::VersionString]

# File lib/chef-utils/dsl/windows.rb, line 68
def windows_nt_version(node = __getnode)
  ChefUtils::VersionString.new(node["os_version"])
end
windows_server?(node = __getnode) click to toggle source

Determine if the current node is Windows Server.

@param [Chef::Node] node the node to check @since 15.7

@return [Boolean]

# File lib/chef-utils/dsl/windows.rb, line 57
def windows_server?(node = __getnode)
  node["kernel"]["product_type"] == "Server"
end
windows_server_core?(node = __getnode) click to toggle source

Determine if the current node is Windows Server Core.

@param [Chef::Node] node the node to check @since 15.7

@return [Boolean]

# File lib/chef-utils/dsl/windows.rb, line 35
def windows_server_core?(node = __getnode)
  node["kernel"]["server_core"] == true
end
windows_workstation?(node = __getnode) click to toggle source

Determine if the current node is Windows Workstation.

@param [Chef::Node] node the node to check @since 15.7

@return [Boolean]

# File lib/chef-utils/dsl/windows.rb, line 46
def windows_workstation?(node = __getnode)
  node["kernel"]["product_type"] == "Workstation"
end