Author Posts

January 1, 2012 at 12:00 am

by PSILU at 2013-02-15 08:38:41

folks,
I am learning powershell and I am looking for help. I need to restart the IIS from 30 computers at one go . it is weekly maintenance task that I do . i want to automate this with the help of powershell. i also need to check the service is running fine. the IIS installed on windows server 2008 R2.

please guide me.

Regards,
PSILU

by JasonHelmick at 2013-02-15 08:51:22

Hi PSILU!

If you want to restart just IIS

Invoke-Command -ComputerName comp1,comp2,comp3 {iisreset /restart}

To restart the entire computer

Restart-computer -ComputerName comp1, comp2,comp3

If your just starting out with PowerShell and want to learn it quickly, I recommend "LEarn Windows PowerShell 3 In a month of Lunches"

Hope this helps and have a great day!

Jason

by PSILU at 2013-02-15 09:12:05

thank you for replying . the matter is computer names keep changing . how would i specify input.txt file containing all the computer names and run the PS script from single machine ?

by JasonHelmick at 2013-02-15 09:16:03

You will need to get a list of the computer names....if you have that in a text file, then something like this will work.

Restart-Computer -ComputerName (Get-Content c:\input.txt)

You can also do this with the Invoke-Command -ComputerName