This is my scriptpart
$hsource = "\\fileserver\data\foldername"
$hdestination = ("\\fileserver\data\archive\foldername-archived-" + (get-date -format "d-MMMM-yyyy-HH-mm"))
Move-Item $hsource $hdestination
Now i have a service account that should execute the script which is a domain admin like i am.
When executing this script with the service account i get the following error:
Invalid Path: '\\fileserver\data\foldername'.
At line:95 char:2
+ Move-Item $hsource $hdestination
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], ArgumentException
+ FullyQualifiedErrorId : MoveItemDynamicParametersProviderException
If i execute it with my own account on this server it's working flawles.
Both accounts are getting their permissions via the same group.
I tried disabling the quota manager but that doesn't make any difference.
Folder security does not prohibit the account access in any way.
Moving the folder manually is going without problems.
Can anyone point me in the right direction ?
Many thanks