.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 script that uses Microsoft.SqlServer.Management.Smo.Server need to use Sql Server Autheni

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
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?

View Complete Post

More Related Resource Links

Using Microsoft.SqlServer.Management.Smo to backup from remote SQL Server to local drive.


I'm trying to use the Microsoft.SqlServer.Management.Smo class to connect to a remote SQL Server, perform a backup and save it to my local drive.

I currently can only connect to a remote SQL Server and backup and save the backup file to the remote SQL Server drives. The same happens when I connect to a local instance of SQL Server and backup a file, I can only save it to my local drive.

Is there a way to specify to the Microsoft.SqlServer.Management.Smo to save to the [local] or [remote] machines?

Patrick Miron

For more about Microsoft.SqlServer.Management.Smo, check out my other thread at http://social.msdn.microsoft.com/Forums/en-CA/sqlgetstarted/thread/656d522a-06a6-4475-8070-93df75ef83a5

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.

PS2007/MSSQL2008: Cannot install Microsoft SQL Server 2005 Management Objects Collection (sqlserver2

Hi folks, about 1,5 months ago I have set up a - 1 server - development environment for PS2007. I had installed all components on one Windows 2008 box. Everything worked fine, now I receive an error. •MOSS 2007 •SQL 2008 SP1 •MOPS 2007 SP2 I have done the additional installation for the cube building part according to this page http://technet.microsoft.com/en-us/library/dd285466(office.12).aspx Microsoft SQL Server Native Client (sqlncli.msi) Microsoft SQL Server 2005 Management Objects Collection (sqlserver2005_xmo.msi) Microsoft SQL Server 2005 Backwards Compatibility Components (SQLServer2005_BC.msi) Everything worked fine. Cubes were able to be built.. everything was good. In order to have Reports built I added SSRS 2008 Reporting Services Addin for MOSS (rsSharePoint_x64) Business Intelligence Development Studio (=Visual Studio for MSSQL) No CUs have been added to this box. NOW, Cube creation fails with the error: ULS LOG: [CBS] ProjectServerOlapCubeGenerator status: Analysis Services session failed with the following error: Failed to connect to the Analysis Services server <IPADDRESS>. Error: ActiveX component can't create object 08efbc13-299a-4abe-9021-c46887ca6915 Eventlog says: SSP Name: SharedServices1 PSError: CBSASConnectionFailure (17003) Cube build failed to connect to the Analysis Services server. Verify the data source connection i

Problem trying to attach database file to Microsoft SQL Server Management Studio

I was trying to attach a database to SQL Server MGT Studio and got an exception error.  The message stated that the database file I was trying to attach could not be opened because it was version 661.  The SQL Server shows to support version 655 and earlier.  It states that a downgrade path is not supported. Question:  Is there some download ; fix; I can make to SQL Server 2008 that will allow me to attach the version 661????  I am not technical at all.  Please speak slowly.  :)  Thanks

Microsoft SQL Server Management Studio 2008 does not list all tables in database

When logging into SSMS 2008 to a SQL2008 database when I expand the tables in a database I only see a few tables listed.  I can login to the same instance with SSMS 2005 and all of the tables are there.  Is there a reason why this is this way?

I can do a select * from in a query window for any of the tables in the database via SSMS 2008 as well and it work fine.  It just does not display the tables.

Microsoft SQL Server Management Studio Question

I am new to writing stored proecedures and this will be my first stored procedure written with Microsoft SQL Server Management Studio.  I am familiar with working with VS 2010 and I have noticed that the IDE is very different.  So, let's start with the basics.  How do I go about adding a new stored procedure into the group of stores procedures that the project currently has.  I already know that name and the T-SQL code I need.  I just need to put it. 
Web Master and Programmer

Adding a new field to a table via script in sql server management studio

I know how you can script to and create a new table but how about adding a new field to this table? For example: how would i add a new varchar(50) field named mynewfield?

USE [example]
/****** Object: Table [dbo].[Password]  Script Date: 10/26/2010 10:17:30 ******/
CREATE TABLE [dbo].[Password](
	[user_id] [int] NOT NULL,
	[password] [varchar](30) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response1] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response2] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[response3] [varchar](40) COLLATE SQL_Latin1_General_CP850_BIN2 NULL,
	[user_id] ASC

ALTER TABLE [dbo].[Password] WITH CHECK ADD CONSTRAINT [User_Password_FK1] FOREIGN KEY([user_id])
REFERENCES [dbo].[User] ([id])
ALTER TABLE [dbo].[Password] CHECK CONSTRAINT [User_Password_FK1]

