question

paws27284 avatar image
paws27284 asked

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
sql-server-2008-r2sql-server-2012powershell
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Is D:\SSIS\Data physically on a different server than where the job is running? You might try a UNC path, IE: \\server2012\d$\SSIS\Data\Out\
0 Likes 0 ·
Shawn_Melton avatar image
Shawn_Melton answered
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\"
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

paws27284 avatar image
paws27284 answered
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
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Were you testing as you or through a SQL Agent job?
0 Likes 0 ·
As SQL Job agent - executed a step
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.