Restart-IISOnServers

Added this to the MO_Module to remote in and restart just the IIS service on a single computer or a list of computers. Easy enough to do without a function, but I added some logic and Write-Verbose information to help the person running the command to see the content easier and quick.

This will restart IIS on the following computers: PC1, PC2, PC3, PC4:

Restart-IISOnServers -Computer PC1,PC2,PC3,PC4

This will restart IIS on a single computer: DC1

Restart-IISOnServers -Computer DC1

The other reason this could of more interest than just a command line option, is that PowerShell 7 is working on a -parallel parameter with the ForEach-Object cmdlet. In a workflow, that option was available, but with the deprecation of workflows in general, it will be nice if they can at least bring back this parallel option in native PowerShell.

Similar Posts