summaryrefslogtreecommitdiff
path: root/chef-utils/lib/chef-utils/dsl/windows.rb
diff options
context:
space:
mode:
Diffstat (limited to 'chef-utils/lib/chef-utils/dsl/windows.rb')
-rw-r--r--chef-utils/lib/chef-utils/dsl/windows.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/chef-utils/lib/chef-utils/dsl/windows.rb b/chef-utils/lib/chef-utils/dsl/windows.rb
index 86d8fb00bc..904e9ef126 100644
--- a/chef-utils/lib/chef-utils/dsl/windows.rb
+++ b/chef-utils/lib/chef-utils/dsl/windows.rb
@@ -20,6 +20,8 @@ require_relative "../internal"
module ChefUtils
module DSL
module Windows
+ require "chef-utils/version_string"
+
include Internal
# Determine if the current node is Windows Server Core.
@@ -52,6 +54,26 @@ module ChefUtils
node["kernel"]["product_type"] == "Server"
end
+ # 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. IE: NT 6.3 is Windows 8.1 and Windows 2012 R2.
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [ChefUtils::VersionString]
+ #
+ def windows_nt_version(node = __getnode)
+ ChefUtils::VersionString.new(node["os_version"])
+ end
+
+ # Determine the installed version of PowerShell
+ #
+ # @param [Chef::Node] node
+ #
+ # @return [ChefUtils::VersionString]
+ #
+ def powershell_version(node = __getnode)
+ ChefUtils::VersionString.new(node["languages"]["powershell"]["version"])
+ end
+
extend self
end
end