...Because someone's gotta tell the story...


To return to the main Blog List, click Full Blog Listing.


Site Updates

Sample PS to Read a fle and execute a command

Friday, April 03, 2015 in Powershell (Views: 1519)
So a simple blog, friend asked for it, so why not...

All you need to do is run a command against a list of systems in a text file, like such:

To do this, simply run this PowerShell and add any commands within the {} brackets. Say, just to ping these systems, I'll use a local echo.

foreach ($SysName in get-content $FileName){
Write-Host "ping -t "$SysName

Your output would be:
ping -t CLIENT1
ping -t CLIENT2
ping -t CLIENT3

Happy scripting...


Related Blogs You May Be Interested In:

To leave a comment, please log in and/or register.