I need to get an item from a list of servers, so i have my csv file created.
$servers = Import-Csv C:\Temp\user1\servers.csv
#Copy Items- Invoke
$servers = Import-Csv C:\Temp\user1\servers.csv | ForEach-Object {Invoke-Command -ComputerName $_.computername -ScriptBlock { get-item -Path $("\\$_.computername\c$\Program Files\app1\app1.yml") | Copy-Item -Destination "C:\Temp\app1\app1"}}
It's erroring out because file path '\.computername\c$\Program Files\app1\app1.yml' is not found.
Its detecting the actually computer name in for that parameter, so my guess is my syntax is not set correctly with the $_.computername in the file path. Not sure how I can get the path string to recognize the object in the server.csv file