microsoft management console issue in SQL Server 2000


Hi Team,

I have an issue starting the management console (enterprise manager), Installed SQL Server 2000 and when i try to open the enterprise manager got a pop-up Microsoft management console the selected file cannot be found.

more info installed using my username but am not the admin of the machine is this causing the issue, though i didn't face any issue in the installation and i haven't restarted the server after installation.

Any help would be greatly appreciated!!



How can I see Hebrew on Microsoft Sql Server Management Studio?


I have created tables on the database.

Columns are nvarchar,

but when I insert into the tables some rows with Hebrew characters, I see "?????" (question sign).


How can I insert character in any language (it is not only Hebrew. One of the tables, is a table that holds native values from many languages) ?

Thanks :)

Microsoft.SqlServer.SMOEnum dll missing in Sql Server 2008


I am Creating a Project in SQL Server 2005 for Finding the Database Servers in the Network using SQL SMO.

But when I Upgrade my project from SQL Server 2005 to SQL Server 2008, my code throws some SMO Error.

My Code is looks like :


Function FindServers()

    Dim dtlSQLServers As DataTable


      dtlSQLServers = SmoApplication.EnumAvailableSqlServers(True)

    Catch ex As Exception


      dtlSQLServers = Nothing

    End Try

    Return dtlSQLServers

  End Function

SmoApplication throws error and shows that it is unavaliable in SQL Server 2008.

and not found manually C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll.


So, what is the substitue of SMOEnum ?

Chapter 23: Publishing Microsoft Office SharePoint Server (Microsoft Forefront Threat Management Gat

Learn about planning and configuring a Microsoft Office SharePoint Services deployment. With Office SharePoint Services, organizations can take file sharing and collaboration to a new level.

CLR Integration With Microsoft SQL Server

Transact-SQL provides as much flexibility as possible but, because it is not a real programming language, it has some shortcomings about many issues (memory management, exception handling, debugging, file processing (or streaming), object-orientation (classes), or thread management). Transact-SQL also lacks features of normal libraries (arrays, collections, serialization, expressions, or string manipulations, etc).

User Defined Functions in Microsoft SQL Server

User Defined Functions are compact pieces of Transact SQL code, which can accept parameters, and return either a value, or a table. They are saved as individual work units, and are created using standard SQL commands. Data transformation and reference value retrieval are common uses for functions. LEFT, the built in function for getting the left part of a string, and GETDATE, used for obtaining the current date and time, are two examples of function use. User Defined Functions enable the developer or DBA to create functions of their own, and save them inside SQL Server.

Security Briefs: Add a Security Bug Bar to Microsoft Team Foundation Server 2010


Take a peek inside Microsoft's strict development security structure as Bryan Sullivan describes the objective security bug classification system?the "bug bar"?used by internal product and online services teams. He will show you how to incorporate this classification system into your own development environment using Microsoft Team Foundation Server 2010.

Bryan Sullivan

MSDN Magazine March 2010

Data Points: SQL Server Management Objects


SQL Server Management Objects offer developers a robust toolset for backing up and restoring databases, and issuing DDL commands, as John Papa explains.

John Papa

MSDN Magazine June 2007

ISA Server 2004: Developing an Application Filter for Microsoft Internet Security and Acceleration S


The beta version of Internet Security and Acceleration (ISA) Server 2004 is now publicly available. It includes a rich SDK with several extensibility mechanisms that allow third parties to integrate their specialized solutions on top of the ISA platform. In this article, the author explores the application filter extensibility mechanism, which enables you to add high-level application layer filtering capabilities to ISA Server and to provide rich content filtering solutions. He also highlights the new features of the ISA Server 2004 SDK, then moves on to describe how to develop a basic application filter that monitors all data going through the ISA Server, and how to integrate a filter into the ISA Server management console to create a seamless interface experience for your users.

Yigal Edery

MSDN Magazine March 2004

SQL Server and DMO: Distributed Management Objects Enable Easy Task Automation


SQL Server can be administered programmatically using system stored procedures, but Distributed Management Objects (DMO) offer a more modern, object-oriented alternative. This article introduces SQL-DMO in SQL Server 7.0 and SQL Server 2000 and describes the SQL-DMO object model, then focuses primarily on the Databases tree and the JobServer tree of the object model. The sample code and the article show how to use various objects such as the Registry object, the Configuration object, and the Database object to automate common administration tasks such as programmatically retrieving configuration settings, creating new databases, applying T-SQL scripts, and creating and scheduling backups.

Francesco Balena

MSDN Magazine May 2001

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