Welcome to MSDN Blogs Sign in | Join | Help

PowerShell Provider for SQL Server Script of the Day - Script all objects

If you're using the PowerShell provider for SQL Server, you can quickly script out all of the objects in a "directory" using a simple method. Just navigate to the directory of objects you're interested in, say the "Views" of a certain database, and type this:

# Script objects in a directory
DIR * | foreach {$_.Script()}

This will only work for objects that can be scripted, of course, and requires that you have the proper permissions.

Published Thursday, January 08, 2009 8:00 AM by Buck Woody

Comments

# infoblog » PowerShell Provider for SQL Server Script of the Day - Script all objects

Anonymous comments are disabled
 
Page view tracker