.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

powershell with sql server - wheres the reference info?

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Hello, Not sure if this is the right group for this. I need to automate some sql server managements tasks with powershell. Where can I get documentation on how to use objects and methods exposed by the sql server powershell provider? like .script() for example? The type and format of info I'm looking for is like what you would find when hitting the F1 key in visual studio.. easily finding a class of interest, getting a list of all it's members, clicking a particular member and seeing all it's overloads (if the member is a method), and then clicking a particular method overload for a description of what it does, input param descriptions, return value etc... plus sample usage. I need this for powershell in general, and specifically for the methods in the sql server powershell provider at the moment. does this exist? 

View Complete Post

More Related Resource Links

Windows Server 2003: Discover Improved System Info, New Kernel, Debugging, Security, and UI APIs


There's a lot to say about Windows Server 2003. First of all, it's the first operating system with built-in .NET Framework support, and it's the first 64-bit OS from Microsoft. But wait, there's more! There are lots of new features and APIs in this version as well. For instance, Windows Server 2003 features Hot Add Memory and a number of other arcane new tidbits. There are new APIs for handling threads, directories, and files, and new features like the low fragmentation heap for managing memory and system information. There's vectored exception handling and new UI APIs as well.OS internals expert Matt Pietrek takes a look at the additions he finds most interesting and useful so you'll have a good place to start when you dive into Windows Server 2003.

Matt Pietrek

MSDN Magazine June 2003

Info on the Go: Wireless Internet Database Connectivity with ASP, XML, and SQL Server


Many handheld wireless devices such as cellular phones and PDAs already have the ability to access Web sites. So how do you build Web applications that tap this wireless audience? Although there are a number of limitations to wireless devices-such as screen size, navigation, and connection speed-you can use familiar Web development technologies to make your existing Web applications available to mobile users. This article outlines the services and equipment currently available to support wireless Web access. A sample wireless-accessible Web site that dynamically draws data from a SQL Server database back end in real time is created using tools such as ASP and XML.

Srdjan Vujosevic and Robert Laberge

MSDN Magazine June 2000

SQL Server Powershell script error!

Hi, I get the following error while trying to execute a powershell script. New-Object : Cannot find type [Microsoft.SQlServer.Management.Sdk.Sfc.SqlStoreConnection]: make sure the assembly containing this type is loaded. I'm trying to implement policies across different sql server instances from a primary instance. The script can be found @ http://blogs.msdn.com/sqlpbm/archive/2008/06/14/running-against-sql-server-2005-and-sql-server-2000.aspx Thanks for your help.

Powershell script that uses Microsoft.SqlServer.Management.Smo.Server need to use Sql Server Autheni

I have written a powershell script that uses Microsoft.SqlServer.Management.Smo.Server.  I have a couple of instances that are on different domains that I must use Sql Server authenication.  I am going to create a report user "sssmorpt".  What is the least a can grant this user to allow me to use Microsoft.SqlServer.Management.Smo.Server to get "$dbsize = $db.size - ($db.logfiles|measure-object -property size -sum).sum / 1024" for all databases in an instances?

Missing Assembly Reference for Microsoft.Office,.Server.Search

I am getting the following error while accessing the namespace: Microsoft.Office.Server.Search.Query  The type or namespace name 'Query' does not exist in the namespace 'Microsoft.Office.Server.Search' (are you missing an assembly reference?)   I have added references to 1) Microsoft.Sharepoint  2) Microsoft.Office.Server and  3) Microsoft.Office.Server.Search I am using VS 2010 and set the framework version to 3.5 and Sharepoint RTM Version  vinod kumar Bhasyam

Reference Custom Assembly on Report Server

I have built the Custom Assembly and asked System Admin to deploy it on Report Server in the ReportServer/bin folder. Now System Admin has deployed this Cusomt Assembloy on Rpeort Server and sent me an URL http://mycompany/. But I am not sure how to reference this Custom Assembly using a URL in Reporting Services 2008. Please help!!!    

WCF session client service reference "State" is not updated when the server side has closed


I am using vb.net (Visual Studio 2008 with framework 3.5). I have a server that exposes several services requiring sessions. I am using wsHttpBinding for all. One of my requirements is to allow non-dot net third parties to access these services. When a client connects to a service and then some time later the server goes away, the state of the connection is still reporting "open".

Currently I have implemented a "ping" function on the server. My client calls this function every 5 to 10 seconds and if the server does shutdown, I get alerted with an exception error. This works, but I was wondering if there is a way where I don't have to call my ping function?

I don't want to use a dual connection binding and I was hoping to use the connection state variable? But, I don't know how to get it to update by itself. The client user application could just wait until it goes to invoke a service method, but I was wondering if there was another way.

Thanks in advance!!


Documenting Server Config via Powershell + DB/Farm Back: Sufficient?



After reading through some of the posts about Sharepoint 2010's weaknesses with internal (Admin Console) backups, and discovering that a full Configuration Backup is necessary (see: http://www.benjaminathawes.com/blog/Lists/Posts/Post.aspx?ID=10 and http://sharepointinterface.com/2010/09/10/configuration-only-backup-and-restore-in-sharepoint-2010/ ), I'm a bit concerned.

Is it the case that running the powershell utility (http://technet.microsoft.com/en-us/library/ff645391.aspx) is sufficient for restoration purposes (does it capture all the essential data?) OR do we need to go through and take screenshots of all of our config screens?

What does your backup strategy?



SQL Server 2008 R2 Powershell

I am using Powershell in SQL Server 2008 R2 Management Studio for generating a DAC from a database.
However I am facing some problems.
1. I have a database called 'Test1'. I right clicked on the server instance and clicked on Start Powershell
2. Run the following
PS SQLSERVER:\SQL\BMC-17329MDZ3XA\DEFAULT+sa\> $srv = get-item
cmdlet Get-Item at command pipeline position 1
Supply values for the following parameters:

Path[0]:$dbname = "Test1"
Path[1]:$applicationname ="TestApp"
Path[2]:$version = ""
Path[3]:$dacpacPath = "C:\temp\TestApp.dacpac"
Path[4]:$description = "This DAC is generated using powershell"
Path[5]:$extractionunit = New-Object Microsoft.SqlServer.Management.Dac.DacExtractionUnit($srv, $dbname, $applicationname, $version)
Path[6]:$extractionunit.Description = $description
Path[8]:       Here I am pressing enter key. Following message is displayed:
Get-Item : Cannot find path 'SQLSERVER:\SQL\BMC-17329MDZ3XA\DEFAULT+sa\$dbname
= "Test1"' because it does not exist.
At line:1 char:16
+ $srv = get-item <<<<
    + Cat

Installing SQL Server Express 2008: Powershell failed


During the install of SQL Server Express 2008 I get an error "Powershell failed". I tried to find a Powershell download but only found a "Powershell snap in" and that won't install on XP Home SP3. I get a message it should be installed using "Programs and Services" or "Servers". I can't find these on XP Home (perhaps using a dutch windows version doesn't help). I just want to install SQL Express and I dont need Powershell.

I tried the Windows Weblauncher but this doesnt work on XP Home.

I have succesfully installed and used SQL server on XP Home, but after a crash and a new installation of Windows with all updates, including SP3, I can't get it working anymore,

How can I (1) install SQL Server Express 2008 without this Powershell error by skipping the powershell check or (2) how can I install PowerShell first on my XP Home computer to run a succesful installation afterwards.

Help - Cannot call webservice Get error: Server was unable to process request. --> Object reference

Here is my code, I don't fully understand the erro because I have instantiated all objects
Any help or advice appreciated.
Dim transactionResult As PremiumCredit.TransactionResult = New PremiumCredit.TransactionResult
        Dim newBusiness As PremiumCredit.NewBusiness = New PremiumCredit.NewBusiness
        Dim transferEngine As PremiumCredit.XMLTransferEngine = New PremiumCredit.XMLTransferEngine
        'Build up NewBusiness Object
        newBusiness.AddCoverCode = String.Empty
        newBusiness.BankAccountName = Session("BankAccountName").ToString
        newBusiness.BankAccountNumber = Session("BankAccountNumber").ToString ' 02149187
'Populate the rest of new Business object etc
        System.Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
            transactionResult = transferEngine.Crea

A better way to reference your wizard steps using named steps

Note: this article uses the plain vanilla but the concepts apply equally well to its popular counterpart .

By far the most common way that I see wizard steps reference in code snippets is by their index.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend