From 1645a89817d997b003903929b2dfba078bbf4f41 Mon Sep 17 00:00:00 2001 From: jcook3221 <70118954+jcook3221@users.noreply.github.com> Date: Fri, 11 Sep 2020 03:49:20 -0500 Subject: [PATCH 1/2] ... --- .vscode/settings.json | 3 +++ configureIISWebApplications.ps1 | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..79e520a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "powershell.codeFormatting.addWhitespaceAroundPipe": true +} \ No newline at end of file diff --git a/configureIISWebApplications.ps1 b/configureIISWebApplications.ps1 index b100594..08eb0d0 100644 --- a/configureIISWebApplications.ps1 +++ b/configureIISWebApplications.ps1 @@ -1,19 +1,19 @@ # IIS Configuration -# +# # Prerequisites: # Set-ExecutionPolicy RemoteSigned # Import-Module WebAdministation (or ability to execute) # If using server try Import-Module ServerManager -# +# # PowerShell gotchas: # String interpolation only works in double quotes "var: $good", not single quotes '$bad' # WebAdministration will not accept / or \ path delimiters, you MUST pass the correct one # Cannot use PowerShell to set ASP.NET Impersonation on a workstation, thanks SO MUCH for that # Set-ItemProperty parameters like applicationPool are case sensitive -# +# $projectName = "myApp" $appPool = ".NET v4.5 Classic" -#Three web application folders are inside this location +# Three web application folders are inside this location $sandbox = "C:\src\myApp\WebApp" $website = "Default Web Site" $clean = $false @@ -26,10 +26,10 @@ $basicAuthFilter = "/system.webServer/security/authentication/basicAuthenticatio if ((Get-Module "WebAdministration" -ErrorAction SilentlyContinue) -eq $null){ Import-Module WebAdministration } -#Servers Only -#if ((Get-Module "ServerManager" -ErrorAction SilentlyContinue) -eq $null) { -# Import-Module ServerManager -#} +# Servers Only +# if ((Get-Module "ServerManager" -ErrorAction SilentlyContinue) -eq $null) { +# Import-Module ServerManager +# } function Create-Application( [string]$appName, [string]$path ) { if ( (Test-Path "IIS:\Sites\$website\$appName") -eq $false ) { @@ -86,7 +86,7 @@ function Enable-AspNetImpersonation( [string]$appName ){ # On a Server with ServerManager loaded, Set-WebConfigurationProperty may work # Since this script runs on a workstation, resort to shelling out to appcmd, as # it can handle the transacted call. Otherwise the properties are read only -# Set-WebConfigurationProperty -filter system.web/identity -name impersonate -value $true -location "$website/$appName" +# Set-WebConfigurationProperty -filter system.web/identity -name impersonate -value $true -location "$website/$appName" $aspNetImpersonation = Get-WebConfigurationProperty -filter system.web/identity -name impersonate -location "$website/$appName" if( $aspNetImpersonation.Value -eq $true ){ From a86bb604e6f10835f96bc40e7c000e208306cb19 Mon Sep 17 00:00:00 2001 From: jcook3221 <70118954+jcook3221@users.noreply.github.com> Date: Fri, 11 Sep 2020 04:17:06 -0500 Subject: [PATCH 2/2] ...\ --- configureIISWebApplications.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/configureIISWebApplications.ps1 b/configureIISWebApplications.ps1 index 08eb0d0..508e992 100644 --- a/configureIISWebApplications.ps1 +++ b/configureIISWebApplications.ps1 @@ -11,7 +11,6 @@ # Cannot use PowerShell to set ASP.NET Impersonation on a workstation, thanks SO MUCH for that # Set-ItemProperty parameters like applicationPool are case sensitive # -$projectName = "myApp" $appPool = ".NET v4.5 Classic" # Three web application folders are inside this location $sandbox = "C:\src\myApp\WebApp"