You can extend this code to run on multiple servers. This may be in the situation of multiple reboots have occurred, and you want to iterate through the servers. There are a few ways of completing . Read through this post as an example and customise to your requirements Powershell - run script on all sql servers