Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .Synopsis
- Install IIS and Windows required features, for 1 or more computers.
- Requires PS3
- Requires Windows 2008 R2 or higher
- .Description
- To see the current list of installed features, use [Get-WindowsFeature]
- The system must be rebooted after installation
- To remove a feature, use... Remove-WindowsFeature, eg Remove-WindowsFeature bits
- .Example
- Install-IIS -ComputerSet "Dennis2008R2SP1","localhost"
- .Example
- Install-IIS "Dennis2008R2SP1","localhost"
- .Example
- "Dennis2008R2SP1","localhost" | Install-IIS
- #>
- function Install-IIS
- {
- Param (
- [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
- [string[]]
- $ComputerName
- )
- Begin {
- Import-Module ServerManager
- }
- Process {
- foreach ($computer in $ComputerName) {
- "Processing [$computer]..."
- $session = New-PSSession -ComputerName $computer
- Invoke-Command -Session $session -ScriptBlock {
- Add-WindowsFeature Application-Server, NPAS, BITS, Web-Server, Net-Framework, RDS-RD-Server -IncludeAllSubFeature -Restart -Concurrent
- }
- Remove-PSSession $session
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment