简体   繁体   中英

AWS Systems Manager Command: Works when executing manually, does not work from run command

I am executing a script on my EC2 Instances that will automatically restore databases. If I remote into the instance and manually execute the same ps1 script, it works. All SQL services are running. But if I execute it from Systems manager I get the error:

Restore-SqlDatabase : Failed to connect to server (localdb)\MSSQLLocalDB.

Any clue as to what could be causing this or steps to take to debug this issue? Thanks.

PS1 Script:

Restore-SqlDatabase -ServerInstance "(localdb)\MSSQLLocalDB" -Database "db" -BackupFile C:\path.bak -AutoRelocateFile

Check that the SSM agent on the instance is up to date and double check if any extra instance permissions are needed to allow SSM to restore the databases. I'm not 100% what/how the SSM works but certainly having the agent up to date and double checking permissions are always a good place to start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM