My script copies a directory (and all sub-directories) to a new directory named with today's date, to 10 different servers.
$ServerList = Get-Content 'C:\Users\test\Powershellskript\testservrar.txt'
ForEach ($Server in $ServerList)
{
$source = "\\$Server\C$\Java\testIX"
$distanation = "\\$Server\C$\Backup"
$today = (Get-Date).ToString('YY-MM-DD')
$location = New-Item -Path $distanation -Type Directory -Name $today
Copy-Item $source -Destination $location -recurse
}
But I get the two errors below, how can I fix this?
Copy-Item : The symbolic link cannot be followed because its type is disabled. At C:\Users\baa065sa\Powershell skript\Untitled1.ps1:9 char:1
Copy-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. At C:\Users\baa065sa\Powershell skript\Untitled1.ps1:9 char:1