views:

680

answers:

2

Does anyone know the powershell commands to restore a remote database from a local file?

A: 

What kind of database? What kind of local file? Is it a backup file (like from SQL Server), or a SQL language script (something like MySQL can produce)?

Don Jones
sql server 2008. sql server backup file.
mson
+1  A: 

Based on your comment, there are no PowerShell-specific commands. You'll need to use New-PSDrive to map a drive to the server, use Copy-Item to copy the database over to the server, and then use one of the SQL 2008 commands (there are 2 total) to execute the necessary RESTORE DATABASE command. SQL2008 hasn't shipped anything more specific than that, and the SQL Server product itself can't perform a restore from a remote path (well, maybe a UNC, but I assume you're on a client - it'd be easier to copy the backup to the server).

Don Jones