Having a brain fart right now -- I have a simple PowerShell script running a ForEach loop. Please see below:
# Define list of servers
$Servers = Get-Content C:\computersFile.txt
foreach ($Computer in $Servers)
# Create a backup of current file
Copy-Item "\\$remoteHost\$source" -Destination "\\$remoteHost\$destination"
$remoteHost is a placeholder just to show what I am trying to do .. I'd like to use the computer names in the computersFile.txt to specify my path like such "\\compuerName\C:\Program Files"
How could I dynamically populate that path ? If I use "$Computer" it attempts to put the entire txt file into that path.
I know I've done this before but for some reason cannot remember.
Any help is much appreciated.