I have a Main Powershell Script that looks at a text file with headers of computername, service, script. The script looks at the machines under computer name then checks the service listed for each computer and either stops or starts the service based on the request. That part is working However I also have an elseif($computer.script -eq "script") function that I would like to use to pull in an external script and execute it.. So My txt file is like
Im trying to understand how to pull in that external script and then execute it, in a format like follows.
elseif($computer.operation -eq "script")
# run external script.
Where I am running into issues is with how to pull in an external script and running it correctly. I thought about using something like an:
Invoke-Expression <-- But I am not sure how to do that if each line that has a server name has a different script (in this case I may want to use a script for resetting ColdFusion Services on one server but a different external script for something else on a different server)