﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Zach Mattson / Article Discussions / Article Discussions by Author  / Paging Doctor Powershell / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 08:12:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>You can dump directly to SQL, I do that for gathering stats for our VM admins.  I don't like looking at csvs or text files anymore than the next DBA.Once you have a list of counters (note I have some extra properties in my object collection) - you could simply call a proc (or just directly insert them) $CounterCollection | Where-Object{$_.Path -ne $null} | ForEach-Object{			$qry = "EXEC .dbo.pr_Add_Perf_Collection "			$qry = $qry + "  @server='" + [string]$_.Server + "'"			$qry = $qry + ", @performance_metric='" + [string]$_.Path + "'"			$qry = $qry + ", @performance_value=" + [decimal]$_.CookedValue			$qry = $qry + ", @date_sampled='"+ $_.Timestamp + "'"						$qry = $qry + ", @samples_taken=" + $_.Samples			$qry = $qry + ", @sample_interval=" + [int]$_.SampleInterval		Invoke-SqlNonQuery -ServerInstance $SQLServerToStore -Query $qry	}function Invoke-SqlNonQuery{    param(    [string]$ServerInstance,    [string]$Query    )	$QueryTimeout=30    $conn=new-object System.Data.SqlClient.SQLConnection	$constring = "Server=" + $ServerInstance + ";Integrated Security=True"	$conn.ConnectionString=$constring    	$conn.Open()		if($conn){    	$cmd=new-object system.Data.SqlClient.SqlCommand($Query,$conn)    	$cmd.CommandTimeout=$QueryTimeout		$cmd.ExecuteNonQuery() | out-null    	$conn.Close()	}}Hope this helps.  I will see about writing a perfmon metric gather/storage article if SSC wants to publish it.</description><pubDate>Thu, 07 Apr 2011 07:17:58 GMT</pubDate><dc:creator>WI-DBA</dc:creator></item><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>nice article, going to have to look at it. right now i have perfmon running on a server dumping data to a central database where i run reports from. this is a lot lighter, but i was going to use the perfmon data for historical baselines as well. one thing i don't like about powershell is that you can't seem to dump the data into SQL</description><pubDate>Thu, 07 Apr 2011 07:08:35 GMT</pubDate><dc:creator>alen teplitsky</dc:creator></item><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>I don't have anything step by step - but I could easily create a step by step article or a set of blog posts that cover it.  Is that something people would like to see?  It could be articles or I could just blog it in small bites.The script I uploaded should be able to be run as long as you have Powershell 2 installed without any issues.  (you shouldn't need any experience)  Just give it a server name and a few hours and let it run.  </description><pubDate>Tue, 05 Apr 2011 12:22:32 GMT</pubDate><dc:creator>WI-DBA</dc:creator></item><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>This looks like some great stuff, however I am new to powershell. Do you have any step by step instructions for running the scripts? I would like to try it out in my test servers.Thanks,David</description><pubDate>Tue, 05 Apr 2011 07:14:07 GMT</pubDate><dc:creator>dawaller</dc:creator></item><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>Thanks.  If folks have ideas on things to add to it, let me know and I can work them in and share the script.</description><pubDate>Tue, 05 Apr 2011 06:04:22 GMT</pubDate><dc:creator>WI-DBA</dc:creator></item><item><title>RE: Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>Nice article and useful tool.Thanks</description><pubDate>Mon, 04 Apr 2011 22:19:43 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>Paging Doctor Powershell</title><link>http://www.sqlservercentral.com/Forums/Topic1087903-297-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/SQL+Server/72678/"&gt;Paging Doctor Powershell&lt;/A&gt;[/B]</description><pubDate>Sun, 03 Apr 2011 23:18:03 GMT</pubDate><dc:creator>WI-DBA</dc:creator></item></channel></rss>