From 6f01e7a9d7e77cc137b4bfd27f10f98aa9ba0768 Mon Sep 17 00:00:00 2001 From: Nicholas Kasprinski Date: Tue, 5 Feb 2019 17:43:13 -0800 Subject: [PATCH 1/2] changed from pkgmgr to DISM to allow for the features to be enabled correctly --- scripts/installs/setup_iis.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installs/setup_iis.bat b/scripts/installs/setup_iis.bat index 632ecfb..b62cbe8 100644 --- a/scripts/installs/setup_iis.bat +++ b/scripts/installs/setup_iis.bat @@ -1 +1 @@ -start /w PKGMGR.EXE /quiet /norestart /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-FTPServer;IIS-FTPSvc;IIS-FTPExtensibility; \ No newline at end of file +DISM /Online /Enable-Feature /FeatureName:IIS-WebServerRole /FeatureName:IIS-WebServer /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASPNET /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ASP /FeatureName:IIS-CGI /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-ServerSideIncludes /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-FTPExtensibility \ No newline at end of file From c21d1c0f9e51fc44a697c6fb46cdedf11795ad4a Mon Sep 17 00:00:00 2001 From: Nicholas Kasprinski Date: Tue, 5 Feb 2019 17:44:34 -0800 Subject: [PATCH 2/2] moved the setup_iis.bat to an elevated powershell script in order to activate the features --- packer/templates/windows_2008_r2.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packer/templates/windows_2008_r2.json b/packer/templates/windows_2008_r2.json index 7df9061..57d8417 100644 --- a/packer/templates/windows_2008_r2.json +++ b/packer/templates/windows_2008_r2.json @@ -183,6 +183,12 @@ { "type": "windows-restart" }, + { + "type": "powershell", + "elevated_user": "Administrator", + "elevated_password": "vagrant", + "scripts": "{{user `scripts_dir`}}/installs/setup_iis.bat" + }, { "type": "windows-shell", "remote_path": "C:/Windows/Temp/script.bat", @@ -192,7 +198,6 @@ "{{user `scripts_dir`}}/chocolatey_installs/7zip.bat", "{{user `scripts_dir`}}/configs/apply_password_settings.bat", "{{user `scripts_dir`}}/configs/create_users.bat", - "{{user `scripts_dir`}}/installs/setup_iis.bat", "{{user `scripts_dir`}}/installs/setup_ftp_site.bat", "{{user `scripts_dir`}}/chocolatey_installs/java.bat" ]