Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Powershell and Administration


Powershell and Administration

Author
Message
Sankey
Sankey
Mr or Mrs. 500
Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)

Group: General Forum Members
Points: 514 Visits: 151
At PASS Summit 08, I was introduced to Powershell, and I was pretty excited about using it to track information about some of the SQL servers at my company. I'm aspiring to become a DBA, but I'm a developer at the moment. I was wondering if there were other DBA's out there or general administrators who use Powershell to monitor and track information about their servers. If so, what information are you tracking? Is powershell a good administrative tool to be using or should I focus on something else?

I'm currently tracking disk space, SQL job errors, SQL log file sizes, SQL data file sizes, last SQL backup dates, system errors, and application errors.

Thanks for your time and input
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36310 Visits: 18752
Powershell is being built into Windows and Exchange as the admin language for systems from Microsoft. I bet that you'd find tons of people using it in other areas with Windows systems. I'd run a Google search for monitoring servers with Powershell.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17635 Visits: 32268
We've started using PowerShell more and more, but not so much for monitoring since we use Operations Manager for that. We've mainly been using it as a means for cleaning up backups & log files. I've also created a script that simply verifies connectivity on all our servers. As soon as I learn how to spawn threads (can you?) I'll create a massive DBCC check to run against all our servers after a power down event (we get one a year and they're a royal pain in the back side).

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Jeffrey Williams 3188
Jeffrey Williams 3188
SSCarpal Tunnel
SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)

Group: General Forum Members
Points: 4465 Visits: 9833
Grant Fritchey (4/6/2009)
We've started using PowerShell more and more, but not so much for monitoring since we use Operations Manager for that. We've mainly been using it as a means for cleaning up backups & log files. I've also created a script that simply verifies connectivity on all our servers. As soon as I learn how to spawn threads (can you?) I'll create a massive DBCC check to run against all our servers after a power down event (we get one a year and they're a royal pain in the back side).


Not in v1 (AFAIK) - but, I hear that v2 not only has remoting capabilities but also the ability to create multiple threads (jobs).

I use powershell scripts to get information loaded into a central repository to track data space usage, last backup, version info, etc...

Jeffrey Williams
Problems are opportunities brilliantly disguised as insurmountable obstacles.

How to post questions to get better answers faster
Managing Transaction Logs

Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17635 Visits: 32268
Jeffrey Williams (4/6/2009)

Not in v1 (AFAIK) - but, I hear that v2 not only has remoting capabilities but also the ability to create multiple threads (jobs).

I use powershell scripts to get information loaded into a central repository to track data space usage, last backup, version info, etc...


Ah, that stinks. Well, then I'll still be running a whole bunch of TSQL windows in SSMS like usual. It works well enough. It's just a pain in the bottom to set up.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Sankey
Sankey
Mr or Mrs. 500
Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)Mr or Mrs. 500 (514 reputation)

Group: General Forum Members
Points: 514 Visits: 151
I'll have to check out Operations Manager. It appears there is a lot you can do with Powershell, and I wasn't sure what other people on this site were using it for.

Thanks for your replies.
Mike - CI
Mike - CI
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 1155
Some of the things that I have been using it for on some of our lower level servers (that we do not have licenses for commercial monitoring tools) are to:

verify SQL Agents are Running
verify SQL connectivity
Ping Servers
Send messages on failures of these things
storing all of this sort of data within SQL for reporting later

These things can be useful if you can not afford Idera DM or Quest Spotlight for your servers, since it can give you most of that same inforamation.

As mentioned above we also use it for space tracking on all of our servers (SQL and Non-SQL). WMI is great for that sort of thing.

I have also found Powershell useful if you are the kind of person automated copying/deleting/maintenance of files. It gives a very easy interface for that sort of thing, and once you create the script you can just keep calling the same script with different arguments, which makes it very flexible.

I am always looking for other ideas to use PS for so I would love to see if anyone else has thoughts.
Hope Foley-443128
Hope Foley-443128
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 507
I've used it to help create a script to delete old backups that SQL Server wasn't getting rid of and also to create an at a glance report to tell me what agent jobs have failed, what errors are in the sql log, and disk space available quickly. I don't have the luxury of admin tools at a lot of my clients so I've started creating some things on my own that are useful.
GabyYYZ
GabyYYZ
Say Hey Kid
Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)Say Hey Kid (673 reputation)

Group: General Forum Members
Points: 673 Visits: 2332
I am actually excited at the possibilities of automating a lot of my work with Powershell. I enjoy scripts (having had fun with shell scripts and Perl in the past), and if I could integrate them in a way that saves a lot of time for me, I'm all for it.

Gaby
________________________________________________________________
"In theory, theory and practice are the same. In practice, they are not."
- Albert Einstein

Robert Davis
Robert Davis
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1702 Visits: 1623
I've started using PowerShell only recently myself. Personally, I was really disappointed when they replaced SQL-DMO with SMO/AMO/RMO because they are not scripted interfaces. For me, the reason I love powershell is that it has turned SMO into a scripted interface again.

I've posted some powershell scripts on my blog, most of which came out of my powershell script for database mirroring. I wrote a powershell script that performs the entire setup of database mirroring from the script. The real power of it is that I can run the script from my laptop to set up mirroring on remote servers that do not have powershell installed.

That script won't be on my blog though. You'll have to buy my book to get that one. :-D



My blog: SQL Soldier
Twitter: @SQLSoldier
My book: Pro SQL Server 2008 Mirroring
Microsoft Certified Master, SQL Server MVP
Database Engineer at BlueMountain Capital Management
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search