Browse by Tags

Tagged Content List
  • Blog Post: PowerShell for the DBA: Search the Windows Event Logs for Errors

    This is a very simple script - but it's one I run each morning. It searches the Windows System Event Log for an error condition. You can replace "System" here with "Application" or "Security", or any of the other logs that are created on your Windows Server. This is run at the server, since I have each...
  • Blog Post: PowerShell and Extended Properties

    I use Extended Properties on databases and their objects all the time. They are a great way to include information about the object – I use them for versioning the database, detailing what a column is used for and so on. They can be a little tricky to set, but it’s really not bad once you...
  • Blog Post: Find Rules and Defaults using the PowerShell for SQL Server 2008 Provider

    I ran into an issue the other day where I couldn't set up some features in SQL Server 2008 because they ddon't support the use of Rules or Defaults. Let me explain a little more about that. In older versions of SQL Server, you could decalre a "Rule" or "Default" just like you do with a Table Constraint...
  • Blog Post: SQL Server PowerShell Provider And PowerShell Version 2 Get-Command Issue

    The other day I blogged that the version of the SQL Server PowerShell provider (sqlps) follows the version of PowerShell. That’s all goodness, but it has appeared to cause an issue for PowerShell 2.0. the Get-Command PowerShell command-let returns an error ( Object reference not set to an instance of...
  • Blog Post: SQL Server PowerShell Provider follows the Version of PowerShell on the Host and other errata

    There may be some misunderstanding on how the PowerShell Provider for SQL Server works. I’ve written an article or two explaining that you can use PowerShell with SQL Server, without having the SQL Server 2008 (or higher) provider around. After all, PowerShell just uses .NET, and SQL Server “Server Management...
  • Blog Post: Create and Track Your Own License Keys with PowerShell

    SQL Server used to have  cool little tool that would let you track your licenses. Microsoft didn’t use it to limit your system or anything, it was just a place on the server where you could put that this system used this license key. I miss those days – we don’t track that any more, and I want to...
  • Blog Post: PowerShell PowerPack Download

    I read Jeffery Hicks’ article in this month’s Redmond Magazine on a new add-in for Windows PowerShell 2.0. It’s called the PowerShell Pack and it has a some great new features that I plan to put into place on my production systems as soon as I finished learning and testing them. You can download the...
  • Blog Post: Process Improvement and the Data Professional

    Don’t be afraid of that title – I’m not talking about Six Sigma or anything super-formal here. In many organizations, there are more folks in other IT roles than in the Data Professional area. In other words, there are more developers, system administrators and so on than there are the “DBA” role. That...
  • Blog Post: List SQL Server Instances using the Registry

    I read this interesting article on using PowerShell and the registry , and thought I would modify his information a bit to list the SQL Server Instances on a box. The interesting thing about listing instances this was is that you can touch remote machines, find the instances when they are off and so...
  • Blog Post: Open the SQL Server Error Log with PowerShell

    Using the Server Management Objects (SMO) library, you don’t even need to have the SQL Server 2008 PowerShell Provider to read the SQL Server Error Logs – in fact, you can use regular old everyday PowerShell. Keep in mind you will need the SMO libraries – which can be installed separately or by installing...
  • Blog Post: PowerShell – Show a Notification Balloon

    In my presentations for PowerShell I sometimes want to start a process (like a backup) that will take some time. I normally pop up a notification “balloon” at the start, and then do the bulk of the work, and then pop up a balloon at the end to let me know it’s done. You can actually try out this little...
  • Blog Post: PowerShell: Read Excel to Create Inserts

    I’m writing a series of articles on how to migrate “departmental” data into SQL Server . I also hold workshops on the entire process – from discovering that the data exists to the modeling process and then how to design the Extract, Transform and Load (ETL) process. Finally I write about (and teach)...
  • Blog Post: Create Outlook Appointments from PowerShell

    I've been toying around with a script to create a special set of calendar objects in Outlook that show when my SQL Server Agent Jobs are scheduled to run. I haven't finished yet, but I thought I would share the part that creates the Outlook Appointments.I have yet to fill a variable with the start and...
  • Blog Post: PowerShell Version Two – Get Continuous Perf Counters

    In version 2.0 of PowerShell, you can now use a direct command-let (get-Counter) to get at the Performance Monitor counters. For instance, to show the current value of the Processor Percent Time, use this command:   Get-Counter '\Processor(*)\% Processor Time'     The interesting...
  • Blog Post: Start a SQL Server Agent Job using the SQL Server PowerShell Provider

    Whew!  That’s a mouthfull. Anyway, I thought I would share part of a script I wrote today to help automate (more) from PowerShell. This assumes a few things: that you’re doing this from the SQL Server 2008 PowerShell provider (not just good old regular PowerShell) and that you change the HAL9000...
  • Blog Post: Tools and Processes for “Fitting it all in”

    Most data professionals I’ve met work in two modes: we plan for our day, and we react to the situations around us. I’m staring at my list of things that I need to do today right now, which is my planned work. Of course, I have no idea how much of that will really get done – it’s optimistic to be sure...
  • Blog Post: Performance Counters? There’s a script for that.

    It’s not hard to get Performance Monitor counters in PowerShell 1.0, and it’s REALLY easy in 2.0. This is one I used yesterday to monitor network bytes in and out on 2.0 (keep all of the green lines in this post on the same line) : get-counter -Counter "\Network Interface(*)\Bytes Total/sec"...
  • Blog Post: Measure Statement Performance with PowerShell

    When you monitor for performance, you might start in the database server itself. But a true test really has more to do with the “round trip” of a data request from a client to a server and then the return of data back to the client. So I wired up this little test to simulate that process, and now I can...
  • Blog Post: PowerShell Demo Prompt

    When I teach I have to set my fonts really big so that folks in the back can see. I show PowerShell from time to time, and people keep asking me about my latest prompt.   Here’s what my prompt looks like:   { univac\Buck on UNIVAC using AMD64 } --     12/23/2009 7:54:10 PM    ...
  • Blog Post: SQL Server Best Practices: Protect CmdExec

    In SQL Server, there are times that you need to do things in the operating system, and to allow that there is a feature called CmdExec. This is not always a good thing –whenever you leave the confines of SQL Server and go out to the operating system, you can cause issues, not the least of which are security...
  • Blog Post: Create an Excel Graph of your Big Tables – with PowerShell!

    I showed a demo of how to find the top ten tables in the database at the PASS Conference. Here’s that script – you’ll need to fix the server name, instance name, and database name. You can use this to display any numbers – and even more. The mind reels with the possibilities. This uses the PowerShell...
  • Blog Post: Read a Web Page from PowerShell, Make a Web Page from a Database Query From PowerShell

    I presented at the Pacific Northwest SQL Server User Group here in the Seattle area last night, and I was asked at the break about reading a web page in PowerShell, and being able to do something with the data it has. There are actually a few ways to do that, but you should probably start with the net...
  • Blog Post: PowerShell and SQL Server: Script all Tables

    This is a script that I found/put together/re-arranged that will script out all of the tables from a database - in this case, Adventureworks2008. You need to change the BWOODY1 part to the name of your server, and the SQL2K8 part to your Instance name. You can change the database name as well, of course...
  • Blog Post: Use PowerShell to Backup All User Databases

    This script will back up all user databases - you need to change the BWOODY1\SQL2K8 part to your server\instance name, and of course, you should only run this on a test system until you completely understand it. Unfortunately, the SQL Server PowerShell Provider doesn't make this very easy - and there...
  • Blog Post: Read the SQL Server Error Log with PowerShell

    This script uses a native client call, so you can use it on any machine that has PowerShell installed along with the SQL Server client software. As always, only run this script on a test system until you understand what it does, and of course you'll need to change the server name in the connection string...
Page 1 of 3 (53 items) 123