Scott Newman
Scott Newman

Reputation: 159

powershell + sql server provider

When using the sql server provider in powershell, the path I pass works fine the first time, but upon the second run it errors out on me. It's like I have to clear the drive somehow?

Example: sl "SQLSERVER:SQL\SERVERNAME\DEFAULT\DATABASES\DATABASENAME\Tables" works fine the upon the first run. The location is successfully set. But, when I run it a 2nd time, I get this error: Set-Location : SQL Server PowerShell provider error: The number of keys specified does not match the number of keys required to address this object. The number of keys requi red are: Schema.Name.

I'm using quest powergui btw. Please help, this is driving me mad.

Upvotes: 0

Views: 1311

Answers (1)

Mike Shepard
Mike Shepard

Reputation: 18166

Looks to me like you're using a relative path (i.e. it doesn't start with a slash after the provider:). So, first you've set the location relative to the default--root folder. Then, you try to set the location again, but you're already in the "tables" folder, which doesn't have a "SQL\SERVERNAME..." folder inside it.

Does that make any sense?

Upvotes: 1

Related Questions