0

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.

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, that makes sense Mike, but every time I try to set the path back it doesn't seem to take. I set my location to c:\ to try to 'reset' the path, then as soon as I try to set the location back to the sql server provider location, it errors again. Do you know of a way to 'reset' the path? It's getting pretty dern tiresome having to restart my environment all the time to clear the path out. Thanks!
I haven't tried this, but switching between providers is just like switching between drives in DOS. Just because you set your location (on C:) to "\", your location on D: might be \temp. Try doing something like `set-location sqlserver:`
ok...I tried it. Either add a slash after the SQLServer: (so it reads sl SQLServer:\SQL\...) or, use something like "sl SQLServer:\" to change to the root between using set-location.
OMG TY! This has been driving me absolutely bananas for months now. Thanks you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.