3535
3636# Create hash table for New-PASSession parameters
3737$pasAuth = @ {
38- BaseURI = $pasBaseURI.Trim ().ToLower()
38+ BaseURI = $pasBaseURI.Trim ().ToLower()
3939}
4040
4141# Switch case depending on authentication method chosen
@@ -110,7 +110,7 @@ if (!$(Get-PASApplication -AppID AIMWebService)) {
110110 Write-Output " ==> [FAILED] could not create AIMWebService App ID" | Color Red
111111 exit 1
112112 }
113- # If AIMWebService App ID IS found...
113+ # If AIMWebService App ID IS found...
114114} else {
115115 Write-Output " ==> [SKIPPED] detected AIMWebService App ID" | Color Yellow
116116}
@@ -122,7 +122,7 @@ Add-PASApplicationAuthenticationMethod -AppID AIMWebService -path "C:\inetpub\ww
122122Write-Output " ==> [SUCCESS] Added Path Authentication" | Color Green
123123
124124# # Add OSUser Authentication
125- Add-PASApplicationAuthenticationMethod - AppID AIMWebService - osuser " IISAPPPOOL\DefaultAppPool"
125+ Add-PASApplicationAuthenticationMethod - AppID AIMWebService - osUser " IISAPPPOOL\DefaultAppPool"
126126Write-Output " ==> [SUCCESS] Added OSUser Authentication" | Color Green
127127
128128# # Add Hash Authentication
@@ -135,12 +135,16 @@ Add-PASApplicationAuthenticationMethod -AppID AIMWebService -hash $aamHashValue[
135135Write-Output " ==> [SUCCESS] Added Hash Authentication" | Color Green
136136
137137# # Add Machine Address Authentication
138- # # # Find local host's IP address from ipconfig
139- $aamMachineAddress = ipconfig | findstr / i IPv4 | Out-String
140- # # # Trim off starting and ending notation
141- $aamMachineAddress = $aamMachineAddress.TrimStart (" IPv4 Address. . . . . . . . . . . : " )
142- $aamMachineAddress = $aamMachineAddress.TrimEnd (" `r`n " )
143- Add-PASApplicationAuthenticationMethod - AppID AIMWebService - machineAddress $aamMachineAddress - ErrorAction SilentlyContinue
144- Write-Output " ==> [SUCCESS] Added Machine Address Authentication" | Color Green
138+ # # # Find local host's IP address from Get-NetIPAddress
139+ $aamMachineIP = (Get-NetIPAddress - AddressState Preferred - AddressFamily IPv4).IPAddress
140+
141+ # # # Loop thru returned addresses and omit loopback
142+ foreach ( $ip in $aamMachineIP ){
143+ if (" 127.0.0.1" -ne $ip ) {
144+ # # # Add IP address
145+ Add-PASApplicationAuthenticationMethod - AppID AIMWebService - machineAddress $ip - ErrorAction SilentlyContinue
146+ Write-Output " ==> [SUCCESS] Added $ip to Machine Address Authentication" | Color Green
147+ }
148+ }
145149
146150Write-Output " `r`n`r`n *** Completed AIMWebService hardening successfully. ***" | Color Cyan
0 commit comments