user1595214
user1595214

Reputation: 551

Powershell script with Restart of machine in between

My requirement is to add Role services in windows 2008 R2 machine.And i am using command like this

Import-Module ServerManager
Add-WindowsFeature "Web-Server" -Restart:$true
Write-Host "i am back after installation"
Add-WindowsFeature "Application-Server" -Restart:$true 

But this -restart:$true is not actually re-starting the system.If this not the way how i can achieve this.Because addition of one role services expects a restart and after that only i will be able to add another role. Please help :)

Upvotes: 0

Views: 161

Answers (1)

alroc
alroc

Reputation: 28144

Add-WindowsFeature accepts a string[] (array of strings) for the -Name parameter. You should be able to add multiple features by calling the cmdlet only once.

Add-WindowsFeature -Name "Web-Server","Application-Server"

Then restart the server.

Upvotes: 2

Related Questions