:::: MENU ::::

MCSA, MCSD, MCPS, MCTS, MCP, Developer, Consultant, Solution Architect

MCSA, MCSD, MCPS, MCTS - Solution Architect

function CreateSPPorts($rulName,$dispName,$Desc,$direcT,$portToOpen,$protoCol,$actOn,$prg,$Grp)

{

    $params = @{

    DisplayName = $dispName

    Action = $actOn

    Description = $Desc

    Direction = $direcT   

    LocalPort = @($portToOpen)

    Name = $rulName

    Program = $prg

    Profile = 'Any'

    Group = $Grp

    Protocol = $protoCol

    }

 

 

    Write-Host "Creating Rule for " $rulName " Port " $portToOpen " In/Out Bound " $direcT -ForegroundColor Cyan   

    New-NetFirewallRule @params

  

}

Function Main()

{

   Import-Module NetSecurity -ErrorAction SilentlyContinue  

   Write-Host "Creating SharePoint Firewall Ports" -ForegroundColor Cyan

   CreateSPPorts "SP 2019 Distributed Cache" "SP 2019 Distributed Cache" "Custom SP 2019 Specific Ports" "Inbound" 22233,22236 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 Distributed Cache" "SP 2019 Distributed Cache" "Custom SP 2019 Specific Ports" "Outbound" 22233,22236 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 People Picker" "SP 2019 People Picker" "Custom SP 2019 Specific Ports" "Inbound" 53,88,135,137,138,139,389,445,636,749,750,3268,3269 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 People Picker" "SP 2019 People Picker" "Custom SP 2019 Specific Ports" "Outbound" 53,88,135,137,138,139,389,445,636,749,750,3268,3269 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 Service Applications" "SP 2019 Service Applications" "Custom SP 2019 Specific Ports" "Inbound" 32843,32844 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 Service Applications" "SP 2019 Service Applications" "Custom SP 2019 Specific Ports" "Outbound" 32843,32844 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 WCF Services" "SP 2019 WCF Services" "Custom SP 2019 Specific Ports" "Inbound" 808 "TCP" "Allow" "Any" "Any"

   CreateSPPorts "SP 2019 WCF Services" "SP 2019 WCF Services" "Custom SP 2019 Specific Ports" "Outbound" 808 "TCP" "Allow" "Any" "Any"

   New-NetFirewallRule -DisplayName "SP 2019 Search Index Service" -Action Allow -Description "Custom SP 2019 Specific Ports" -Direction Inbound -EdgeTraversalPolicy Allow -LocalPort 16500-16519 -Name "SP 2019 Search Index Service" -Program Any -Protocol TCP

   New-NetFirewallRule -DisplayName "SP 2019 Search Index Service" -Action Allow -Description "Custom SP 2019 Specific Ports" -Direction Outbound -EdgeTraversalPolicy Allow -LocalPort 16500-16519 -Name "SP 2019 Search Index Service" -Program Any -Protocol TCP

   Write-Host "Completed Creating SharePoint Firewall Ports" -ForegroundColor Green

  

}

 

Main  

 Write-Host "Mount Windows Server ISO File" -ForegroundColor Cyan

Mount-DiskImage -ImagePath $winImagePath

Write-Host "Completed Mounting Windows Server ISO File" -ForegroundColor Green

 

############# INSTALLING WINDOWS FEATURES###########

Import-Module ServerManager

Write-Host "Installing Windows Features" -ForegroundColor Cyan

Add-WindowsFeature Web-Server,Web-WebServer,Net-Framework-Features,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,

Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,

Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,

Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,

Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer –Source $winSource

Write-Host "Completed Installing Windows Features" -ForegroundColor Green

 

############# DISMOUNTING ISO FILE###########

Write-Host "Dismounting Windows Server ISO File" -ForegroundColor Cyan

Dismount-DiskImage -ImagePath $winImagePath

Write-Host "Completed Dismounting Windows Server ISO File" -ForegroundColor Green
Want more information? Contact