<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>$hell Your Experience !!! #PowerShellLifeStyle</title>
	<atom:link href="http://shellyourexperience.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://shellyourexperience.wordpress.com</link>
	<description>As aventuras de um DBA usando o Poder do $hell</description>
	<lastBuildDate>Mon, 05 Dec 2011 23:41:50 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='shellyourexperience.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>$hell Your Experience !!! #PowerShellLifeStyle</title>
		<link>http://shellyourexperience.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://shellyourexperience.wordpress.com/osd.xml" title="$hell Your Experience !!! #PowerShellLifeStyle" />
	<atom:link rel='hub' href='http://shellyourexperience.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Notification of low disk space (Mount points too) and Handle Alert Suppression&#8211;PowerShell</title>
		<link>http://shellyourexperience.wordpress.com/2011/12/05/notification-of-low-disk-space-mount-points-too-and-handle-alert-suppressionpowershell/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/12/05/notification-of-low-disk-space-mount-points-too-and-handle-alert-suppressionpowershell/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 23:09:58 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/?p=924</guid>
		<description><![CDATA[We have a server of approval, yes I know it&#8217;s approval, but because of holidays and how we are a major retailer, this server has become critical to the business, given that many changes are made ​​to the systems at &#8230; <a href="http://shellyourexperience.wordpress.com/2011/12/05/notification-of-low-disk-space-mount-points-too-and-handle-alert-suppressionpowershell/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=924&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have a server of approval, yes I know it&#8217;s approval, but because of holidays and how we are a major retailer, this server has become critical to the business, given that many changes are made ​​to the systems at this time.
<p>As our monitoring process is a bit bureaucratic to happen, we needed a quick solution for verification of low disk space on this server. Solution. Powershell and WMI
<p>I wanted to build a more flexible solution possible, so I thought of a way to the script get all the server volumes and report on a value below X (passed parameter). My first version was:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> $Hostname = <span style="color:#006080;">'Server01'</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> $Space = 2048</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> $SpaceGB =  $Space / 1024</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> Get-WmiObject               -computername $Hostname  `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>                              -query <span style="color:#006080;">" select Name  from Win32_Volume where  DriveType = 3 and SystemVolume = false and FileSystem = 'NTFS'"</span>              | <span style="color:#0000ff;">foreach</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>                <span style="color:#0000ff;">try</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span>                                $Volume = ($($_.name).TrimEnd(<span style="color:#006080;">"\")).replace("</span>\<span style="color:#006080;">" ,"</span>\\<span style="color:#006080;">")</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>                                $SourceIdentifier = (($($_.name)).replace("</span>\<span style="color:#006080;">" ,"</span><span style="color:#006080;">")).replace("</span>:<span style="color:#006080;">","</span><span style="color:#006080;">")</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span>                                $query = "</span>Select * from __instanceModificationEvent WITHIN 5 WHERE TargetInstance ISA <span style="color:#006080;">'Win32_PerfFormattedData_PerfDisk_LogicalDisk'</span> and targetinstance.Name=`<span style="color:#006080;">'$($Volume)`'</span> AND TargetInstance.freemegabytes &lt; $space<span style="color:#006080;">"</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>                                Register-WMIEvent       -ComputerName $Hostname `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>                                                        -Query  $Query  `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>                                                          -SourceIdentifier "</span>LowDiskSpace$($SourceIdentifier)<span style="color:#006080;">" `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>                                                          -Action    {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>                                                                         $Gb = "</span>{0:n2}<span style="color:#006080;">" -f ($event.SourceEventArgs.NewEvent.targetinstance.FreeMegabytes/1024);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>                                                                         Send-MailMessage        -SmtpServer XXX.X.XX.XXX -From 'SQLExecutive@contoso.com' -To  'laerte.junior@contoso.com.br' -Subject "</span>Espaco em Disco Abaixo de $($SpaceGB) GB - Servidor  $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.__SERVER)<span style="color:#006080;">" -Body "</span> Volume $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.name) com $Gb GB<span style="color:#006080;">";</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>                                                                         Write-EventLog -LogName MonitorLowDiskSpace -EventId 01 -Message "</span>Espaco em Disco Abaixo de $($SpaceGB) GB - Servidor  $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.__SERVER) Volume $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.name) com $Gb GB<span style="color:#006080;">"  -Source Poshevent -EntryType Warning -Category 1 -ComputerName $Hostname</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>                                                                     } | Out-Null</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>                                $log = "</span>Event registered <span style="color:#0000ff;">in</span> Volume $($Volume) computer $($Hostname)<span style="color:#006080;">" </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>                } catch {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>                                $Log = "</span>Failed to Register WMI Event on {0} volume {2}. {1}<span style="color:#006080;">" -f $($Hostname),$($Volume),$($_.Exception.Message)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>                }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>                $log | Out-File "</span>$Env:TEMP\MsgEvents$(Get-date -format <span style="color:#006080;">'ddMMyyyy'</span>).log<span style="color:#006080;">" -Append</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span> }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span> Send-MailMessage        -SmtpServer XXX.X.XX.XXX -From 'SQLExecutive@contoso.com' -To  'laerte.junior@contoso.com.br' -Subject "</span>Eventos de Espaco em Disco<span style="color:#006080;">" -Body "</span>Script de Registro de evento em espaco em disco executado no servidor $($Hostname). Verificar Arquivo de log $Env:TEMP\MsgEvents$(Get-date -format <span style="color:#006080;">'ddMMyyyy'</span>).log ";</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>&nbsp; </pre>
<p><!--CRLF--></div>
</div>
<p>Lets see some things :<br />&nbsp;</p>
<p>First I need to find the volumes, that is because I am using Win32_Volume and properties DriveType = 3 and SystemVolume = false and FileSystem = &#8216;NTFS&#8217;.<br />The drive type = 1 show only Local Disk, System Volume = false to not use system volume and FileSystem = &#8216;NTFS&#8217; only want the NTFS formatted volumes.<br />Then I am using <strong>Win32_PerfFormattedData_PerfDisk_LogicalDisk</strong> class to get the data from this volumes .</p>
<p>in this line <br /><strong>$Volume = ($($_.name).TrimEnd(&#8220;\&#8221;)).replace(&#8220;\&#8221; ,&#8221;\\&#8221;)</strong></p>
<p><strong>I</strong> formated the volume to take off the &#8216;\&#8217; at the end of the volume, because the mount points is showed as d:\something\ and I change the &#8216;\&#8217; to &#8216;\\&#8217; because &#8216;\&#8217; is a special char.</p>
<p>in this line<br /><strong>$SourceIdentifier = (($($_.name)).replace(&#8220;\&#8221; ,&#8221;")).replace(&#8220;:&#8221;,&#8221;")</strong></p>
<p>I cleaned&nbsp; the volume name to concatenate in –SourceIdentifier &#8220;LowDiskSpace$($SourceIdentifier)&#8221;. This way I haveJob Name each event registered</p>
<p>Then I createed a Log File with messsage successful or failed and put at $env:temp<br /><strong>$log | Out-File &#8220;$Env:TEMP\MsgEvents$(Get-date -format &#8216;ddMMyyyy&#8217;).log&#8221; -Append</strong></p>
<p>This way I do not have a email to each event registered or not, juts one email to see the log file at $Env:TEMP\MsgEvents$(Get-date -format &#8216;ddMMyyyy&#8217;).log</p>
<p>Also Created a new Entry in EventViewer called MonitorLowDiskSpace to log the data into EventViewer too.</p>
<p><strong>New-EventLog MonitorLowDiskSpace -source PoshEvent</strong></p>
<p>And&nbsp; was working fine, but in the first problem with disk space a message each 5 seconds was delivery to my email. (within clause to 5)<br />Then, I changed to 30 minutes (1800 seconds). But, other problem. when the low disk space happened again, the first email only was delivery after 30 minutes. Bummer.<br />So, I decided to create my own alert suppression.</p>
<p><strong>Handle with alert Suppression</strong></p>
<p>My Idea is simple. Just create a log file with the date and hour that the email was sent and then in the next execution I test if the minutes between current date (get-date) and the data logged into the file is greater than X minutes. (Pareameter $Time). If it is, send email again and update the file with the current date time. No, just ignore it.</p>
<p>So the code is :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> #New-EventLog MonitorLowDiskSpace -source PoshEvent</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> Param      (</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>                  [ValidateNotNullOrEmpty()] $Hostname,</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>                  [ValidateNotNullOrEmpty()] $Space</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>                  [ValidateNotNullOrEmpty()] $Time</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>            )</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> #$Hostname = <span style="color:#006080;">'Server01'</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> #$Space = 2048</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span> #Time 10 -minutes</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> $SpaceGB =  $Space / 1024</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> Get-WmiObject               -computername $Hostname  `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>                              -query <span style="color:#006080;">" select Name  from Win32_Volume where  DriveType = 3 and SystemVolume = false and FileSystem = 'NTFS'"</span>              | <span style="color:#0000ff;">foreach</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span>                <span style="color:#0000ff;">try</span> {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum17">  17:</span>                               $Volume = ($($_.name).TrimEnd(<span style="color:#006080;">"\")).replace("</span>\<span style="color:#006080;">" ,"</span>\\<span style="color:#006080;">")</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum18">  18:</span>                               $SourceIdentifier = (($($_.name)).replace("</span>\<span style="color:#006080;">" ,"</span><span style="color:#006080;">")).replace("</span>:<span style="color:#006080;">","</span><span style="color:#006080;">")</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum19">  19:</span>                               $SourceIdentifier = "</span>LowDiskSpace$($SourceIdentifier)<span style="color:#006080;">" </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum20">  20:</span>                               $FileName = "</span>$($Env:TEMP)\$($SourceIdentifier).log<span style="color:#006080;">"</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum21">  21:</span>                               $pso = new-object psobject -property @{FileName=$FileName;Time=$Time}              </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum22">  22:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum23">  23:</span>                                $query = "</span>Select * from __instanceModificationEvent WITHIN 5 WHERE TargetInstance ISA <span style="color:#006080;">'Win32_PerfFormattedData_PerfDisk_LogicalDisk'</span> and targetinstance.Name=`<span style="color:#006080;">'$($Volume)`'</span> AND TargetInstance.freemegabytes &lt; $space<span style="color:#006080;">"</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum24">  24:</span>                                Register-WMIEvent       -ComputerName $Hostname `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum25">  25:</span>                                                        -Query  $Query  `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum26">  26:</span>                                                          -SourceIdentifier $SourceIdentifier `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum27">  27:</span>                                                          -Action    {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum28">  28:</span>                                                                         $SendEmail = $true</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum29">  29:</span>                                                                         if (Test-Path $event.MessageData.FileName  -PathType Leaf ) {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum30">  30:</span>                                                                               $SendEmail = ((New-TimeSpan -Start ([datetime]::parseexact((get-content $event.MessageData.FileName),'yyyy-MM-dd HH:mm:ss',$null)) -End (get-date -format "</span>yyyy-MM-dd HH:mm:ss<span style="color:#006080;">")).totalminutes -ge  $event.MessageData.Time) ;</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum31">  31:</span>                                                                         }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum32">  32:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum33">  33:</span>                                                                         if ($SendEmail) {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum34">  34:</span>                                                                               $Gb = "</span>{0:n2}<span style="color:#006080;">" -f ($event.SourceEventArgs.NewEvent.targetinstance.FreeMegabytes/1024);</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum35">  35:</span>                                                                               Send-MailMessage      -SmtpServer XXX.X.XX.XXX -From 'SQLExecutive@contoso.com' -To  'laerte.junior@contoso.com.br'  -Subject "</span>Espaco em Disco Abaixo de $($SpaceGB) GB - Servidor  $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.__SERVER)<span style="color:#006080;">" -Body "</span> Volume $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.name) com $Gb GB<span style="color:#006080;">";</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum36">  36:</span>                                                                               Write-EventLog -LogName MonitorLowDiskSpace -EventId 01 -Message "</span>Espaco em Disco Abaixo de $($SpaceGB) GB - Servidor  $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.__SERVER) Volume $($<span style="color:#0000ff;">event</span>.SourceEventArgs.NewEvent.targetinstance.name) com $Gb GB<span style="color:#006080;">"  -Source Poshevent -EntryType Warning -Category 1 -ComputerName $Hostname</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum37">  37:</span>                                                                               get-date -format 'yyyy-MM-dd HH:mm:ss' | Out-File  $event.MessageData.FileName -Force </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum38">  38:</span>                                                                         }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum39">  39:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum40">  40:</span>                                                                     } | Out-Null</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum41">  41:</span>                                $log = "</span>Event registered <span style="color:#0000ff;">in</span> Volume $($Volume) computer $($Hostname)<span style="color:#006080;">" </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum42">  42:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum43">  43:</span>                } catch {</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum44">  44:</span>                                $Log = "</span>Failed to Register WMI Event on {0} volume {2}. {1}<span style="color:#006080;">" -f $($Hostname),$($Volume),$($_.Exception.Message)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum45">  45:</span>                }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum46">  46:</span>                $log | Out-File "</span>$Env:TEMP\MsgEvents$(Get-date -format <span style="color:#006080;">'ddMMyyyy'</span>).log<span style="color:#006080;">" -Append</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum47">  47:</span> }</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum48">  48:</span> Send-MailMessage        -SmtpServer XXX.X.XX.XXX -From 'SQLExecutive@contoso.com' -To  'laerte.junior@contoso.com.br' -Subject "</span>Eventos de Espaco em Disco<span style="color:#006080;">" -Body "</span>Script de Registro de evento em espaco em disco executado no servidor $($Hostname). Verificar Arquivo de log $Env:TEMP\MsgEvents$(Get-date -format <span style="color:#006080;">'ddMMyyyy'</span>).log ";</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum49">  49:</span>&nbsp; </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum50">  50:</span>&nbsp; </pre>
<p><!--CRLF--></div>
</div>
<p></p>
<p>Big Thanks to Shay Levy to help in my datetime questions <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Alegre" src="http://shellyourexperience.files.wordpress.com/2011/12/wlemoticon-smile.png?w=584"></p>
<p><a href="https://skydrive.live.com/?cid=c16042a4306a1328#cid=C16042A4306A1328&amp;id=C16042A4306A1328%211717">Download&nbsp; LowDiskSpace.ps1</a></p>
<p><strong>#PowerShellLifeStyle</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/924/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/924/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/924/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=924&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/12/05/notification-of-low-disk-space-mount-points-too-and-handle-alert-suppressionpowershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/12/wlemoticon-smile.png" medium="image">
			<media:title type="html">Alegre</media:title>
		</media:content>
	</item>
		<item>
		<title>Slides e Scripts&#8211;24HOPLATAM&#8211;Hey PowerShell, voce pode me notificar ?</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/20/slides-e-scripts24hoplatamhey-powershell-voce-pode-me-notificar/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/20/slides-e-scripts24hoplatamhey-powershell-voce-pode-me-notificar/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 08:36:07 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/20/slides-e-scripts24hoplatamhey-powershell-voce-pode-me-notificar/</guid>
		<description><![CDATA[Pessoal, segue os scripts e slides da minha sessão Hey PowerShell , você pode me notificar ? Eu coloquei meu modulo de funções também. Basta voce colocar no seu profile e pronto. No caso da send-smtpemail, basta trocar dentro dela &#8230; <a href="http://shellyourexperience.wordpress.com/2011/10/20/slides-e-scripts24hoplatamhey-powershell-voce-pode-me-notificar/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=922&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Pessoal, segue os scripts e slides da minha sessão </p>
<p>Hey PowerShell , você pode me notificar ?</p>
<p>Eu coloquei meu modulo de funções também. Basta voce colocar no seu profile e pronto. No caso da send-smtpemail, basta trocar dentro dela o usuario e a senha em :</p>
<p>#sua credencial aqui<br />$mailer.Credentials = New-Object System.Net.NetworkCredential(&#8220;<strong>Nome</strong>&#8220;, &#8220;<strong>senha</strong>&#8220;); # Put username without the @GMAIL.com or – @gmail.com</p>
<p>Abs</p>
<p><a href="https://skydrive.live.com/?cid=c16042a4306a1328#!/?cid=c16042a4306a1328&amp;sc=documents&amp;uc=1&amp;id=C16042A4306A1328%211717">Download</a></p>
<p><strong>#PowerShellLifeStyle</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/922/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/922/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/922/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=922&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/20/slides-e-scripts24hoplatamhey-powershell-voce-pode-me-notificar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>Speaking 24HOPLATAM&#8211;Notifications with PowerShell and WMI/WMI Server Events</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/15/speaking-24hoplatamnotifications-with-powershell-and-wmiwmi-server-events/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/15/speaking-24hoplatamnotifications-with-powershell-and-wmiwmi-server-events/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 21:43:40 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/15/speaking-24hoplatamnotifications-with-powershell-and-wmiwmi-server-events/</guid>
		<description><![CDATA[Nos dias 19 e 20 de outubro acontecerá o maior evento gratuito online da América Latina. O 24 hours of PASS LATAM , o mesmo contará com uma grade cheia de novidades sobre o SQL Server “Denali” (versão CTP3). Haverá &#8230; <a href="http://shellyourexperience.wordpress.com/2011/10/15/speaking-24hoplatamnotifications-with-powershell-and-wmiwmi-server-events/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=919&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Nos dias 19 e 20 de outubro acontecerá o maior evento gratuito online da América Latina. O <a href="https://www323.livemeeting.com/lrs/8000181573/Registration.aspx?pageName=b7tqr85g08m9br8r">24 hours of PASS LATAM</a> , o mesmo contará com uma grade cheia de novidades sobre o SQL Server “Denali” (versão CTP3). Haverá diversos palestrantes desde Espanha, Costa Rica, Venezuela, Guatemala, Argentina, Brasil e etc.
<p>Eu vou falar dia <strong>19 as 11:00 da manhã (Brasilia Time) 09:00 CDT (Mexico),</strong> sobre notificações de eventos usando <strong>PowerShell e WMI/WMI Server Events</strong>. Veremos o que é WMI , WQL, Event Query Language, quais suas variações e como usar. Depois será codigo, codigo, codigo…
<p>Inscrições:<a href="https://www323.livemeeting.com/lrs/8000181573/Registration.aspx?pageName=b7tqr85g08m9br8r">24 Horas PASS LATAM – Denali “Camino al 2012″</a>
<p>Grade do Evento e Fonte :</p>
<p><a href="http://cibellecastro.wordpress.com/2011/10/05/24-hours-of-pass-latam-2/">Blog da Cibelle Castro</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/919/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=919&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/15/speaking-24hoplatamnotifications-with-powershell-and-wmiwmi-server-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>Comparing and Scripting SQL Server Database Objects  using PowerShell and SQLPSX</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/14/comparing-and-scripting-sql-server-database-objects-using-powershell-and-sqlpsx/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/14/comparing-and-scripting-sql-server-database-objects-using-powershell-and-sqlpsx/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 23:55:26 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/14/comparing-and-scripting-sql-server-database-objects-using-powershell-and-sqlpsx/</guid>
		<description><![CDATA[Today I had to compare two databases on different servers, looking for views on the server1 and not were&#160; in a server2. I used the compare-object cmdlet : $Source = Get-SqlDatabase -sqlserver ServerSource -dbname DB1 &#124; Get-SqlView $Dest = Get-SqlDatabase &#8230; <a href="http://shellyourexperience.wordpress.com/2011/10/14/comparing-and-scripting-sql-server-database-objects-using-powershell-and-sqlpsx/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=917&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I had to compare two databases on different servers, looking for views on the server1 and not were&nbsp; in a server2.</p>
<p>I used the <strong>compare-object</strong> cmdlet :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$Source = Get-SqlDatabase -sqlserver ServerSource -dbname DB1 | Get-SqlView </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$Dest = Get-SqlDatabase -sqlserver ServerDest -dbname DB2 | Get-SqlView</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"> </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$DiffViews = Compare-Object -DifferenceObject $dest `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            -ReferenceObject $Source `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            -Property Name | ?{$_.SideIndicator -eq <span style="color:#006080;">'&lt;='</span>} | % {$_.Name}</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$scriptingOptions = New-SqlScriptingOptions</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$scriptingOptions.Permissions = $<span style="color:#0000ff;">true</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$scriptingOptions.IncludeIfNotExists = $<span style="color:#0000ff;">true</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">get-sqldatabase -sqlserver ServerSource-dbname DB2| Get-SqlView | ?{$DiffViews -contains $_.name} | Get-SqlScripter -scriptingOptions $scriptingOptions | Out-File c:\temp\DiffViews.sql</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"> </pre>
<p><!--CRLF--></div>
</div>
<p>Then, was just use Get-SqlScripter to Script the difference and out to c:\temp\DiffViews.sql</p>
<p>Thanks to Sir Chad Miller to help me in the final script <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Alegre" src="http://shellyourexperience.files.wordpress.com/2011/10/wlemoticon-smile1.png?w=584"></p>
<p><strong>Simple, Fast and Clean. Classic PowerShell</strong></p>
<p>#PowerShellLifeStyle</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/917/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/917/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/917/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=917&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/14/comparing-and-scripting-sql-server-database-objects-using-powershell-and-sqlpsx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/wlemoticon-smile1.png" medium="image">
			<media:title type="html">Alegre</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerShell and WMI Server Events (SQL Server)&#8211;Who is running DBCC commands on my servers ?</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/13/powershell-and-wmi-server-events-sql-serverwho-is-running-dbcc-commands-on-my-servers/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/13/powershell-and-wmi-server-events-sql-serverwho-is-running-dbcc-commands-on-my-servers/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 23:19:57 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/13/powershell-and-wmi-server-events-sql-serverwho-is-running-dbcc-commands-on-my-servers/</guid>
		<description><![CDATA[This morning, in the early hours of the day, we had some kind of weird happenings in our SAP environment. The system showed a massive slowdown, and the BASIS asked our help to find the problem. We have seen that &#8230; <a href="http://shellyourexperience.wordpress.com/2011/10/13/powershell-and-wmi-server-events-sql-serverwho-is-running-dbcc-commands-on-my-servers/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=912&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This morning, in the early hours of the day, we had some kind of weird happenings in our SAP environment.</p>
<p>The system showed a massive slowdown, and the BASIS asked our help to find the problem. We have seen that several DBCC CHECKDB command, DBCC TRACEON were running at the same time, something like a 30 dbcc checkdbs</p>
<p>We Killed the sessions and after a few minutes they came back again. Well, we needed to know where these commands were coming, any SAP service or not.</p>
<p>From my machine, in the cluster, I just used ONE PowerShell Line
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">Register-WMIEvent  -ComputerName RemoteServer `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                   -Namespace <span style="color:#006080;">'root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                   -Query <span style="color:#006080;">"select * from AUDIT_DBCC_EVENT"</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                   -Action { Send-MailMessage  -SmtpServer 111.1.11.111 -From <span style="color:#006080;">'SQLExecutive@contoso.com.br'</span> -To <span style="color:#006080;">'grpDBA@contoso.com.br'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                               -Subject <span style="color:#006080;">'Auditoria Comandos DBCC Servidor SQLECC'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                               -Body <span style="color:#006080;">"ApplicationName : $($event.SourceEventArgs.NewEvent.ApplicationName) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       ServerName : $($event.SourceEventArgs.NewEvent.ServerName)`n </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       Database ID : $($event.SourceEventArgs.NewEvent.Databaseid) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       Database Name : $($event.SourceEventArgs.NewEvent.DatabaseName ) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       DBUserName : $($event.SourceEventArgs.NewEvent.DBUserName ) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       HostName : $($event.SourceEventArgs.NewEvent.HostName) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       LoginName : $($event.SourceEventArgs.NewEvent.LoginName) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       NTDomainName : $($event.SourceEventArgs.NewEvent.NTDomainName) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       NTUserName : $($event.SourceEventArgs.NewEvent.NTUserName) </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       SPID : $($event.SourceEventArgs.NewEvent.spid)`n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       SessionLoginName : $($event.SourceEventArgs.NewEvent.SessionLoginName)`n </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       Start Time : $([Management.ManagementDateTimeConverter]::ToDateTime($event.SourceEventArgs.NewEvent.StartTime))`n </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                       TextData : $($event.SourceEventArgs.NewEvent.TextData)"</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                        </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                   }</pre>
<p><!--CRLF--></div>
</div>
<p>Just register the event in the AUDIT_DBCC_EVENT Class and be happy.!!!</p>
<p>ha..after that, we need to be notified on dbcc traceon only…, juts change the query to :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#006080;">"select * from AUDIT_DBCC_EVENT where textdata like '%Traceon%'"</span></pre>
<p><!--CRLF--></div>
</div>
<p>&nbsp;<strong><font color="#0000ff">Simple, Faster and Clean !!!! Classic PowerShell !!!</font></strong></p>
<p><strong>#PowerShellLifestyle !!!</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/912/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=912&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/13/powershell-and-wmi-server-events-sql-serverwho-is-running-dbcc-commands-on-my-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>Slides and PowerShell Scripts&#8211;My SQLBITS 9 Session</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/08/slides-and-powershell-scriptsmy-sqlbits-9/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/08/slides-and-powershell-scriptsmy-sqlbits-9/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 11:42:54 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/08/slides-and-powershell-scriptsmy-sqlbits-9/</guid>
		<description><![CDATA[Hi Guys, although Murphy had come grace me with your presence in my session, my VM crashes online (was beautiful), follows the slides and scripts. Download &#8211; SQLBITS9 &#8211; PowerShell and WMI-WMI Server Events #PowerShellLifeStyle<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=910&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi Guys, although Murphy had come grace me with your presence in my session, my VM crashes online (was beautiful), follows the slides and scripts.</p>
<p><a href="https://skydrive.live.com/?sc=documents&amp;cid=c16042a4306a1328#!/?cid=c16042a4306a1328&amp;sc=documents&amp;uc=1&amp;id=C16042A4306A1328%211717">Download &#8211; SQLBITS9 &#8211; PowerShell and WMI-WMI Server Events</a></p>
<p><strong>#PowerShellLifeStyle</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/910/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=910&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/08/slides-and-powershell-scriptsmy-sqlbits-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLBITS &#8211; Unforgettable</title>
		<link>http://shellyourexperience.wordpress.com/2011/10/07/sqlbits-unforgettable/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/10/07/sqlbits-unforgettable/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 22:46:06 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Não categorizado]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/10/07/sqlbits-unforgettable/</guid>
		<description><![CDATA[It&#8217;s been 4 days thinking about what to write. Actually I thought of other words not to be unforgettable, fantastic, amazing.But I was impressed not only the event itself, with the organization and level of the sessions, but for the &#8230; <a href="http://shellyourexperience.wordpress.com/2011/10/07/sqlbits-unforgettable/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=900&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been 4 days thinking about what to write. Actually I thought of other words not to be unforgettable, fantastic, amazing.<br />But I was impressed not only the event itself, with the organization and level of the sessions, but for the people.</p>
<p>My second day in Liverpool I went to Redgate´s HQ. I have the pleasure and the honor to meet my friends Andrew Clarke, Chris Massey, Tony, Annabel, Sarah ..Phil Factor (hahaha I am pretty sure that I know who is him)</p>
<p>Guys, Redgate is a AWESOME Company to work…in fact it is not a company, it is a family .. that was my feeling about.. and in Cambridge…what a beatiful place.</p>
<p>When I come to the Hotel,first SQLBITS Day, Jonathan and Annete Allen was waiting for me and and were my host in the entire event.</p>
<p>Then I meet in PERSON Allen White, Neil Hambly,Kevin Kline, Steve Jones, Aaron Bertrand, Andy Leornard, Tobias,Karla Landrum, Mark Broadbent, Allan Mitchell, Simon Sabin, Chris Testa-O´Neill, James Rowland-Jones, Christian Bolton, Jen Stirrup, Hannah Jeremy and the guys from Redgate Stande. Allen White in his session mentioned me..and I was in there HAAAAAAAAAA !!!!!!</p>
<p>HOLY Mother…and a lot of great guys from the SQLBITS family.</p>
<p>I just can say that this week remained in my memory forever.</p>
<p>Chistian Bolton, Jonathan Allen,&nbsp; Steve Jones and Allen White ..MANY thanks for the kind words about my session. Chistian , no words to thanks what you said to me Man..and coming from you..no words. Jonathan thanks for the kind words as well&nbsp; and laugh at my stupid jokes</p>
<p>Jonathan and Annette. You guys are wonderful. if the world were made by people like you, would be so better. I am and I will be eternally grateful for everything that you did for me. You guys definitely have a big part in my heart…forever.</p>
<p>I do not know if I&#8217;ll be back in the next as speaker, but I was in that and was one of the greatest honors in my career. Thanks for the SQLBITS team for believe in me. In the next I will be there, even as speaker or not. It is a SHOW…literally a SQL Server SHOW !!!!</p>
<p>The trip was tiring, but I will do it again as many times as I can.</p>
<p>Some picts <img style="border-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Alegre" src="http://shellyourexperience.files.wordpress.com/2011/10/wlemoticon-smile.png?w=584"></p>
<p><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0040-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0040-Optimized" border="0" alt="DSCF0040-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0040-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0035-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0035-Optimized" border="0" alt="DSCF0035-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0035-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0047-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0047-Optimized" border="0" alt="DSCF0047-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0047-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0041-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0041-Optimized" border="0" alt="DSCF0041-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0041-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0069-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0069-Optimized" border="0" alt="DSCF0069-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0069-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0071-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0071-Optimized" border="0" alt="DSCF0071-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0071-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0073-optimized-1.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0073-Optimized-1" border="0" alt="DSCF0073-Optimized-1" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0073-optimized-1_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0079-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0079-Optimized" border="0" alt="DSCF0079-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0079-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0083-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0083-Optimized" border="0" alt="DSCF0083-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0083-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0084.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0084" border="0" alt="DSCF0084" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0084_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0085.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0085" border="0" alt="DSCF0085" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0085_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0088.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0088" border="0" alt="DSCF0088" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0088_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0089.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0089" border="0" alt="DSCF0089" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0089_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0094.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0094" border="0" alt="DSCF0094" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0094_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0106.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0106" border="0" alt="DSCF0106" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0106_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0107.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0107" border="0" alt="DSCF0107" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0107_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0111-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0111-Optimized" border="0" alt="DSCF0111-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0111-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0113.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0113" border="0" alt="DSCF0113" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0113_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0116.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0116" border="0" alt="DSCF0116" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0116_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0123-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0123-Optimized" border="0" alt="DSCF0123-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0123-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0125-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0125-Optimized" border="0" alt="DSCF0125-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0125-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0126-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0126-Optimized" border="0" alt="DSCF0126-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0126-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0130-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0130-Optimized" border="0" alt="DSCF0130-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0130-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0129.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0129" border="0" alt="DSCF0129" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0129_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0127-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0127-Optimized" border="0" alt="DSCF0127-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0127-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0253.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0253" border="0" alt="DSCF0253" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0253_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0248-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0248-Optimized" border="0" alt="DSCF0248-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0248-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0246-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0246-Optimized" border="0" alt="DSCF0246-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0246-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0268.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0268" border="0" alt="DSCF0268" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0268_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0144-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0144-Optimized" border="0" alt="DSCF0144-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0144-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a></p>
<p><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0154-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="DSCF0154-Optimized" border="0" alt="DSCF0154-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0154-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5850.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5850" border="0" alt="IMG_5850" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5850_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5847-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5847-Optimized" border="0" alt="IMG_5847-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5847-optimized_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5844.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5844" border="0" alt="IMG_5844" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5844_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5854-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5854-Optimized" border="0" alt="IMG_5854-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5854-optimized_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5860.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5860" border="0" alt="IMG_5860" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5860_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/img_5862-optimized.jpg"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="IMG_5862-Optimized" border="0" alt="IMG_5862-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/img_5862-optimized_thumb.jpg?w=244&#038;h=164" width="244" height="164"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0105.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="DSCF0105" border="0" alt="DSCF0105" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0105_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0133.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="DSCF0133" border="0" alt="DSCF0133" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0133_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a><a href="http://shellyourexperience.files.wordpress.com/2011/10/dscf0132-optimized.jpg"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="DSCF0132-Optimized" border="0" alt="DSCF0132-Optimized" src="http://shellyourexperience.files.wordpress.com/2011/10/dscf0132-optimized_thumb.jpg?w=244&#038;h=184" width="244" height="184"></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/900/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/900/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/900/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=900&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/10/07/sqlbits-unforgettable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/wlemoticon-smile.png" medium="image">
			<media:title type="html">Alegre</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0040-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0040-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0035-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0035-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0047-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0047-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0041-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0041-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0069-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0069-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0071-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0071-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0073-optimized-1_thumb.jpg" medium="image">
			<media:title type="html">DSCF0073-Optimized-1</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0079-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0079-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0083-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0083-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0084_thumb.jpg" medium="image">
			<media:title type="html">DSCF0084</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0085_thumb.jpg" medium="image">
			<media:title type="html">DSCF0085</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0088_thumb.jpg" medium="image">
			<media:title type="html">DSCF0088</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0089_thumb.jpg" medium="image">
			<media:title type="html">DSCF0089</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0094_thumb.jpg" medium="image">
			<media:title type="html">DSCF0094</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0106_thumb.jpg" medium="image">
			<media:title type="html">DSCF0106</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0107_thumb.jpg" medium="image">
			<media:title type="html">DSCF0107</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0111-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0111-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0113_thumb.jpg" medium="image">
			<media:title type="html">DSCF0113</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0116_thumb.jpg" medium="image">
			<media:title type="html">DSCF0116</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0123-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0123-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0125-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0125-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0126-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0126-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0130-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0130-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0129_thumb.jpg" medium="image">
			<media:title type="html">DSCF0129</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0127-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0127-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0253_thumb.jpg" medium="image">
			<media:title type="html">DSCF0253</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0248-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0248-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0246-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0246-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0268_thumb.jpg" medium="image">
			<media:title type="html">DSCF0268</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0144-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0144-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0154-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0154-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5850_thumb.jpg" medium="image">
			<media:title type="html">IMG_5850</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5847-optimized_thumb.jpg" medium="image">
			<media:title type="html">IMG_5847-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5844_thumb.jpg" medium="image">
			<media:title type="html">IMG_5844</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5854-optimized_thumb.jpg" medium="image">
			<media:title type="html">IMG_5854-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5860_thumb.jpg" medium="image">
			<media:title type="html">IMG_5860</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/img_5862-optimized_thumb.jpg" medium="image">
			<media:title type="html">IMG_5862-Optimized</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0105_thumb.jpg" medium="image">
			<media:title type="html">DSCF0105</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0133_thumb.jpg" medium="image">
			<media:title type="html">DSCF0133</media:title>
		</media:content>

		<media:content url="http://shellyourexperience.files.wordpress.com/2011/10/dscf0132-optimized_thumb.jpg" medium="image">
			<media:title type="html">DSCF0132-Optimized</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating your Monitoring Server With PowerShell and WMI/Server Events</title>
		<link>http://shellyourexperience.wordpress.com/2011/09/23/creating-your-monitoring-server-with-powershell-and-wmiserver-events/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/09/23/creating-your-monitoring-server-with-powershell-and-wmiserver-events/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 00:31:40 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/09/23/creating-your-monitoring-server-with-powershell-and-wmiserver-events/</guid>
		<description><![CDATA[Well guys, this is my next S-T Article and now it is in the magic hands of Super Chris Massey to review (soon will be published) . As I did a link to a video in the article, if you &#8230; <a href="http://shellyourexperience.wordpress.com/2011/09/23/creating-your-monitoring-server-with-powershell-and-wmiserver-events/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=821&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well guys, this is my next S-T Article and now it is in the magic hands of Super Chris Massey to review (soon will be published) .</p>
<p>As I did a link to a video in the article, if you want, you can watch it. </p>
<p>In this Article I will cover how to setup a monitoring server using temporary event consumers and permanent event consumers (using <a href="http://trevorsullivan.net/">Trevor´s</a> <a href="http://powerevents.codeplex.com/">PowerEvents Module</a>). </p>
<p>I will show a solution using temporary event consumers in my session in <strong>SQLBITS</strong> as well.</p>
<p>I beleive you will understand the idea. (or at least enjoy the good music)</p>
<p><a href="http://www.videolog.tv/laertesqldba/videos/702077">Watch the video.</a></p>
<p><strong>#PowerShellLIfeStyle</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/821/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/821/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/821/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=821&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/09/23/creating-your-monitoring-server-with-powershell-and-wmiserver-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>PowerShell and SQL Server Events&#8211;Changes in Database Options</title>
		<link>http://shellyourexperience.wordpress.com/2011/09/15/powershell-and-sql-server-eventschange-in-database-options/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/09/15/powershell-and-sql-server-eventschange-in-database-options/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 22:32:49 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL SERVER EM GERAL]]></category>
		<category><![CDATA[Virtual Pass BR]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/09/15/powershell-and-sql-server-eventschange-in-database-options/</guid>
		<description><![CDATA[Today&#160; my good friend Marcos Freecia (@sqlfreccia)&#160; asked if there is some way to be notified if a database is taking off line. I did not found any event to do this (if someone knows please tell me), BUUUUT every &#8230; <a href="http://shellyourexperience.wordpress.com/2011/09/15/powershell-and-sql-server-eventschange-in-database-options/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=809&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today&nbsp; my good friend Marcos Freecia (@sqlfreccia)&nbsp; asked if there is some way to be notified if a database is taking off line.</p>
<p>I did not found any event to do this (if someone knows please tell me), BUUUUT every changes in the database options is logged in the SQL Server ERRORLOG and there is an event fired to a <a href="//MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/b0153a31-5794-410b-8816-d9f1290a5b36.htm">ERRORLOG</a>.</p>
<p>Then was just find what error id is for the database options (5084) &#8211; <a href="http://msdn.microsoft.com/en-us/library/cc645602.aspx">Errors 5000 – 5999</a> and register the event :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"> </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">$query = <span style="color:#006080;">"select * from  ERRORLOG where Error = 5084"</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">Register-WMIEvent     -SourceIdentifier <span style="color:#006080;">"ErrorLogevent"</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    -Namespace <span style="color:#006080;">'root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    -Query $query `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    -Action {    ipmo functions;    </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                Send-SMTPmail     -smtpserver <span style="color:#006080;">'smtp.mail.yahoo.com.br'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                -from <span style="color:#006080;">'juniorlaerte@yahoo.com.br'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                -to <span style="color:#006080;">'laertejuniordba@hotmail.com'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                -subject <span style="color:#006080;">'Event Notification - Database Options'</span> `</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                -body     <span style="color:#006080;">"ApplicationName  : $($Event.SourceEventArgs.NewEvent.ApplicationName) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         Error            : $($Event.SourceEventArgs.NewEvent.Error) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         ServerName       : $($Event.SourceEventArgs.NewEvent.ServerName) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         SessionLoginName : $($Event.SourceEventArgs.NewEvent.SessionLoginName) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         SPID             : $($Event.SourceEventArgs.NewEvent.SPID) `n</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         SQLInstance      : $($Event.SourceEventArgs.NewEvent.SQLInstance) `n </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         Message          : $($Event.SourceEventArgs.NewEvent.textdata)</pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                         StartTime           : $([Management.ManagementDateTimeConverter]::ToDateTime($Event.SourceEventArgs.NewEvent.StartTime))"</span></pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"> </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                                                        </pre>
<p><!--CRLF-->
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            }</pre>
<p><!--CRLF--></div>
</div>
<p>Notice that now I&#8217;m specifying the event identifier (<strong>SourceIndentifier</strong> parameter)&nbsp; to unregister </p>
<p>Now, every change in the databases will be triggered when logged in the SQL Server ERRORLOG.</p>
<p>But what if I want every time that my server are restarted, this event is registered :</p>
<p>Thers is some ways. You can do it in by SQL Server Alerts, but you will depend the SQL Agent to send an email.</p>
<p>You can use the awesome project from Trevor Sullivan (@pcgeek85) </p>
<p><a href="http://powerevents.codeplex.com/">PowerEvents for Windows PowerShell</a></p>
<blockquote>
<h6>What is PowerEvents?</h6>
<p>PowerEvents is a Windows PowerShell v2.0 module designed to facilitate the ease of creating, updating, and deleting WMI (<i>Windows Management Instrumentation</i>) permanent event registrations. PowerEvents makes it easy to create WMI event filters (define the events you want to capture) and event consumers (responders to events), and then bind them together to initiate the flow of events. By leveraging permanent event registrations, you can perform advanced monitoring functions on a workstation or server, that would otherwise require implementation of an enterprise monitoring product. Because WMI is incredibly vast in the information it provides, very detailed monitoring can be performed using almost any of the WMI objects that exist on a computer. </p>
<h6>What are WMI Permanent Event Registrations?</h6>
<p>A little-known capability of the WMI service, is its capability to create a permanent registration (listener) for events, and then automatically respond to those events. At a very basic level, it&#8217;s &#8220;if X happens, do Y&#8221; but in this case, it&#8217;s all built into WMI, <i><b>without the need for any additional software</b></i>.</p>
</blockquote>
<p>In other words, you will switch from temporary consumers to a permanent consumer.</p>
<p>Or you can create a .ps1 with this script, put into a .bat file and excute using :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">powershell.exe -noexit -windowstyle hidden  -command <span style="color:#006080;">"c:\temp\errorlogevent.ps1"</span></pre>
<p><!--CRLF--></div>
</div>
<p>And use the noexit and windowstyle to hidden <a href="http://technet.microsoft.com/en-us/library/dd315276.aspx">PowerShell.exe Console Help</a></p>
<p>Then, you can put into your server startup options.</p>
<p>and to unregister your event :</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">Unregister-Event ErrorLogevent   </pre>
<p><!--CRLF--></div>
</div>
<p>where ErrorEventLog is the name that I put in parameter SourceIdentifier in the Register-WMIEvent</p>
<p><a href="http://www.videolog.tv/laertesqldba/videos/699333">Watch the video</a></p>
<p>The register-wmievent run a job in another runspace, then to find bugs in the code is a bit complicated. In my <a href="http://sqlbits.com/">SQLBITS</a> session&nbsp; I will show how to use the variable $Event and how to solve these bugs.</p>
<p>See you in Liverpool guys, do not miss my session, I am sure that you&#8217;ll like it</p>
<p><strong>#PowerShellLifeStyle</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/809/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/809/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/809/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=809&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/09/15/powershell-and-sql-server-eventschange-in-database-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
		<item>
		<title>SAFEPEAK &#8211; SQL Server Performance Contest 2011</title>
		<link>http://shellyourexperience.wordpress.com/2011/09/14/safepeak-sql-server-performance-contest-2011/</link>
		<comments>http://shellyourexperience.wordpress.com/2011/09/14/safepeak-sql-server-performance-contest-2011/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 20:37:16 +0000</pubDate>
		<dc:creator>Laerte Junior</dc:creator>
				<category><![CDATA[Não categorizado]]></category>

		<guid isPermaLink="false">https://shellyourexperience.wordpress.com/2011/09/14/safepeak-sql-server-performance-contest-2011/</guid>
		<description><![CDATA[Hey, do you want to win a IPAD2 and even better, tell your SQL Server Performance Story ? Just submit your success case on SAFEPEAK Website,&#160; and&#160; finger crossed. Our good friend Robert Pearl&#160; is the Contest Supervisor and it &#8230; <a href="http://shellyourexperience.wordpress.com/2011/09/14/safepeak-sql-server-performance-contest-2011/">Continue lendo <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=804&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hey, do you want to win a IPAD2 and even better, tell your SQL Server Performance Story ?</p>
<p>Just submit your success case on <a href="http://www.safepeak.com/SQL-Performance-Contest-2011/?source=PearlKnowledge">SAFEPEAK</a> Website,&nbsp; and&nbsp; finger crossed.</p>
<p>Our good friend<strong> Robert Pearl</strong>&nbsp; is the Contest Supervisor and it is a great oportunity to share (or even $hell) your experience with the SQL Server community.</p>
<p>I alread sent my story.. and you&nbsp; ?. Just click in the link below and ..luckly be happy&nbsp; </p>
<p>Go.Go.Run Forrest Run !!!!!</p>
<p><a href="http://www.safepeak.com/SQL-Performance-Contest-2011/?source=PearlKnowledge">SAFEPEAK SQL Server Performance Contest 2011</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/shellyourexperience.wordpress.com/804/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/shellyourexperience.wordpress.com/804/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/shellyourexperience.wordpress.com/804/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=shellyourexperience.wordpress.com&amp;blog=16548779&amp;post=804&amp;subd=shellyourexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://shellyourexperience.wordpress.com/2011/09/14/safepeak-sql-server-performance-contest-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5483112b15869d414d613e6b6148b9f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">laertejuniordba</media:title>
		</media:content>
	</item>
	</channel>
</rss>
