I've developed a script in Powershell\_ISE to backup a SQL Server database on one server, move the file to another server and restore to the target server with a different database name. Works fine.

It uses 6 mandatory parameters. Within Powershell\_ISE I can run 

```
    C:\PowershellScripts\Servers\CRMBackup.ps1 -SrcSrv uk-sb-sql12\wss -SrcDb UAT_2016_MSCRM
     -SrcBak \\uk-sb-sql12\backup\ -TrgSrv uk-sb-sql12\wss -TrgDb preprod_mscrm66 -TrgBak 
     \\uk-sb-sql12\backup\

```

and it works fine.

I can't get it to run from the Command Line though. How do I achieve this?

If I run

```
    powershell_ise.exe "C:\PowershellScripts\Servers\CRMBackup.ps1" -SrcSrv uk-sb-sql12\wss 
    -SrcDb UAT_2016_MSCRM -SrcBak \\uk-sb-sql12\backup\ -TrgSrv uk-sb-sql12\wss -TrgDb 
    preprod_mscrm66 -TrgBak \\uk-sb-sql12\backup\

```

from a Command prompt I get an error:

[![Powershell_ISE parameter error](https://i.stack.imgur.com/O2rCv.png)](https://i.stack.imgur.com/O2rCv.png)

If I call Powershell instead of Powershell\_ISE, all is fine:

```
    powershell.exe "C:\PowershellScripts\Servers\CRMBackup.ps1" -SrcSrv uk-sb-sql12\wss 
    -SrcDb UAT_2016_MSCRM -SrcBak \\uk-sb-sql12\backup\ -TrgSrv uk-sb-sql12\wss -TrgDb 
    preprod_mscrm66 -TrgBak \\uk-sb-sql12\backup\

```

completes successfully:

[![Successful run from Powershell](https://i.stack.imgur.com/GBgmX.png)](https://i.stack.imgur.com/GBgmX.png)

Can anyone advise how to pass command line parameters into Powershell\_ISE?

Thanks