Skip to content

Instantly share code, notes, and snippets.

@solvip
Last active December 13, 2015 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solvip/c07e032ff7858aa53932 to your computer and use it in GitHub Desktop.
Save solvip/c07e032ff7858aa53932 to your computer and use it in GitHub Desktop.
include_recipe "windows"
# Match for Windows 2012
if node["platform"] == "windows" and node["os_version"] =~ /6\.2(.*)/
# Windows 2012 and it's SXS...
# Copy the SXS files from the Chef server.
remote_directory "#{node[:rb_net_framework][:sxs_dir]}" do
source "win_sxs_sources"
not_if { windows_feature.installed? "NetFx3" } # I'd like something in this direction, if possible.
end
windows_batch "install_netfx3" do
code <<-EOH
c:/windows/sysnative/dism.exe /online /enable-feature /featurename:NetFx3 /norestart /all /source:#{node[:rb_net_framework][:sxs_dir]}
EOH
action :run
end
windows_feature "NetFx4ServerFeatures" do
action :install
end
#Match for Windows 2008
elsif node["platform"] == "windows" and node["os_version"] =~ /6\.1(.*)/
windows_feature "NetFx3" do
action :install
end
else
# Unsupported platform. Bail out.
return "#{node['platform']} is not supported by the #{cookbook_name}::#{recipe_name} recipe"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment