Question

I have a powershell script for DB backup/restore. For some reason I am executing the script remotely using new-pssession and invoke-command. I am

1.connecting to remote server
2.the local server is in a domain
3.the remote server is in same domain
4.Using the domain account which exist in both the machine and have admin rights.
5.My SQL Service (I mean the instance/engine) is running with 
  the same Domain account

backup with command Backup-SQLdatabase succeeds but restore Restore-SQLdatabase failes with error Login failed for NT AUTHORITY\ANONYMOUS LOGON.

Just for trial/error I added "NT AUTHORITY\ANONYMOUS LOGON" to admin group in the machine where restore have to happen but no luck.

Any clue what I am doing wrong (OR) how can I solve this problem.

Appreciate your help.

Thanks.

EDIT: will the -SQLTrustedConnection switch can solve this issue?

Was it helpful?

Solution

After trying a bit I found a trick. The machine where restore have to happen I added "NT AUTHORITY\ANONYMOUS LOGON" as a user.

How to add:

connect to the DB instance using SSMS -> expand security -> expand login -> right click on login -> create new login

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top