PowerShell: CPM – Creating SQL Table

In the intro I discussed my need to manage all script parameters centrally. To do this I want to create a PowerShell module to manage the parameters and to store the data in a SQL database.

First things first, lets set up a SQL database and table.

Storing the data

To be able to store the date in SQL I need to create a table in a database.
I used our existing SysAdmin database to add a script-parameter-table.

A parameter-object should have only a few basic properties:

  • Name: The actual name to be used in scripts
  • Value: The value to be linked to the name
  • Description: A description so everyone knows what the parameter is for

If we translate these requirements into a MSSQL statement we get:

CREATE TABLE [ScriptParameter](
	[Name] [nvarchar](50) NOT NULL,
	[Value] [nvarchar](max) NOT NULL,
	[Description] [text] NULL

Creating the object

Now that we have a place to store the data we need an object to work with.
Next step: New Parameter Object


Tags: , , , , ,

5 responses to “PowerShell: CPM – Creating SQL Table”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: