Quantcast
Channel: Network Access Protection forum
Viewing all articles
Browse latest Browse all 1875

Powershell SQLServer Connect via New-PSDrive

$
0
0

Hello,
I try to connect to a local SQL Database running SQLServer 2012.

I can not connect with my local account, but have to use a dedicated account.
I tried the following:

Import-Module SQLPS -DisableNameChecking
PS SQLSERVER:\> $cred = Get-Credential
PS SQLSERVER:\> New-PSDrive sqldrive -PSProvider SqlServer -Root SQLSERVER:\SQL\DB01-LT\DEFAULT -Credential $cred

Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
sqldrive                               SqlServer     SQLSERVER:\SQL\DB01-LT\DEFAULT+sa

($cred is valid, of cause)

For me, everything seems good, but if I try to browse the psdrive I get an error.

PS SQLSERVER:\> dir sqldrive
Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet. SQL Server PowerShell provider error: Path SQLSE
RVER:\sqldrive does not exist. Please specify a valid path.
At line:1 char:4+ dir <<<<  sqldrive+ CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException+ FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.Commands.GetChildItemCommand

Does anyone can give me a hint, why this is not working.
I searched the Internet and found a lot of examples using exactly this commands.

Thank you very much in advance.

BR
Matthias




Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>