Thank you Ansgar. I got some issues:
1. Remove-Item:
The Argument can not be bound with the Parameter "Path", because it is an empty string.
- CategoryInfo: InvalidData: (:) [Remove-Item], ParameterBindingValidationException
- FullyQualifiedErrorId: ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.RemoveItemCommand
2. Move-Item:
No position parameter was found, which accept the argument "\Maintenance"
May be there is a missunderstanding. Source should be deleted if exists in Destination. E.g.: "$StartM\C\A.Lnk" = "$StartM\Maintenance".
Goal: "$StartM\C\A.Lnk" should be deleted if "A.Lnk" exists in "$StartM\Maintenance\A.Lnk".
- Move-Item $src = $shortcuts[$src]
- CategoryInfo: InvalidArgument: (:) [Move-Item], ParameterBindingException
- FullyQualifiedErrorId: PositionalParameterNotFound,Microsoft.PowerShell.Commands.MoveItemCommand
3. ErrorAction
Remove-Item: The Parameter "ErrorAction" can not be bound. Type "SiltenlyContinue" can not be converted in type "System.Management.Automation.ActionPreference" ...
I just changed "-EA" ... -Force -EA SilentlyContinuefrom to "-Error Action". This type of Error has gone.
4. Double keys
If there are some constelations in the array like this:
"$StartM\C\B.Lnk" & "$End\C\B.Lnk" I got an error that double keys are not allowed in Hashliterals.
- CategoryInfo : InvalidOperation: (System.Collections.Hashtable:Hashtable) [], RuntimeException
- FullyQualifiedErrorId : DuplicateKeyInHashLiteral