Automating the world one-liner at a time…
Hi,
Attached is the code we used today in the Web cast for the SQL demo provider. Please note this is not a SQL management provider. It simply allows you to query data from a SQL server directly from the cmd line.
Install the Snapin:
PS>$env:Windir\Microsoft.NET\Framework\v2.0\.50727\InstallUtil.exe SQLProvider.dll
Add the snapin to your session:
PS>Add-PsSnapin SqlPrototypeProvider
You can use it as follows:
PS>cd SQL:
SQL:>cd MySQLServer
SQL:>dir
mastertempdbmodelmsdbpubsNorthwind
SQL:>cd Northwind
name----CategoriesCustomerCustomerDemoCustomerDemographicsCustomersdtpropertiesEmployeesEmployeeTerritoriesOrder DetailsOrdersProductsRegionShippersSuppliersTerritories
SQL:>cd Employees
SQL:>Dir -filter {where EmployeeId=8}
EmployeeID : 8LastName : CallahanFirstName : LauraTitle : Inside Sales CoordinatorTitleOfCourtesy : Ms.BirthDate : 1/9/1958 12:00:00 AMHireDate : 3/5/1994 12:00:00 AMAddress : 4726 - 11th Ave. N.E.City : SeattleRegion : WAPostalCode : 98105Country : USAHomePhone : (206) 555-1189Extension : 2344Photo : {21, 28, 47, 0...}Notes : Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.ReportsTo : 2PhotoPath : http://accweb/emmployees/davolio.bmp
Wassim [MSFT]
Demo SQL Provider Code PowerShellを利用して、SQL Serverのデータベースの中身をまるでフォルダやファイルをたどるようにして見ることのできるサンプルプロバイダのコードが提供されています。こんなことできるんですねぇ。。。...
Hello folks!
I just downloaded the provider and installed it. No errors.
Then I tried to add-pssnapin and powershell came back telling me, there are no snap ins in version 1.0.
What's going wrong?
Cheers!
quax
Great, but ...
1) Guess, there's a surplus backslash in your cmd line? IMHO it should read: ...\v2.0.50727\...
2) How do I connect using SQL Authentication?
JensG
There is a bug in the first line of script:
It should be:
PS>. $env:Windir\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe SQLProvider.dll
Note the "." before the path and the removal of the directory in the Framework version directory.
Cool entry though.
John
What webcast was this? I try to join them all...
Windows PowerShell用Demo SQL Provider公開(Web castでのDemo用)
quax, if you are using x64 you have to use the correct framework.
Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
Marco,
Event Name: TechNet Webcast: Windows PowerShell in Windows Server 2008 (Level 200)
Start Date: 6/20/2007
Start Time: 1:00 PM (GMT-08:00) Pacific Time (US & Canada)
Please click on the following link for more information regarding this Event https://msevents.microsoft.com/cui/r.aspx?r=1291248013&c=en-US&t=4.
I have SQL Express. SQL server management studio express says my server name is "NB517949\SQLEXPRESS". I can't seem to figure out the proper combination to cd into... Any ideas?
(I'm able to use that server name using invoke-sql from PowerGadgets to run stuff against the DB.)
Sorry,this entry is written only Japanese. http://blogs.msdn.com/powershell/archive/2007/06/21/demo-sql-provider-code.aspx インストール。このページには「¥v2.0¥.50727¥」て書いてあるけど「¥v2.0.50727¥」の間違いだよね。 エラった。。$env:Windor がよくないの
Can the prototype provider be made to connect to a named instance?
Thanks,
Chris Leonard
Haven't tried it yet, but having a SQL provider ROCKS! I SO need this.
Dopo la SQL Conference ho iniziato a scrivere un provider SQL Server per PowerShell. Per chi non sapesse
The SQL provider demo code is very fragile specifically when it comes to parsing the path. the code does not support a named instance as NB517949\SQLEXPRESS. The code takes "NB517949" as Server name and SQLEXPRESS as the data base name.
The authentication is done on the SQL server. I did not add any credential parameter.
The installation syntax is wrong in the blog it should read $env:Windir\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe SQLProvider.dll
Also on 64 bit machines you need to invoke the correct version of InstallUtil.exe
Just curious ... is it possible to access Views this way? Because I use views more than tables.