SQL 2008 and powershell - with the 2008 releases from microsoft powershell is really making its way into the mainstream. sql server 2008 ships with standard powershell as well as an add-in that provides an interesting degree of integration that will allow DBAs to write scripts that are far more generalized than T-SQL scripts. getting ready to play with it is pretty strait forward. all you have to do is click the "Start PowerShell" context menu option which is relatively ubiquitous in SSMS 2008's object explorer, located on the "Tables" folder within a database for example. essentially the schematic structure of database is layed out into a virtual filesystem with database objects represented as files and directories. for example every table is a directory with subdirectories for each column and each column having files for the...
Asynchronous and remote execution with powershell 2 ctp3 - An interesting feature released with the PowerShell 2 CTP3 is the ability to run background jobs consisting of arbitrary PowerShell code. In order to use this functionality you must download and install the PowerShell 2 CTP3 and the WinRM (Windows Remote Management) 2.0 CTP. Keep in mind that installing the CTP requires uninstalling previous versions of PowerShell. Depending on the PowerShell and operating system versions involved the procedure can vary. Google/Bing is your friend. Once bringing up PowerShell you have to enable remoting by invoking the aptly named Enable-PSRemoting cmdlet Enable-PSRemoting -force Now the meat. Consider the following code: # copy bigfile.txt on a background thread $job = start-job -scriptBlock { cp bigfile.txt bigfilecopy.txt } # here's where we'd perform some other logic while our file copies # wait for job...
SSRS scripting with RS.EXE - At work we've recently deployed SQL Server Reporting Services (SSRS) and it's been quite interesting. In general I love the product but of course as with everything there are situations where you have to do more than the management tools provide and you have to write some scripts. SSRS provides an interesting scripting facility, RS.EXE, which allows you to run VB .Net code against the management web service of SSRS. I encountered a situation where I had to add a user to the policy as the "Browser" role for all folders in my SSRS environment. Because I didn't want to inherit parent item security to all objects I had no clean way of accomplishing that other than programmatically. I wrote up a quick script and this task will be easy as...
PowerShell 2.0 Out-GridView, ISE and ScriptCmdlets - In my last post I discussed the background-job and remoting systems of PowerShell 2.0. While I find those features interesting personally there are three more that I'd like to discuss that have a broader appeal: the Out-GridView CmdLet, ScriptCmdlets and the PowerShell Integrated Scripting Environment (ISE). Note that PowerShell 2.0 is in CTP 3 at the time of writing and everything is subject to change. Out-GridView The Out-GridView cmdlet gives you a lightwieight sortable/searchable grid that you can easily pipe collections into as demonstrated below. ls | Out-GridView ScriptCmdlets Previously the only way to develop your own Cmdlets was to resort to one of the higher level .Net languages such as VB.Net and C#. This restriction has been removed with the introduction of ScriptCmdlets. Consider the following ScriptCmdLet that retrieves a...
Scripting Your .Net Applications with IronPython - At several points in my .Net development career I've had the need to make an application I wrote scriptable. Sometimes it was to provide easy product extension to customers or lower level information workers. Sometimes it was to ease maintenance of very fine grained logic that has the capacity to change frequently or unpredictably. But every time I found it to be one of the more interesting facets of the project at hand. Early in .Net's history this was made easy by using Visual Studio for Applications (VSA) which allowed you to host arbitrary C# or VB.Net code within the executing AppDomain. Unfortunately VSA was plagued with resource leak problems and was therefore impractical in most enterprise situations. VSA was eventually deprecated. One of the many alternatives is to perform dynamic,...
Tags:
.Net .net framework 4.0 ADO.NET Android AppleScript Astoria BI BeOS C C++ Data Services EF GNOME GObject Groovy HTML Haiku JVM Java Mac MongoDB ORM Objective-C Operating Systems Oracle SSRS Solr VS 2010 Vala Web Services appengine c# clojure cloud clr cocoa touch concurrency couchdb cql curl database django dlr dynamic entity framework erlang exchange server filestream full-text functional go iPhone indexes ironpython ironruby jQuery linq lisp lucene mongodb monitoring natural language object oriented parallel performance podcasts powershell python rails refactoring remoting reporting services rs ruby scripting security setpolicies simpledb sql 2008 sql server systems programming testing tools vb virtualization wave webdav windows xml