davesnb
asked on
Access PS SQLSERVER from powershell
I just want to access the sqlserver " ps sqlserver" from traditional ISE as opposed to opening the ps sql server from the right click context menu in SQL server management studio. One would think this is simply the "set-location" , but I have to invoke using the Invoke-Sqlcmd to get on the PS SQLSERVER prompt .
What is the correct way to do this ? , see below
What is the correct way to do this ? , see below
PS C:\Windows\system32> cd SQLSERVER:\SQL\SOMESERVER-SQL02\DEFAULT
cd : Cannot find drive. A drive with the name 'SQLSERVER' does not exist.
At line:1 char:1
+ cd SQLSERVER:\SQL\SOMESERVER-SQL02\DEFAULT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (SQLSERVER:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS C:\Windows\system32> Invoke-Sqlcmd cd SQLSERVER:\SQL\IASC9-SQL02\DEFAULT
Invoke-Sqlcmd : A positional parameter cannot be found that accepts argument 'SQLSERVER:\SQL\IASC9-SQL02\DEFAULT'.
At line:1 char:1
+ Invoke-Sqlcmd cd SQLSERVER:\SQL\IASC9-SQL02\DEFAULT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-Sqlcmd], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
PS SQLSERVER:\>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.