June 30, 2015 at 10:05 pm
I am trying to delete sql backup files under UNC path from one server to another server. I am getting an error message - An object at the specified path \\PRPWD01V0131\L$\SQLBackup\Archive does not exist
Script -
remove-item "\\PRPWD01V0131\L$\SQLBackup\Archive\*" -include *.bak -recurse
I believe it's UNC path issue with credentials. Any help is appreciated!!
July 1, 2015 at 3:13 am
Hi,
Have you tried adding a share to the file location (and giving permissions to the share to the relevant accounts) and using that in the UNC path ?
Graeme
July 1, 2015 at 3:32 am
Sam77 (6/30/2015)
I am trying to delete sql backup files under UNC path from one server to another server. I am getting an error message - An object at the specified path \\PRPWD01V0131\L$\SQLBackup\Archive does not existScript -
remove-item "\\PRPWD01V0131\L$\SQLBackup\Archive\*" -include *.bak -recurse
I believe it's UNC path issue with credentials. Any help is appreciated!!
The first thing that will potentially cause issues is the use of the L$ administrative share, by using administrative shares only local administrators of the machine PRPWD01V0131 can access that share.
Is the service account used for your SQL agent a local administrator of PRPWD01V0131?
MCITP SQL 2005, MCSA SQL 2012
July 1, 2015 at 3:38 pm
I believe it's a double hop authentication issue. The account that I am using does have sys. admin permission on both the server.
July 2, 2015 at 3:20 am
Which account is running the job? SQL Server Agent account? If it's a domain account you need to assign permissions on the path/share/directory to that account.
If SQL Server Agent is running with NT AUTHORITY\NETWORKSERVICE you need to grant permissions to your server's computer account on the path/share/directory.
July 2, 2015 at 3:31 am
SQL Surfer '66 (7/2/2015)
Which account is running the job? SQL Server Agent account? If it's a domain account you need to assign permissions on the path/share/directory to that account.If SQL Server Agent is running with NT AUTHORITY\NETWORKSERVICE you need to grant permissions to your server's computer account on the path/share/directory.
As they are using an administrative share (L$) this is largely irrelevant, as providing the account used to run the SQL server Agent job whether that be the SQL Server Agent Account or a proxy is a member of the local administrators on the target server no additional permissions are required.
Administrative shares are limited by use to only windows administrators (not SQL sysadmins) on the target server.
For your second point I may be wrong but I don't believe its possible to add a computer as a local administrator of a remote server.
MCITP SQL 2005, MCSA SQL 2012
July 2, 2015 at 4:56 am
RTaylor2208 (7/2/2015)
As they are using an administrative share (L$) this is largely irrelevant, as providing the account used to run the SQL server Agent job whether that be the SQL Server Agent Account or a proxy is a member of the local administrators on the target server no additional permissions are required.Administrative shares are limited by use to only windows administrators (not SQL sysadmins) on the target server.
If you can't access the directory through an administrative share then a new share is needed. Either way the account running the job must be granted permissions on the share/path/directory.
For your second point I may be wrong but I don't believe its possible to add a computer as a local administrator of a remote server.
I said that permissions needs to be granted on the path/share/directory to the account running the job. Not add the account to a local group.
July 2, 2015 at 5:04 am
I agree with what your saying IF the OP was using a regular shared folder, but the question they have posted is using a UNC path to a folder that currently (as much as they have told us) is only accessible via the administrative share.
Both sets of advice are correct but for different scenarios, your recommendation is the correct action if the OP provision's the folder as a share, and mine if they continue down the route of using the administrative share.
MCITP SQL 2005, MCSA SQL 2012
July 2, 2015 at 5:29 am
RTaylor2208 (7/2/2015)
I agree with what your saying IF the OP was using a regular shared folder, but the question they have posted is using a UNC path to a folder that currently (as much as they have told us) is only accessible via the administrative share.Both sets of advice are correct but for different scenarios, your recommendation is the correct action if the OP provision's the folder as a share, and mine if they continue down the route of using the administrative share.
Sam77 (6/30/2015)
I am trying to delete sql backup files under UNC path from one server to another server. I am getting an error message - An object at the specified path \\PRPWD01V0131\L$\SQLBackup\Archive does not existScript -
remove-item "\\PRPWD01V0131\L$\SQLBackup\Archive\*" -include *.bak -recurse
I believe it's UNC path issue with credentials. Any help is appreciated!!
Yes, I agree. As I see it the OP wants to delete files. He/she doesn't state that the administrative share must be used. That's why I would choose to add a share and grant permissions to the account running the job. Both to the share and the directory.
July 2, 2015 at 2:02 pm
It seems to be an issue with double hop. Assigning kerberos delegation to the sql service account or proxy account would fix it but involves lot of work in my environment.
I created a share and granted full control to the service account to fix the issue.
Share = \\PRPWD01M0131\Archive
cd env:
$PROD = "L:\SQLBackup\Archive\*"
$BCP = "\\PRPWD01M0131\Archive\*"
cd c:
remove-item $PROD -include *.bak -force
remove-item $BCP -include *.bak -force
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply