I'm new powershell and want to take a list of servers from Excel, and literally paste into an input window. It should segregate it and process it one after other.
ie give the name of servers:
arvdel1 arvdel2 arvdel3 arvdel4
and it should take it as
$a=@(arvdel1,arvdel2,arvdel3,arvdel4)
How can I do this?
$cli= Read-Host("Enter the servers") $a=$cli.Replace("`n",",") $b=$a.split(",") foreach($i in $b) { write-host " hi" }
o/p:
Enter the servers: 1.1.1.1 2.2.2.2 3.3.3.3 hi hi hi