Hello,
I am trying to run a simple powershell script to copy all changed files to another server as it is not in a domain so using DFS is not an option. The script is as follows,
[pre]
$Source = gci “Path” -Recurse | Where-Object{$.Name -notlike “*.log”}
$Dest = “\IP\e$”
$Username = “USERNAME”
$Password = get-content “PATH” | convertto-securestring
$mycreds = New-Object System.Management.Automation.PSCredential($Username, $Password)
$Logfile = "PATH\Filesync$todays_date.log"
#Delete log file if larger than 1GB
Get-ChildItem “PATH” | Where-Object{$_.Length -gt 1gb} | Remove-Item
#Copy data to Server
New-PSDrive -Name x -PSProvider FileSystem -Root $Dest -Credential $mycreds
Robocopy $Source $Dest /MIR /log:$Logfile
Remove-PSDrive -Name X
[/pre]
My issue is that i get the below error. From what i can see this is a name length issue with powershell. I cannot change the file names as they are used by the application. Is there another way to get round this?