Powershell-source and destination paths did not resolve to the same provider
I have a step in a production SQL job (MSSQL 2008 r2) that executes via Powershell the following move, which works on a daily basis. Move-Item -Path "D:\Data\InvPmt\AP*.txt" -Destination "\\servername\DATA\PaymentUpdate\" I need to do the exact same thing in test but the first path is different. This is a MSSQL 2012 server Move-Item "D:\SSIS\Data\Out\APInvPmt_R*.txt" "\\servername\DATA\PaymentUpdate\" This command results in " 'Cannot move because the source and destination paths did not resolve to the same provider. '" All servers are running 2008 r2 OS. I have tried adding the -Path and -Destination words and get the same result. Suggestions? Thanks! Maggie
This is because SQLPS cannot resolve that the UNC path is part of the FileSystem provide like the local drive path. Edit your script to provide the destination as this: Microsoft.PowerShell.Core\FileSystem::"\\servername\DATA\PaymentUpdate\"
Thanks, I have tried several things now. The D drive referenced as the source is on the database the job is running on. I used the suggestion by Shawn and received a different error "Access is Denied". I checked on the share and found it was not set the same as Production. So I fixed the share and confirmed the SQL domain account has read/write. I still get "Access is Denied". I don't think it is me as I am an admin on all of the servers involved. Other thoughts? Thanks! Maggie