我有一个用于数据库备份/恢复的PowerShell脚本。出于某种原因,我使用new-pssession
和invoke-command
远程执行脚本。我是
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-SQLdatabase
成功,但恢复Restore-SQLdatabase
失败
错误Login failed for NT AUTHORITY\ANONYMOUS LOGON
。
仅仅是因为试用/错误我将“NT AUTHORITY \ ANONYMOUS LOGON”添加到了必须进行恢复但没有运气的机器中的管理员组。
任何线索我做错了什么(或者)如何解决这个问题。
感谢您的帮助。
感谢。
编辑: -SQLTrustedConnection
切换是否可以解决此问题?
答案 0 :(得分:0)
尝试了一下之后我找到了一个技巧。恢复必须发生的机器我作为用户添加了“NT AUTHORITY \ ANONYMOUS LOGON”。
如何添加:
使用SSMS连接到数据库实例 - >扩展安全性 - >展开登录 - >右键点击登录 - >创建新登录