I have a SQL server in a hosted environment where all connectivity is through SQL authentication.
So in SSMS 2008, I right click in Object Explorer and get the 'Start PowerShell' option, but when I click I get a PS window with
New-PSDrive : SQL Server PowerShell provider error: Could not connect to 'SERVERXYZ\DEFAULT'. [Object reference not set to an instance of an object.]
At line:1 char:701
+ &{[System.Console]::Title = 'SQL Server Powershell';$cdpath = (Convert-UrnToP
ath 'Server[@Name=''SERVERXYZ'']') + '\';$root=$cdpath.Substring(0, $cdpath.Index
Of('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\')+1)+1)+1)
);$pwd = ConvertTo-SecureString '01000000d08c9ddf0115d1118c7a00c04fc297eb010000
004cc6f6478b1e7741bb5ce156959130190000000002000000000003660000a800000010000000a
ca72b315b660427431655088d27f8750000000004800000a0000000100000007c488d0e15beff57
a1874c8c231ec8b9180000003e773b017a51cf68c51e9d1e12df81ed1233be8fa7386b651400000
05bad64836f8a42e6fb9b5a5185dd89b35f70d663';$cred = New-Object System.Management
.Automation.PSCredential -ArgumentList 'sa',$pwd;$newroot=(New-PSDrive <<<< 33
6a5d2eb2714e78846160a3ae7298c1 -PSProvider SqlServer -Root $root -Credential $c
red -Scope 1).Root;cd 336a5d2eb2714e78846160a3ae7298c1:;$cdpath.Replace($root,
$newroot)|cd}
New-PSDrive : SQL Server PowerShell provider error: Path SQLSERVER:\SQL\SERVERXYZ
\DEFAULT does not exist. Please specify a valid path.
At line:1 char:701
+ &{[System.Console]::Title = 'SQL Server Powershell';$cdpath = (Convert-UrnToP
ath 'Server[@Name=''SERVERXYZ'']') + '\';$root=$cdpath.Substring(0, $cdpath.Index
Of('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\')+1)+1)+1)
);$pwd = ConvertTo-SecureString '01000000d08c9ddf0115d1118c7a00c04fc297eb010000
004cc6f6478b1e7741bb5ce156959130190000000002000000000003660000a800000010000000a
ca72b315b660427431655088d27f8750000000004800000a0000000100000007c488d0e15beff57
a1874c8c231ec8b9180000003e773b017a51cf68c51e9d1e12df81ed1233be8fa7386b651400000
05bad64836f8a42e6fb9b5a5185dd89b35f70d663';$cred = New-Object System.Management
.Automation.PSCredential -ArgumentList 'sa',$pwd;$newroot=(New-PSDrive <<<< 33
6a5d2eb2714e78846160a3ae7298c1 -PSProvider SqlServer -Root $root -Credential $c
red -Scope 1).Root;cd 336a5d2eb2714e78846160a3ae7298c1:;$cdpath.Replace($root,
$newroot)|cd}
Set-Location : Cannot find drive. A drive with name '336a5d2eb2714e78846160a3ae
7298c1' does not exist.
At line:1 char:804
+ &{[System.Console]::Title = 'SQL Server Powershell';$cdpath = (Convert-UrnToP
ath 'Server[@Name=''SERVERXYZ'']') + '\';$root=$cdpath.Substring(0, $cdpath.Index
Of('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\', $cdpath.IndexOf('\')+1)+1)+1)
);$pwd = ConvertTo-SecureString '01000000d08c9ddf0115d1118c7a00c04fc297eb010000
004cc6f6478b1e7741bb5ce156959130190000000002000000000003660000a800000010000000a
ca72b315b660427431655088d27f8750000000004800000a0000000100000007c488d0e15beff57
a1874c8c231ec8b9180000003e773b017a51cf68c51e9d1e12df81ed1233be8fa7386b651400000
05bad64836f8a42e6fb9b5a5185dd89b35f70d663';$cred = New-Object System.Management
.Automation.PSCredential -ArgumentList 'sa',$pwd;$newroot=(New-PSDrive 336a5d2e
b2714e78846160a3ae7298c1 -PSProvider SqlServer -Root $root -Credential $cred -S
cope 1).Root;cd <<<< 336a5d2eb2714e78846160a3ae7298c1:;$cdpath.Replace($root,
$newroot)|cd}
PS SQLSERVER:\>
and at the same time get errors on the target server
SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed.
Simple enough - the connection has been attempted with Windows authentication, but my local domain credentials are not recognised by the remote hosted server.
Question is, how can I connect to PowerShell, from the SSMS menu, using SQL authentication? Is that even possible?
asked
Oct 06 '10 at 02:12 AM
in Default
Kev Riley ♦♦
46k
●
38
●
43
●
69
Sounds like one for James Boother... I've put out a tweet for him.