<?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/"
	>

<channel>
	<title>youdidwhatwithtsql.com &#187; Bash</title>
	<atom:link href="http://www.youdidwhatwithtsql.com/tag/bash/feed" rel="self" type="application/rss+xml" />
	<link>http://www.youdidwhatwithtsql.com</link>
	<description>making DBAs everywhere curse!</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:21:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Backing up the structure of MySQL databases</title>
		<link>http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063</link>
		<comments>http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063#comments</comments>
		<pubDate>Tue, 25 Jan 2011 21:00:20 +0000</pubDate>
		<dc:creator>Rhys</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063</guid>
		<description><![CDATA[Today I wanted a quick and easy way to generate a backup of the structure of all MySQL databases in one easy hit. Here&#8217;s a couple of ways you can do this with the tools you&#8217;re likely to find everywhere. Firstly, we can use the following query to generate a list of mysqldump commands. The [...]<p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063">Backing up the structure of MySQL databases</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Today I wanted a quick and easy way to generate a backup of the structure of all MySQL databases in one easy hit. Here&#8217;s a couple of ways you can do this with the tools you&#8217;re likely to find everywhere.</p>
<p>Firstly, we can use the following query to generate a list of <a title="mysqldump database backup program" href="http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html" target="_blank">mysqldump</a> commands. The backups generated here pretty much just contain tables, triggers and functions so customise the command to your needs. Just change the output directory from .<strong>/home/rhys</strong>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1063code4'); return false;">View Code</a> MYSQL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10634"><td class="code" id="p1063code4"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #000099;">CONCAT</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'mysqldump -d --routines -h mysql<span style="color: #008080; font-weight: bold;">_</span>host -u username -pSecret '</span><span style="color: #000033;">,</span> SCHEMA_NAME<span style="color: #000033;">,</span> <span style="color: #008000;">' &gt; &quot;/home/rhys/Desktop/'</span><span style="color: #000033;">,</span> SCHEMA_NAME<span style="color: #000033;">,</span> <span style="color: #008000;">'.sql&quot;'</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">FROM</span> INFORMATION_SCHEMA.SCHEMATA
<span style="color: #990099; font-weight: bold;">WHERE</span> SCHEMA_NAME <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #990099; font-weight: bold;">IN</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">'mysql'</span><span style="color: #000033;">,</span> <span style="color: #008000;">'information<span style="color: #008080; font-weight: bold;">_</span>schema'</span><span style="color: #000033;">,</span> <span style="color: #008000;">'performance<span style="color: #008080; font-weight: bold;">_</span>schema'</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>These commands can be copied and then pasted into a terminal to be executed.</p>
<p>Here&#8217;s a pure bash way of achieving the same thing. The script is called on the command line with the MySQL host, user name and password supplied as parameters. Backups are generated in the current users home directory in the format <strong>db_name.sql</strong>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1063code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10635"><td class="code" id="p1063code5"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># MySQL details passed on command line</span>
<span style="color: #007800;">HOST</span>=<span style="color: #007800;">$1</span>
<span style="color: #007800;">USER</span>=<span style="color: #007800;">$2</span>;
<span style="color: #007800;">PWD</span>=<span style="color: #007800;">$3</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># Query to get database excluding a few system ones</span>
<span style="color: #007800;">QUERY</span>=<span style="color: #ff0000;">&quot;SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mysql','information_schema','performance_schema')&quot;</span>;
<span style="color: #666666; font-style: italic;"># Run the query and get the results</span>
<span style="color: #007800;">results</span>=<span style="color: #000000; font-weight: bold;">`</span>mysql <span style="color: #660033;">-h</span> <span style="color: #007800;">$HOST</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span> -p<span style="color: #007800;">$PWD</span> <span style="color: #660033;">-N</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$QUERY</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># Loop through each row</span>
<span style="color: #000000; font-weight: bold;">for</span> db <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$results</span>
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #007800;">bkp</span>=<span style="color: #ff0000;">&quot;mysqldump -d --routines -h <span style="color: #007800;">$HOST</span> -u <span style="color: #007800;">$USER</span> -p<span style="color: #007800;">$PWD</span> <span style="color: #007800;">$db</span> &gt; '<span style="color: #007800;">$HOME</span>/<span style="color: #007800;">$db</span>.sql'&quot;</span>;
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backing up <span style="color: #007800;">$db</span>...&quot;</span>;
	<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">$bkp</span>;
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>Save this to a file called <strong>backup_mysql.sh</strong> and don;t forget to do a <strong>chmod + x</strong> to make the script executable. The backup can be executed from the command line with;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1063code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10636"><td class="code" id="p1063code6"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>backup_mysql.sh localhost username password</pre></td></tr></table></div>

<p><a href="http://www.youdidwhatwithtsql.com/wp-content/uploads/2011/8f94a578fd9d_11B87/mysqldump_backup_databases.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mysqldump backup databases" border="0" alt="mysqldump backup databases thumb Backing up the structure of MySQL databases" src="http://www.youdidwhatwithtsql.com/wp-content/uploads/2011/8f94a578fd9d_11B87/mysqldump_backup_databases_thumb.png" width="644" height="429" /></a></p>
<p><map name='google_ad_map_1063_a45beff5d2e172f6'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/1063?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_1063_a45beff5d2e172f6' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=1063&amp;url=http%3A%2F%2Fwww.youdidwhatwithtsql.com%2Fbacking-up-the-structure-of-mysql-databases%2F1063' title="Backing up the structure of MySQL databases" alt=" Backing up the structure of MySQL databases" /></p><p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063">Backing up the structure of MySQL databases</a></p>
<div class="none"><div class="g-plusone" data-href="http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.youdidwhatwithtsql.com/backing-up-the-structure-of-mysql-databases/1063/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse MySQL Slow Logs with mysqlsla</title>
		<link>http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856</link>
		<comments>http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856#comments</comments>
		<pubDate>Tue, 10 Aug 2010 19:36:21 +0000</pubDate>
		<dc:creator>Rhys</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856</guid>
		<description><![CDATA[Here&#8217;s a bash script that you can use to parse multiple MySQL Slow Query Log files, in one sweep, into something much more understandable. The script uses the handy utility mysqlsla so make sure this is in your path.&#160; mysqlsla parses, filters, analyzes and sorts MySQL slow, general, binary and microslow patched logs in order [...]<p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856">Parse MySQL Slow Logs with mysqlsla</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a bash script that you can use to parse multiple <a title="MySQL Slow Query Logs" href="http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html" target="_blank">MySQL Slow Query Log</a> files, in one sweep, into something much more understandable. The script uses the handy utility <a href="http://hackmysql.com/mysqlsla" target="_blank">mysqlsla</a> so make sure this is in your path.&nbsp;<br />
<blockquote>mysqlsla parses, filters, analyzes and sorts MySQL <a href="http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html">slow</a>, <a href="http://dev.mysql.com/doc/refman/5.0/en/query-log.html">general</a>, <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-log.html">binary</a> and <a href="http://www.mysqlperformanceblog.com/2008/04/20/updated-msl-microslow-patch-installation-walk-through/">microslow patched</a> logs in order to create a customizable report of the queries and their meta-property values. Since these reports are customizable, they can be used for human consumption or be fed into other scripts to further analyze the queries. For example, to profile with <a href="http://maatkit.sourceforge.net/doc/mk-query-profiler.html">mk-query-profiler</a> (a script from Baron Schwartz&#8217;s <a href="http://www.maatkit.org/">Maatkit</a>) every unique SELECT statement using database foo from a slow log: <a title="mysqlsla" href="http://hackmysql.com/mysqlsla" target="_blank">source</a></p></blockquote>
<p>Place all your slow logs into a directory. Change the <strong>sl_dir</strong> variable to point at this directory.<strong> </strong>When you execute the script it will create a directory, within your slow logs directory, called reports. This will contain the reports produced by <a title="mysqlsla" href="http://hackmysql.com/mysqlsla" target="_blank">mysqlsla</a>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p856code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p8568"><td class="code" id="p856code8"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Script to process multiple mysql slow logs</span>
<span style="color: #666666; font-style: italic;"># using mysqlsla http://hackmysql.com/mysqlsla</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Directory containing slow logs</span>
<span style="color: #007800;">sl_dir</span>=<span style="color: #ff0000;">&quot;/home/rhys/Desktop/slow_logs&quot;</span>;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$sl_dir</span>&quot;</span>;
<span style="color: #666666; font-style: italic;">#slow_logs=$(ls &quot;$sl_dir&quot;);</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Folder for reports</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$sl_dir</span>&quot;</span><span style="color: #000000; font-weight: bold;">/</span>reports <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$sl_dir</span>&quot;</span><span style="color: #000000; font-weight: bold;">/</span>reports;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># process each slow log file</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$sl_dir</span>&quot;</span><span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Processing file: <span style="color: #007800;">$file</span>&quot;</span>;
                <span style="color: #007800;">filename</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
                mysqlsla <span style="color: #660033;">-lt</span> slow <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #ff0000;">&quot;reports/<span style="color: #007800;">$filename</span>.rpt&quot;</span>;
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Finished processing file: <span style="color: #007800;">$file</span>&quot;</span>;
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>The reports produced are much easier to work with than the raw mysql logs so this should be a good time saver when optimising those queries!</p>
<p><map name='google_ad_map_856_a45beff5d2e172f6'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/856?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_856_a45beff5d2e172f6' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=856&amp;url=http%3A%2F%2Fwww.youdidwhatwithtsql.com%2Fparse-mysql-slow-logs-with-mysqlsla%2F856' title="Parse MySQL Slow Logs with mysqlsla" alt=" Parse MySQL Slow Logs with mysqlsla" /></p><p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856">Parse MySQL Slow Logs with mysqlsla</a></p>
<div class="none"><div class="g-plusone" data-href="http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.youdidwhatwithtsql.com/parse-mysql-slow-logs-with-mysqlsla/856/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check disk space with Bash</title>
		<link>http://www.youdidwhatwithtsql.com/check-disk-space-bash/770</link>
		<comments>http://www.youdidwhatwithtsql.com/check-disk-space-bash/770#comments</comments>
		<pubDate>Tue, 18 May 2010 18:34:31 +0000</pubDate>
		<dc:creator>Rhys</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Disk Space]]></category>

		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/?p=770</guid>
		<description><![CDATA[Now I&#8217;m working mainly with Linux and MySQL I&#8217;ve had to learn how to accomplish basic tasks in entirely new ways. As a DBA I like to keep an eye on disk space. I wanted something like my Check disk space with Powershell script, but this only works with Windows, so naturally I turned to [...]<p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/check-disk-space-bash/770">Check disk space with Bash</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Now I&#8217;m working mainly with Linux and MySQL I&#8217;ve had to learn how to accomplish basic tasks in entirely new ways. As a <a title="Database Administrator" href="http://en.wikipedia.org/wiki/Database_administrator" target="_blank">DBA</a> I like to keep an eye on disk space. I wanted something like my <a title="Check disk space with Powershell" href="http://www.youdidwhatwithtsql.com/check-disk-space-with-powershell-2/195" target="_blank">Check disk space with Powershell</a> script, but this only works with Windows, so naturally I turned to <a title="GNU Bash" href="http://www.gnu.org/software/bash/" target="_blank">Bash</a>. Here&#8217;s a very basic solution that will allow you to check the disk space on multiple Linux servers quickly.</p>
<p>Save the script below to your home directory called <strong>chk_dsk_space.sh </strong>and mark this as executable. Open a terminal and enter <strong>./chk_dsk_space.sh</strong>. You will be prompted for the password for each server before it displays disk usage information.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p770code10'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p77010"><td class="code" id="p770code10"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Set computer names here to check</span>
<span style="color: #007800;">computers</span>=<span style="color: #ff0000;">&quot;user@server1 user@server2 user@server3&quot;</span>
<span style="color: #666666; font-style: italic;"># Work through each computer in the array</span>
<span style="color: #000000; font-weight: bold;">for</span> c <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$computers</span>
<span style="color: #000000; font-weight: bold;">do</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=================================================&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;= <span style="color: #007800;">$c</span>&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;=================================================&quot;</span>
                <span style="color: #007800;">command</span>=<span style="color: #ff0000;">&quot;ssh <span style="color: #007800;">$c</span> 'df -h'&quot;</span>
                <span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #007800;">$command</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>Here&#8217;s some sample output.</p>
<pre>rhys@linux-n0sm:~&gt; ./chk_dsk_space.sh
=================================================
= rhys@server1
=================================================
Password:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6             6.7G  4.2G  2.2G  67% /
udev                  1.7G  444K  1.7G   1% /dev
/dev/sda7             8.9G  417M  8.0G   5% /home
/dev/sda2              75G   71G  4.1G  95% /windows/C
/dev/sda3              55G   47G  7.6G  86% /windows/D
=================================================
= user@server2
=================================================
Password:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6             6.7G  4.2G  2.2G  67% /
udev                  1.7G  444K  1.7G   1% /dev
/dev/sda7             8.9G  417M  8.0G   5% /home
/dev/sda2              75G   71G  4.1G  95% /windows/C
/dev/sda3              55G   47G  7.6G  86% /windows/D
=================================================
= user@server3
=================================================
Password:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6             6.7G  4.2G  2.2G  67% /
udev                  1.7G  444K  1.7G   1% /dev
/dev/sda7             8.9G  417M  8.0G   5% /home
/dev/sda2              75G   71G  4.1G  95% /windows/C
/dev/sda3              55G   47G  7.6G  86% /windows/D
</pre>
<p>Not as elegant as my <a title="Check disk space with Powershell" href="http://www.youdidwhatwithtsql.com/check-disk-space-with-powershell-2/195" target="_blank">Powershell script</a> but it&#8217;s functional and saves me a little time each day. I&#8217;m not finding <a title="GNU Bash" href="http://www.gnu.org/software/bash/" target="_blank">Bash</a> as easy to work with as <a title="Powershell" href="http://technet.microsoft.com/en-us/library/bb978526.aspx" target="_blank">Powershell</a> but that&#8217;s probably more due to my lack of experience than anything else. There&#8217;s an <a title="Open Source Powershell" href="http://igorshare.wordpress.com/2008/04/06/pash-cross-platform-powershell-is-out-in-the-wild-announcement/" target="_blank">Open Source implementation of Powershell</a> I&#8217;ve been thinking of checking out, it doesn&#8217;t implement the Windows specific <a title="Powershell cmdlet" href="http://msdn.microsoft.com/en-us/library/ms714395%28VS.85%29.aspx" target="_blank">cmdlets</a>, but it&#8217;s been good to look at another way of doing things with <a title="GNU Bash" href="http://www.gnu.org/software/bash/" target="_blank">Bash</a>.</p>
<p><map name='google_ad_map_770_a45beff5d2e172f6'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/770?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_770_a45beff5d2e172f6' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=770&amp;url=http%3A%2F%2Fwww.youdidwhatwithtsql.com%2Fcheck-disk-space-bash%2F770' title="Check disk space with Bash" alt=" Check disk space with Bash" /></p><p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/check-disk-space-bash/770">Check disk space with Bash</a></p>
<div class="none"><div class="g-plusone" data-href="http://www.youdidwhatwithtsql.com/check-disk-space-bash/770" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.youdidwhatwithtsql.com/check-disk-space-bash/770/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Nuggets</title>
		<link>http://www.youdidwhatwithtsql.com/powershell-nuggets/72</link>
		<comments>http://www.youdidwhatwithtsql.com/powershell-nuggets/72#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:48:56 +0000</pubDate>
		<dc:creator>Rhys</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Powershell Scripting]]></category>
		<category><![CDATA[Server Management]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.youdidwhatwithtsql.com/powershell-nuggets/72</guid>
		<description><![CDATA[Here are a few Powershell nuggets for beginners to digest. First thing that might trip you up is the Execution Policy built into Powershell. I’ve turned this off on my development machine but it’s obviously advised to have it enabled on production machines. That aside, it’s easy to turn off… If you’re using Vista you [...]<p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/powershell-nuggets/72">Powershell Nuggets</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Here are a few <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank">Powershell</a> nuggets for beginners to digest.</p>
<p>First thing that might trip you up is the <a href="http://myitforum.com/cs2/blogs/dhite/archive/2006/09/08/Configuring-PowerShell-Execution-Policies.aspx" target="_blank">Execution Policy</a> built into <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank">Powershell</a>. I’ve turned this off on my development machine but it’s obviously advised to have it enabled on production machines. That aside, it’s easy to turn off…</p>
<p><a href="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image3.png"><img title="Powershell Execution Policy" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="131" alt="image thumb3 Powershell Nuggets" src="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image-thumb3.png" width="244" border="0" /></a> </p>
<p>If you’re using <a href="http://www.microsoft.com/windows/windows-vista/default.aspx" target="_blank">Vista</a> you may need to run Powershell in <a href="http://support.microsoft.com/kb/922708" target="_blank">Administrator mode</a> to allow the required registry change. To make my environment a little more user friendly I’ve setup a <a href="http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/profile.mspx" target="_blank">Powershell Profile</a> with the following code</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code17'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7217"><td class="code" id="p72code17"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">cd</span> C:\Users\Rhys\Documents\powershell
<span style="color: #0000FF;">function</span> prompt <span style="color: #000000;">&#123;</span><span style="color: #800000;">&quot;PS: $(get-date)&amp;gt;&quot;</span><span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>This changes the current working directory to my scripts folder and keeps the prompt reasonably short. </p>
<p><strong>Write text files with Powershell</strong></p>
<p>Just look how easy it is to write text files in <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank">Powershell</a>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code18'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7218"><td class="code" id="p72code18"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$text</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;abcdefghijklmnopqrstuvwxyz1234567890&quot;</span>
&nbsp;
<span style="color: #008000;"># Method 1: Write file using set-content. </span>
<span style="color: #008000;"># Just pipe the contents of the variable</span>
<span style="color: #800080;">$text</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">set-content</span> <span style="color: #008080; font-style: italic;">-encoding</span> ascii alphabet.txt
&nbsp;
<span style="color: #008000;"># Method 2: Use out-file to append the for loop index to a file</span>
<span style="color: #0000FF;">for</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>; <span style="color: #800080;">$i</span> <span style="color: #FF0000;">-lt</span> <span style="color: #804000;">10</span>; <span style="color: #800080;">$i</span><span style="color: pink;">++</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$i</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> <span style="color: #008080; font-style: italic;">-filePath</span> <span style="color: #800000;">&quot;forLoop.txt&quot;</span> <span style="color: #008080; font-style: italic;">-encoding</span> ascii <span style="color: #008080; font-style: italic;">-append</span> 
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>After executing this you should have 2 new .txt files in your working directory.</p>
<p><strong>List &amp; Count Files by Extension with Powershell</strong></p>
<p>This script will list filenames and their sizes before displaying a total count of those files. Just change the extension in the script if you want to work with different file types.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code19'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7219"><td class="code" id="p72code19"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#####################################################</span>
<span style="color: #008000;"># Filename: DirectoryTextFiles.ps1		    #</span>
<span style="color: #008000;"># Author: Rhys Campbell				    #</span>
<span style="color: #008000;"># Description: Lists all .txt files in the current  #</span>
<span style="color: #008000;"># directory, with their length in bytes, and        #</span>
<span style="color: #008000;"># displays a total count of .txt files.		    #</span>
<span style="color: #008000;"># Date: 2009-04-22				    #</span>
<span style="color: #008000;">#####################################################</span>
&nbsp;
<span style="color: #800080;">$count</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>;
&nbsp;
<span style="color: #800080;">$files</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">dir</span> <span style="color: pink;">*</span>.txt
&nbsp;
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$file</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$files</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800080;">$count</span><span style="color: pink;">++</span>;
	<span style="color: #800080;">$filename</span> <span style="color: pink;">=</span> <span style="color: #800080;">$file</span>.name
	<span style="color: #800080;">$fileLength</span> <span style="color: pink;">=</span> <span style="color: #800080;">$file</span>.Length 
	<span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800000;">&quot;The text file $filename is $fileLength bytes.&quot;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800000;">&quot;====================================================&quot;</span>
<span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800000;">&quot;Total text files in this directory = $count&quot;</span>;</pre></td></tr></table></div>

<p><strong>Get the Twitter Public Timeline with Powershell</strong></p>
<p>One line of code is all is takes with <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank">Powershell</a>!</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code20'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7220"><td class="code" id="p72code20"><pre class="powershell" style="font-family:monospace;"><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span><span style="color: #008080;">xml</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">new-object</span> net.webclient<span style="color: #000000;">&#41;</span>.DownloadString<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;http://twitter.com/statuses/public_timeline.rss&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.rss.channel.item <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">format-table</span> title<span style="color: pink;">,</span>link</pre></td></tr></table></div>

<p><a href="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image4.png"><img title="The Twitter Public Timeline in Powershell" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="110" alt="image thumb4 Powershell Nuggets" src="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image-thumb4.png" width="244" border="0" /></a> </p>
<p><strong>Ping multiple computers with Powershell</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code21'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7221"><td class="code" id="p72code21"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">###############################################</span>
<span style="color: #008000;"># Filename: ComputerPinger.ps1		      #</span>
<span style="color: #008000;"># Author: Rhys Campbell			      #</span>
<span style="color: #008000;"># Description: Pings multiple computers       #</span>
<span style="color: #008000;"># supplied in the $args array.		      #</span>
<span style="color: #008000;"># Date: 2009-04-16			      #</span>
<span style="color: #008000;">###############################################</span>
&nbsp;
<span style="color: #008000;"># Simple ping for each computer</span>
<span style="color: #008000;"># supplied in the $args array</span>
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$computer</span> <span style="color: #0000FF;">in</span> <span style="color: #000080;">$args</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	ping <span style="color: #800080;">$computer</span>;
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Count Databases On Multiple Servers</strong></p>
<p>Those of you that are still with me get to see the exciting stuff. This script will count databases, and see if <a href="http://msdn.microsoft.com/en-us/library/ms189237.aspx" target="_blank">SQLAGENT</a> is running, on multiple servers. Just specify each server on the command line. This script uses Windows authentication so bear this in mind for each of your servers. It’s with examples like this that I hope you start to see the power and possibilities of <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" target="_blank">Powershell</a>.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p72code22'); return false;">View Code</a> POWERSHELL</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7222"><td class="code" id="p72code22"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">################################################################################</span>
<span style="color: #008000;"># Filename: MultiHostDatabaseCount.ps1					       #</span>
<span style="color: #008000;"># Description: 								       #</span>
<span style="color: #008000;"># Author: Rhys Campbell							       #</span>
<span style="color: #008000;"># Date: 2009-04-15							       #</span>
<span style="color: #008000;"># Usage: FullPathToFile\MultiHostDatabaseCount.ps1 server1 server2 server3 etc #</span>
<span style="color: #008000;">################################################################################</span>
&nbsp;
<span style="color: #0000FF;">trap</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #800000;">&quot;Eek! An exception occured.&quot;</span>
	<span style="color: #008080; font-weight: bold;">write-error</span> $<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;TRAPPED: &quot;</span> <span style="color: pink;">+</span> <span style="color: #000080;">$_</span>.Exception.GetType<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.FullName<span style="color: #000000;">&#41;</span>;
	<span style="color: #008080; font-weight: bold;">write-error</span> $<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;TRAPPED: &quot;</span> <span style="color: pink;">+</span> <span style="color: #000080;">$_</span>.Exception.Message<span style="color: #000000;">&#41;</span>; 
	<span style="color: #008000;"># Terminate the script on error</span>
	exit
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;"># Loop through each server name supplied in the $args array</span>
<span style="color: #0000FF;">foreach</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$arg</span> <span style="color: #0000FF;">in</span> <span style="color: #000080;">$args</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #008000;"># Connection string</span>
	<span style="color: #800080;">$connectionString</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Server=$arg;Database=master;Trusted_Connection=True;&quot;</span>
	<span style="color: #008000;"># setup the connection object</span>
	<span style="color: #800080;">$SqlConn</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: #008080; font-style: italic;">-Typename</span> System.Data.SqlClient.SqlConnection
	<span style="color: #800080;">$SqlConn</span>.ConnectionString <span style="color: pink;">=</span> <span style="color: #800080;">$connectionString</span>
	<span style="color: #008000;"># Open the connection</span>
	<span style="color: #800080;">$SqlConn</span>.open<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #800080;">$cmd</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;SELECT COUNT(*) AS cnt FROM sys.databases&quot;</span>;
	<span style="color: #008000;"># Create the sql command object</span>
	<span style="color: #800080;">$SqlCmd</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Data.SqlClient.SqlCommand <span style="color: #800080;">$cmd</span><span style="color: pink;">,</span> <span style="color: #800080;">$SqlConn</span>
	<span style="color: #008000;"># Run the query</span>
	<span style="color: #800080;">$result</span> <span style="color: pink;">=</span> <span style="color: #800080;">$SqlCmd</span>.ExecuteReader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #008000;"># Move pointer to the first row</span>
	<span style="color: #800080;">$result</span>.Read<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">&amp;</span>gt; <span style="color: #800080;">$null</span>
	<span style="color: #008000;"># Get db count</span>
	<span style="color: #800080;">$dbCount</span> <span style="color: pink;">=</span> <span style="color: #800080;">$result</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span>
	<span style="color: #008000;"># Close the connection</span>
	<span style="color: #800080;">$SqlConn</span>.close<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #008000;"># Reopen the connection</span>
	<span style="color: #800080;">$SqlConn</span>.open<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #008000;"># New command to get SQLAGENT state</span>
	<span style="color: #800080;">$cmd</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;xp_servicecontrol 'querystate', 'SQLSERVERAGENT'&quot;</span>
	<span style="color: #008000;"># Create the sql command object</span>
	<span style="color: #800080;">$SqlCmd</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Data.SqlClient.SqlCommand <span style="color: #800080;">$cmd</span><span style="color: pink;">,</span> <span style="color: #800080;">$SqlConn</span>
	<span style="color: #008000;"># Run the query</span>
	<span style="color: #800080;">$result2</span> <span style="color: pink;">=</span> <span style="color: #800080;">$SqlCmd</span>.ExecuteReader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #008000;"># Move pointer to the first row</span>
	<span style="color: #800080;">$result2</span>.Read<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">&amp;</span>gt; <span style="color: #800080;">$null</span>
	<span style="color: #008000;"># Get db count</span>
	<span style="color: #800080;">$SQLAGENT</span> <span style="color: pink;">=</span> <span style="color: #800080;">$result2</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">0</span><span style="color: #000000;">&#93;</span>
	<span style="color: #008000;"># Print out the database count for the host</span>
	<span style="color: #008080; font-weight: bold;">echo</span> <span style="color: #800000;">&quot;$arg hosts $dbCount databases. The SQLAGENT Service is $SQLAGENT&quot;</span>
	<span style="color: #008000;"># Clean up</span>
	<span style="color: #800080;">$SqlConn</span>.close<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p><a href="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image5.png"><img title="SQL DBA Duties with Powershell" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="121" alt="image thumb5 Powershell Nuggets" src="http://www.youdidwhatwithtsql.com/wp-content/uploads/2009/04/image-thumb5.png" width="244" border="0" /></a> </p>
<p>I hope to check out the huge range of <a href="http://www.codeplex.com/site/search?projectSearchText=powershell" target="_blank">Powershell Extensions</a> and <a href="http://www.robvanderwoude.com/powershelltools.php " target="_blank">Tools</a> available to do some really cool things. I’ve had a quick play with <a href="http://www.quest.com/" target="_blank">Quest Software</a>’s <a href="http://www.powergui.org" target="_blank">PowerGUI</a>. This looks pretty good but I try to stay away from fancy tools until I’ve learned the basics of a language well. I’m looking forward to working with <a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx" target="_blank">Powershell scripting</a>. I see some great possibilities for…</p>
<ul>
<li>Multiple SQL Server &amp; MySQL management. Check multiple servers in one script! Check backups, disk space, virtually anything!
<li>Adhoc access to many data sources; including text files, rss feeds, databases, Active Directory.&nbsp;
<li>Producing troubleshooting scripts for less experienced support staff. </li>
</ul>
<p>&nbsp;</p>
</p>
<pre></pre>
<p><map name='google_ad_map_72_a45beff5d2e172f6'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/72?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_72_a45beff5d2e172f6' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=72&amp;url=http%3A%2F%2Fwww.youdidwhatwithtsql.com%2Fpowershell-nuggets%2F72' title="Powershell Nuggets" alt=" Powershell Nuggets" /></p><p>Post from: <a href="http://www.youdidwhatwithtsql.com">youdidwhatwithtsql.com</a><br/><br/><a href="http://www.youdidwhatwithtsql.com/powershell-nuggets/72">Powershell Nuggets</a></p>
<div class="none"><div class="g-plusone" data-href="http://www.youdidwhatwithtsql.com/powershell-nuggets/72" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.youdidwhatwithtsql.com/powershell-nuggets/72/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

