tag:blogger.com,1999:blog-73094009399301299272024-03-13T06:11:17.062+00:00Jonathan Medd's BlogScripting. Powershell, VBScript, Windows, Active Directory & Exchange.VMWare. All that kind of stuff.....Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.comBlogger41125tag:blogger.com,1999:blog-7309400939930129927.post-55499141682419506822009-04-16T22:10:00.003+01:002009-04-16T22:16:36.053+01:00This blog has movedI decided it was about time to smarten up my blog so from now on you should check out <a href="http://jonathanmedd.net">http://jonathanmedd.net</a> . I transferred the feed so anyone subscribed to <a href="http://feeds2.feedburner.com/JonathanMedd">http://feeds2.feedburner.com/JonathanMedd</a> will automatically get the new content.<br /><br />Thanks for staying with me :-)Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-74729350483625558862009-04-07T21:33:00.002+01:002009-04-07T22:02:49.461+01:00Putting Shay's Powershell Registry Functions To UseRecently I needed to check some registry key values on a bunch of servers. There were far too many servers to make this a manual task and in addition if they weren't what I was expecting then I needed to change them.<br /><br />Shay Levy has very helpfully published a <a href="http://blogs.microsoft.co.il/blogs/scriptfanatic/archive/2007/10/30/stand-alone-registry-functions-library.aspx">Stand Alone Registry Functions Library</a> which I made use of. It allows you to query and set registry values for things such as DWords, Strings, Binary Values on remote machines very easily. In my case I was particularly interested in some configuration settings for the ICA protocol, HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\ICA-tcp, all of them DWords.<br /><br />First of all we use Shay's Get-RegDWord function at the top of the script which contains some .NET code to query a remote registry<br /><br /><br /><pre><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 0, 255);">param</span><span style="color: rgb(0, 0, 0);">(<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">object</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$defaultValue</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Your default value</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br />)<br /><br /></span><span style="color: rgb(128, 0, 128);">$hives</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">enum</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">getnames</span><span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryHive</span><span style="color: rgb(0, 0, 0);">])<br /><br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$hives</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-notcontains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">write-error</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Invalid hive value</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br />}<br /></span><span style="color: rgb(128, 0, 128);">$regHive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryHive</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(128, 0, 128);">$regKey</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryKey</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">OpenRemoteBaseKey</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$regHive</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$regKey</span><span style="color: rgb(0, 0, 0);">.OpenSubKey(</span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);">);<br /><br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">!</span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">write-error</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">The specified registry key does not exist.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br />}<br /></span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);">.GetValue(</span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 128);">$defaultValue</span><span style="color: rgb(0, 0, 0);">);<br />} </span></pre>Then we specify the list of servers to query. You could either use something like:<br /><br /><pre><span style="color: rgb(128, 0, 128);">$servers</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-Content</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">servers.txt</span></pre>or in my case they were all virtual servers in VMware so I used a couple of VI Toolkit commands to specify the list<br /><br /><pre><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Connect to Virtual Center</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Connect-VIServer vc<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Get a list of all the powered on APP servers</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$servers</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Get-Folder </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Servers</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> | Get-VM | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Where-Object</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(0, 0, 128);">$_</span><span style="color: rgb(0, 0, 0);">.Powerstate </span><span style="color: rgb(255, 0, 0);">-eq</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">PoweredOn</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">}</span></pre><br />Then we loop through each server, call Shay's Get-RegDWord function for each of the DWords we are interested in and store the results in the $myCOl variable. At the end we export the $myCol variable into a CSV file for handy viewing.<br /><br /><pre><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Create an empty array to store the results in</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> @()<br /><br /></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$servers</span><span style="color: rgb(0, 0, 0);">){<br /><br /> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">LocalMachine</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$keyname</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">System\CurrentControlSet\Control\Terminal Server\WinStations\ICA-tcp</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Find MaxIdleTime</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valuename</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">MaxIdleTime</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MaxIdleTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Find fInheritMaxIdleTime</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">fInheritMaxIdleTime</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$fInheritMaxIdleTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Find MaxDisconnectionTime</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">MaxDisconnectionTime</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Find fInheritMaxDisconnectionTime</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">fInheritMaxDisconnectionTime</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$fInheritMaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Add the results to the $MYInfo variable, then $myCol</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">""</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">select-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">MaxIdleTime</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">fInheritMaxIdleTime</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">MaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">fInheritMaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.Name </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.MaxIdleTime </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MaxIdleTime</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.fInheritMaxIdleTime </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$fInheritMaxIdleTime</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.MaxDisconnectionTime </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.fInheritMaxDisconnectionTime </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$fInheritMaxDisconnectionTime</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"><br /><br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Export the results to a csv file</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Export-Csv</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">citrixservers.csv</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-NoTypeInformation</span></pre><br />Now that we can view the results I was able to see that I needed to set a lot of these values to something new. Using Shay's Set-RegDWord function it is a pretty straightfoward task to extend the above to do that. First of all add the function to the top of the script.<br /><br /><br /><pre><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Set-RegDWord</span><span style="color: rgb(0, 0, 0);">{<br /> </span><span style="color: rgb(0, 0, 255);">param</span><span style="color: rgb(0, 0, 0);">(<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">string</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);">,<br /> [</span><span style="color: rgb(0, 128, 128);">double</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$value</span><span style="color: rgb(0, 0, 0);"> <br /> )<br /><br /> </span><span style="color: rgb(128, 0, 128);">$hives</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">enum</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">getnames</span><span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryHive</span><span style="color: rgb(0, 0, 0);">])<br /><br /> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$hives</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-notcontains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">write-error</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Invalid hive value</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br /> }<br /> </span><span style="color: rgb(128, 0, 128);">$regHive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryHive</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(128, 0, 128);">$regKey</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryKey</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">OpenRemoteBaseKey</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$regHive</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$regKey</span><span style="color: rgb(0, 0, 0);">.OpenSubKey(</span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 255);">$true</span><span style="color: rgb(0, 0, 0);">);<br /><br /> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 0);">!</span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">write-error</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">The specified registry key does not exist.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br /> }<br /> </span><span style="color: rgb(128, 0, 128);">$subKey</span><span style="color: rgb(0, 0, 0);">.SetValue(</span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 128);">$value</span><span style="color: rgb(0, 0, 0);">,[</span><span style="color: rgb(0, 128, 128);">Microsoft.Win32.RegistryValueKind</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">DWord</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 128);">$?</span><span style="color: rgb(0, 0, 0);">) {</span><span style="color: rgb(0, 0, 255);">$true</span><span style="color: rgb(0, 0, 0);">} </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(0, 0, 255);">$false</span><span style="color: rgb(0, 0, 0);">}<br />} </span></pre><br />Then for each of the values you want to change use an if statement to check whether it needs changing and if so call Shay's Set-RegDword to make the necessary changes.<br /><br /><br /><br /><pre><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Find fInheritMaxIdleTime</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">fInheritMaxIdleTime</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$fInheritMaxIdleTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">Get-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> Check the value and change if necessary</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$fInheritMaxIdleTime</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-eq</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">){<br /><br /> </span><span style="color: rgb(128, 0, 128);">$value</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">0</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(95, 158, 160);">Set-RegDWord</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$hive</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$keyName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$valueName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$value</span><span style="color: rgb(0, 0, 0);"><br /><br /> }</span></pre><br />Thanks again to Shay for publishing these functions, it made this particular task very easy to complete and I'm sure I'll be using them again in the future.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com2tag:blogger.com,1999:blog-7309400939930129927.post-57845483685615646762009-03-12T21:44:00.005+00:002009-03-16T12:41:36.904+00:00Get-Scripting Guys Take Over the March UK Powershell User GroupMyself and <a href="http://www.virtu-al.net/">Alan Renouf</a> from the <a href="http://get-scripting.blogspot.com/">Get-Scripting Podcast</a> will be presenting this month at the <a href="http://richardsiddaway.spaces.live.com/blog/cns%2143CFA46A74CF3E96%212100.entry">UK Powershell User Group on Thursday 26th March at Microsoft in Reading</a>.<br /><br />First up on the night will be <a href="http://richardsiddaway.spaces.live.com/default.aspx">Richard Siddaway</a> talking to us about using Regular Expressions in Powershell. This was requested at a previous event and I know that Richard is really looking forward to talking about that subject ;-)<br /><br />Then the Get-Scripting guys will take over:<br /><br />I will be talking about some of the features that are part of Active Directory in Server 2008 R2 , currently in beta, in particular the native AD Powershell cmdlets which will ship as part of that product and what I have learned about them so far.<br /><br /><a href="http://www.vmware.com/communities/vexpert/">vExpert</a> Alan Renouf will then tell us about the VI toolkit, which for those of you not in the know are the cmdlets shipped by VMware to enable you to manage their ESX product.<br /><br />A good mixture I think of general scripting skills, third-party added value to your Powershell learning and future technologies.<br /><br />If you can't make the event in person then as usual it will be broadcast by LiveMeeting (details <a href="http://richardsiddaway.spaces.live.com/Blog/cns%2143CFA46A74CF3E96%212157.entry">here</a>). It wouldn't be a UK Powershell event if the LiveMeeting part doesn't go 100% to plan, but we will endeavour to ensure we avoid the usual trick of the microphone going on mute.<br /><br />If you wish to attend the event in person you should contact Richard via his <a href="http://richardsiddaway.spaces.live.com/default.aspx">blog</a> so that he can have a badge for you at the welcome desk. If the prospect of us presenting isn't enough to attract you then as always there will be pizza at half-time :-)Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-8414490134046937762009-03-10T22:17:00.003+00:002009-03-10T22:44:52.811+00:00Today's UK VMware User GroupToday's UK VMware User Group was a great community content event. Of course there was a sponsor presentation (Veeam) without whom these type of events can't be put on, but there were also a lot of contributions from people in the group.<br /><br />We had:<br /><br />1) <a href="http://www.veeam.com/">Veeam</a> talking about their reporting and backup products.<br /><br />2) Mike Laverick from <a href="http://www.rtfm-ed.co.uk/">RTFM education</a> talking about <a href="http://www.vmware.com/products/srm/">Site Recovery Manager</a> and not the VMware view of it, rather real world struggles - warts and all as he put it. Its great to see this kind of content because you get to find out how these products really function in reality. He also gave away a few copies of his <a href="http://www.rtfm-ed.co.uk/?p=1038">book</a> on Site Recovery Manager which I'm sure is a must read for this topic.<br /><br />3) <a href="http://get-scripting.blogspot.com">Get-Scripting's</a> very own vExpert <a href="http://www.virtu-al.net/">Alan Renouf</a> gave us a debrief from VMworld Europe in Cannes. By the sounds of it a great event, but possibly could be extended to include an extra day and maybe needs a bigger venue given the issues some people had getting into sessions.<br /><br />4) A presentation from another community member about technology futures, 'the cloud', advances in mobile devices, stuff like that, and how they may affect the corporate world. This is now the second event I have been to which has talked about employee owned IT, i.e. you turn up to a job with your own laptop and corporate IT supply you either with a VM to run corporate applications or all delivered through a browser. The demand coming from cool, young, hip people (like me :-) ) who won't stand for the constraints of a corporate environment.<br /><br />"Why can't I run facebook / second life / quake / twitter on my macbook / ipod/ pink netbook and just run your apps on the same machine too?"<br /><br />5) Steve Bruck and Alan Renouf (again) with an update about the recently released <a href="http://blogs.vmware.com/vipowershell/">VI toolkit</a> V1.5 . Some good examples, also lots of interest in <a href="http://www.virtu-al.net/2009/02/23/vi-toolkit-quick-reference-guide/">Alan's getting started guide</a>.<br /><br />6) Finally finished off with more community content, this time about the upcoming <a href="http://vmblog.com/archive/2009/02/24/vmware-signs-oem-agreement-with-neverfail-to-protect-vcenter-heartbeat-solution.aspx">vCenter Heartbeat</a> product.<br /><br /><br />It was great to see slightly more audience participation than normal this time, which I think might have come from the slightly smaller room and more, but shorter sessions. I really enjoyed it anyway.<br /><br />If you want to hear REAL people talking about how they really use VMware based products then this is the event for you.<br /><br />Next one 14th May! <a href="http://communities.vmware.com/community/vmug/emea/london">More details can be found here.<br /></a>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-4690918551889118702009-03-04T22:39:00.002+00:002009-03-04T23:03:47.055+00:00Counting the Number of Sessions Per Citrix ServerWhilst monitoring some newly provisioned Citrix servers running on VMware hosts today, I soon became very bored with manually checking how many sessions were on each Citrix VM as the load on each one increased, whilst trying to get it to the optimum level.<br /><br />I knew it was possible to use Powershell to connect with Citrix servers, but had never really looked into it before. Not surprisingly it turned out to be very straightforward.<br /><br />By using some technology known as <a href="http://community.citrix.com/blogs/citrite/vishalg/2008/05/01/The+ultimate+guide+to+Citrix+MFCOM+SDK">MFCom</a> we can connect with the Citrix farm and get some cool information out.<br /><br />In the below example we create a new com object using MFCom, then initialise the connection. We are then able to access some methods and properties of that object. In this case we are looking at the Sessions property, we group all of the results by ServerName and then produce some output with the name and number of sessions on that Citrix box.<br /><br /><pre><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">New-Object</span><span style="color: rgb(0, 0, 0);"> -com </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">MetaframeCOM.MetaframeFarm</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);">.Initialize(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);">.Sessions </span><span style="color: rgb(0, 0, 0);">| </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Group-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">ServerName</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Sort-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">name</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Format-Table</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">Count</span><span style="color: rgb(0, 0, 0);"> -auto</span></pre>which will give you something like:<br /><br />Name Count<br /><br />CitrixServer01 38<br />CitrixServer02 45<br />CitrixServer03 41<br /><br />This would return all of the servers in the farm. In this particular instance I only wanted a particular selection of servers, so I stored them in a text file, got PS to read that file and then filter the query by only looking at servers in that list.<br /><br /><pre><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$servers</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-Content</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">c:\scripts\servers.txt</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">New-Object</span><span style="color: rgb(0, 0, 0);"> -com </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">MetaframeCOM.MetaframeFarm</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);">.Initialize(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(128, 0, 128);">$farm</span><span style="color: rgb(0, 0, 0);">.sessions | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Where-Object</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(128, 0, 128);">$servers</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-contains</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 128);">$_</span><span style="color: rgb(0, 0, 0);">.ServerName} | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Group-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">ServerName</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Sort-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">name</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Format-Table</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">Count</span><span style="color: rgb(0, 0, 0);"> -auto</span></pre><br />Once again Powershell very easily gets rid of a really dull manual task.<br /><br />If you wish to take this a step further check out Powershell MVP Brandon Shell's blog where he has loads of Powershell / Citrix examples.<br /><br /><a href="http://bsonposh.com/archives/tag/citrix">http://bsonposh.com/archives/tag/citrix</a>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com2tag:blogger.com,1999:blog-7309400939930129927.post-5975092995903737592009-02-22T15:02:00.002+00:002009-02-22T15:07:17.271+00:00UK Active Directory User Group - 6pm GMT Wednesday 11th MarchThis is the second meeting of the newly formed UK Active Directory User Group:<br /><br /><span style="font-family: Calibri; color: black; font-size: 14pt;">The second [ADUG] UK Active Directory User Group meeting will be on the <strong>evening </strong>of the <strong>11th March</strong> at Microsoft's <st1:city>London</st1:city> (<st1:state><st1:place><em>Victoria</em></st1:place></st1:state>) Offices. The meeting will co-hosted with the Windows Server User Group.</span><br /><br />The draft agenda is:<br /><ul><li>18:00 for 18:25 Arrival and registration </li><li>18:25-18:30 Welcome and introductions </li><li>18:30-19:45 James O'Neill takes a quick tour through the new features in Windows Server 2008 R2 (just to whet your appetite). </li><li>19:45-20:00 Refreshments </li><li>20:00-21:15 Amish Lukka (also from Microsoft) will be presenting an insight into new Active Directory features in Windows Server 2008 R2. </li><li>21:15-21:30 Wrap-up. </li><li>21:20 Adjourn to a nearby public house where Mark Parris will be happy to share his experiences of the Microsoft Certified Masters: Windows Server 2008: Directory class that he attended last November. </li></ul><br /><p class="MsoNormal" style="margin: 0cm 30pt 0pt;"><span style="font-family: Calibri; color: black; font-size: 14pt;">If you are interested in attending - please send an email to <a href="mailto:registration@adug.co.uk"><strong>registration@adug.co.uk</strong></a> with your name and see you there. The confirmed times will be in the confirmation email.</span></p> <p class="MsoNormal" style="margin: 0cm 30pt 0pt;"><span style="font-family: Calibri; color: black; font-size: 14pt;"></span></p> <p class="MsoNormal" style="margin: 0cm 30pt 0pt;"><span style="font-family: Calibri; color: black; font-size: 14pt;"><br />For those who can’t make it in person, we will set up a Live Meeting session (which will be recorded) and details will be made available closer to the event.</span></p>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-31066392072588998652009-02-22T14:56:00.002+00:002009-02-22T15:01:38.743+00:00UK London VMware User Group Meeting, Tuesday 10th March 2009These are great events if you are able to get to them (unfortunately no webcast for this one):<br /><br />The Steering Committee are pleased to announce the next UK London VMware User<br />Group meeting, <b>now kindly sponsored by <a class="jive-link-external" href="http://www.veeam.com/">Veeam</a> Software</b>, to be held<br />on Tuesday 10th March 2009. We hope to see you at the meeting, and<br />afterwards for a drink or two.<br /><br />Our meeting will be held at the Thames Suite, London Chamber of Commerce and<br />Industry, 33 Queen Street, London EC4R 1AP, +44 (0)20 7248 4444. The nearest<br />tube station is Mansion House, location information is available <a class="jive-link-external" href="http://maps.google.co.uk/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=EC4R+1AP&ie=UTF8&z=16&iwloc=addr&om=1">here</a>.<br /><br />PLEASE NOTE: As well as the date changing from the previously-published one, the day<br />has also changed to Tuesday, and we're in a different part of the venue<br />from normal (out of the lift, turn right). Rest assured, the usual UG<br />staples of great content and me banging on about Powershell will be<br />present and correct.<br /><br />Reception is from 1230 for a prompt 1pm start, to finish around 5pm. Our agenda<br />for is not final at the moment, but looks something like this:<br /><br />12:30 – 13:00 Arrive & Refreshments<br />13:00 – 13:15 Welcome & News<br />13:20 – 14:05 Sponsor Presentation - TBA<br />14:10 – 14:55 Presentation on real world Site Recovery Manager experience<br />15:00 – 15:20 Refreshments Break<br />15:25 – 16:00 Committee-moderated, user-generated content and discussion (some good stuff being lined up here)<br />16:05 – 16:45 VMworld Cannes debrief<br />16:45 – 17:00 Close<br />17:00 – Pub<br /><br />Please feel free to contribute to the 'UG content ideas' forum thread running <a class="jive-link-thread" href="http://communities.vmware.com/thread/163372">here</a>. We won't be able<br />to incorporate all of the ideas for this coming meeting, but will do our best<br />to include some of them.<br /><br />To register your interest in attending, please reply with up to two named<br />attendees from your organisation to alaricdavies at yahoo dot com. If you do not receive a confirmation mail<br />from us, please don't just turn up since we will not be able to admit you to<br />the meeting. Content from the meetings will continue to be uploaded to <a class="jive-link-external" href="http://public.box.net/londonug">http://public.box.net/londonug</a>,<br />NDA permitting.<br /><br />Sincerely, and with regards,<br /><br />The UKLVMUG Steering CommitteeJonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-81673140021836244602009-02-22T14:53:00.003+00:002009-02-22T15:03:51.973+00:00UK Powershell User Group Live Meeting - 7pm GMT on Thursday February 26th 2009Don't forget <span style=";font-family:Times New Roman;font-size:100%;" >7pm GMT on Thursday February 26th sees <a href="http://twitter.com/PS_Rolf">Rolf Masuch</a> presenting a Live Meeting to the UK PowerShell User group. Rolf runs the German PowerShell User Group. </span><p> </p><span style=";font-family:Times New Roman;font-size:100%;" >Session abstract: </span><p> </p><ul><li><span style=";font-family:Times New Roman;font-size:100%;" >PowerShell as Active Directory Login Script </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Loginscript, why? </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >The Script </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Draft in the form editor </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Start with PowerGUI Editor </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >The script skeleton </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >The script details </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Get in running </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Output of information </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Formatting of the information </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Putting the script on the server </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >The path on the domain controller </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Setting the users login script </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Running .ps1-files as login scripts </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Running loginscripts visible </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Possible errors</span></li></ul> <p><span style=";font-family:Times New Roman;font-size:100%;" ><strong>Live Meeting Details:</strong></span> </p><p><span style=";font-family:Times New Roman;font-size:100%;" >You are invited to attend an online meeting using Live Meeting.<br /><b><a href="https://www.livemeeting.com/cc/usergroups/join?id=2C4W7Q&role=attend&pw=FbH%263S%5C%26C">Join the meeting.</a></b><br /><b>Audio Information</b><br /><b>Computer Audio</b><br />To use computer audio, you need speakers and microphone, or a headset.<br /><b>First Time Users:</b><br />To save time before the meeting, </span><a href="http://go.microsoft.com/fwlink/?LinkId=90703"><span style=";font-family:Times New Roman;font-size:100%;" >check your system </span></a><span style=";font-family:Times New Roman;font-size:100%;" >to make sure it is ready to use Microsoft Office Live Meeting.<br /><b>Troubleshooting</b><br />Unable to join the meeting? Follow these steps: </span> </p><ol><li><span style=";font-family:Times New Roman;font-size:100%;" >Copy this address and paste it into your web browser:<br />https://www.livemeeting.com/cc/usergroups/join </span> </li><li><span style=";font-family:Times New Roman;font-size:100%;" >Copy and paste the required information:<br />Meeting ID: 2C4W7Q<br />Entry Code: FbH&3S\&C<br />Location: https://www.livemeeting.com/cc/usergroups </span></li></ol> <p><span style=";font-family:Times New Roman;font-size:100%;" >If you still cannot enter the meeting, </span><a href="http://r.office.microsoft.com/r/rlidLiveMeeting?p1=12&p2=en_US&p3=LMInfo&p4=support"><span style=";font-family:Times New Roman;font-size:100%;" >contact support</span></a> </p><p><span style="font-size:100%;"><span style="font-family:Times New Roman;"><b>Notice</b><br />Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting. </span></span> </p>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-17852350214856215162009-02-21T12:34:00.002+00:002009-02-21T12:37:57.416+00:00Slides from MMMUG presentationAs promised to those who attended the <a href="http://www.mmmug.co.uk/">MMMUG</a> on Wednesday night my slides from that evening are available on my <a href="http://cid-bad8363d570d175b.skydrive.live.com/browse.aspx/.Public">SkyDrive</a>.<br /><br />Enjoy.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-59221919462747033572009-02-15T21:53:00.002+00:002009-02-15T22:12:25.775+00:00The Noble Array?At last week's UK Powershell Usergroup <a href="http://jonoble.spaces.live.com/default.aspx">Jonathan Noble</a> was showing us some Powershell examples and at one point demonstrated something similar to the below.<br /><br />Essentially you create an empty array, but then somewhat surprisingly (well to me anyway) you can select some elements even though they don't exist! You are then able to add to the array using the names you have selected.<br /><br /><span style="color: rgb(0, 0, 255);"></span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">""</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">select-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">CPUUsage</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">Owner</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">ProcessID</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.Name </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.name<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.ProcessID </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.IdProcess<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.CPUUsage </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Math</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">Round</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$proc_perct</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.Owner </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$process</span><span style="color: rgb(0, 0, 0);">.GetOwner().user<br /> </span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"></span><br /><br /><br />My friend and colleague <a href="http://teckinfo.blogspot.com/">Alan Renouf</a> had given me the above example a week or so previously to use in a script. I was puzzled to how it worked since I hadn't seen it used in any of the Powershell books I have read or other sources I use and neither had he, so when I saw Jonathan using it I was curious to find out more.<br /><br />Jonathan explains in more detail how this works on his <a href="http://jonoble.spaces.live.com/blog/cns%21CC73D8744F0894A5%21525.entry">blog</a> in a posting he made last year.<br /><br />OK, it doesn't really matter if it wasn't him who come up with the original idea, but heh that's how I'm going to remember it. :-)Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-44341700416127364822009-02-12T22:42:00.002+00:002009-02-12T23:01:35.397+00:00Geek Rhyming SlangThis started (for me anyway) when my wife told people I was away at Geek Week, i.e. Teched EMEA and I had for a long time described my (or lack of as others might say) own fashion style as Geek Chic. Anyway after the legends of the <a href="http://www.channel4.com/programmes/the-it-crowd">IT Crowd</a> used my Geek Chic phrase (OK, I'm claiming it) multiple times during one of their recent shows I decided to try and find some more and here's the results. Special thanks to @Jaykul, @Poshoholic and @ebgreen for the contributions.<br /><br />Translations added for any non-Geek Speak(ers)<br /><br />Geek Week - an IT conference like Teched, VMworld<br /><br />Geek Chic - fashion style (or lack of, can be either) displayed by an IT pro<br /><br />Geek Speak - jargon filled conversation<br /><br />Geek Freak - a person who (pretends to be?) hot for geeks<br /><br />Geek Bleak - how geeks normally decorate<br /><br />Geek Cheek - when IT thinks management can't touch them<br /><br />Geek Antique - a TRS-80, Amiga, or C-64<br /><br />Geek Boutique - Fry's, Best Buy, Future Shop<br /><br />Geek Physique - Wii Sports/Fitness<br /><br />Geek Tweak - a bug fix<br /><br />Geek Shriek - the sound of a wedgie<br /><br />Geek Clique - a huddle of geeks<br /><br />Geek Peak'd - completing a IT project<br /><br />Geek Mystique - this aura surrounds you when you do "exactly what I did" for a coworker, but it works for you on the first try<br /><br />Geek Critique - ripping each other apart bassed on minutiae and technycalities and misspellings<br /><br />Geek Oblique - our version of subtle -- when you have to explain the joke, in case people don't know what oblique means<br /><br />Geek Technique - This is how we (over) do it<br /><br />I'm on a Geek Streak........Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-33435026579811953472009-02-02T21:32:00.002+00:002009-02-02T21:48:07.203+00:00Upcoming for the UK Powershell User GroupComing up in February are two events for the UK Powershell User Group.<br /><br />1) Following the <a href="http://technet.microsoft.com/en-gb/bb945096.aspx">Technet Event</a> Managing Windows Servers with Powershell V2 on Feb 10th at Microsoft London there will be a <a href="http://richardsiddaway.spaces.live.com/blog/cns%2143CFA46A74CF3E96%212032.entry">Powershell UserGroup meeting</a>.<br /><br />My good friend <a href="http://jonoble.spaces.live.com/">Jonathan Noble</a> will be travelling down all the way from the North of England to present for us about using Powershell to automate tasks in the large University environment he works in - well worth turning up for. Let <a href="http://richardsiddaway.spaces.live.com/blog/cns%2143CFA46A74CF3E96%212032.entry">Richard Siddaway know</a> if you wish to attend.<br /><br />Sometime between the afternoon Technet Event and the evening User Group I shall be interviewing Jonathan for the <a href="http://get-scripting.blogspot.com/">Get-Scripting Podcast</a>.<br /><br />2) February 26th Rolf Mausch, who runs the German Powershell User Group, will be presenting a live webcast for us about using Powershell in login scripts - an interesting topic since not a lot of people are doing that yet from what I have seen. <a href="http://richardsiddaway.spaces.live.com/blog/cns%2143CFA46A74CF3E96%212032.entry">Early details here</a>.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-24782739903043309192009-02-02T21:13:00.003+00:002009-02-02T21:29:07.389+00:00Windows 2003 Password Policy - Complexity Requirements MessageDoing a lot of investigation into password policies available in Windows Server 2003 and 2008 at the minute, plus some of the third-party solutions available around this area.<br /><br />One of the reasons I've never myself recommend using the 'Complexity On' feature in Windows Server is the sheer difficulty in trying to explain to users that you need to use characters from at least three of the following four groups:<br /><br /><ul><li>Uppercase</li><li>Lowercase</li><li>Digits</li><li>Special Characters<br /></li></ul><br />They typically switch off as soon as you get to the ...at least three.... part of the above sentence and to be honest I don't really blame them.<br /><br />Even if you do head down this solution (good luck to you!) the message a user gets back when they fail to change their password successfully is fairly generic and does not even mention the fact that complexity is in use.<br /><br />However, today I was made aware of a <a href="http://support.microsoft.com/kb/821425">hotfix for Windows 2003</a> (and associated clients) where the user will now see mention of complexity requirements in the message they receive back. Since I've never heard or seen anyone else using this before I thought it was worth mentioning since it might make your deployment a bit smoother.<br /><br />I've yet to test this out myself, but I guess you gotta trust the KB article ;-)Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-22849096693776652322009-01-28T22:25:00.002+00:002009-01-28T22:42:08.380+00:00Using Powershell to Find Free Space in Exchange 2003 databasesOne regular task for Exchange admins can be reclaiming free space within Exchange mailbox stores either after a large amount of data has been removed or just a significant amount has built up over time for various reasons. For those of you who don't know, to reclaim the space the mailbox store has to be taken offline and the database defragged to get the space back on the disk.<br /><br />Finding good candidates for defragging especially in a large environment with multiple databases and Exchange servers can be a pretty tedious task. Exchange records an entry in the Application Event Log (Event ID 1221) after online maintenance has taken place which tells you how much free space is in the database - this means trawling through the event logs on each server and recording which databases you think are worth defragging. So naturally I wrote a Powershell script to save wasting time on this task!<br /><br />Using WMI the script queries the Application log on each of the Exchange servers you choose, looking for 1221 events in the last day. It sucks out the name of the mailbox store and the amount of free space in the database from the message field of the event and if the free space is greater than a particular figure (in the example below 3GB) adds the info to a csv file.<br /><br />You could obviously change the figure to meet your needs and also if you remove the if statement you could get it to report on every database so you have a report of free space across all databases.<br /><br />Tip: If you have clustered mailbox servers then you only need to point the script at one of the servers in the cluster since it will contain all of the event log entries for each server in the cluster.<br /><br /><br /><br /><br /><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Check to see if csv exists and if so remove it</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 255);">If</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(95, 158, 160); font-weight: bold;">Test-Path</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">FreeSpaceGreaterThan1GB.csv</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br />{<br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">Remove-Item</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">FreeSpaceGreaterThan1GB.csv</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br />}<br /></span><span style="color: rgb(0, 0, 255);">Else</span><span style="color: rgb(0, 0, 0);"><br />{<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Set the columns for the csv file</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$rows</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Servername,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Mailbox Store,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Free Space (MB),</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">Add-Content</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">FreeSpaceGreaterThan1GB.csv</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$rows</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(128, 0, 128);">$ExchServer</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">server1</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">server2</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$Server</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$ExchServer</span><span style="color: rgb(0, 0, 0);">){<br /> <br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Get the time 1 day ago in the right format for WMI query</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$WmidtQueryDT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">System.Management.ManagementDateTimeConverter</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">ToDmtfDateTime</span><span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 128, 128);">DateTime</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">Now</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(139, 69, 19);">AddDays</span><span style="color: rgb(0, 0, 0);">(-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">))<br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Perform WMI query of Event 1221 in Application log in the last day</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$1221</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-WmiObject</span><span style="color: rgb(0, 0, 0);"> -computer </span><span style="color: rgb(128, 0, 128);">$ExchServer</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-query</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Select * from Win32_NTLogEvent Where Logfile='Application' and Eventcode = '1221' and TimeWritten >='</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$WmidtQueryDT</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br /><br /> </span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$1221</span><span style="color: rgb(0, 0, 0);">){<br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Get the name of the Mailbox Store</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MBXStoreLocationStart</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.IndexOf(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Storage Group</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">16</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MBXStoreLocationFinish</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.IndexOf(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">has</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(255, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MBXStoreLocation</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.SubString(</span><span style="color: rgb(128, 0, 128);">$MBXStoreLocationStart</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 128);">$MBXStoreLocationFinish</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MBXStoreLocationStart</span><span style="color: rgb(0, 0, 0);">)<br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Get the free space figure and convert it to an integer</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MBLocationStart</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.IndexOf(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">has</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MBLocationFinish</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.IndexOf(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">megabytes</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(255, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MBLocation</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.Message.SubString(</span><span style="color: rgb(128, 0, 128);">$MBLocationStart</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 128);">$MBLocationFinish</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MBLocationStart</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(128, 0, 128);">$result</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">int</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$MBLocation</span><span style="color: rgb(0, 0, 0);"><br /><br /> </span><span style="color: rgb(128, 0, 128);">$ComputerName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$event</span><span style="color: rgb(0, 0, 0);">.ComputerName<br /><br /><br /> </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">If free space > 3GB, add the details to the csv file</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$result</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-ge</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3072</span><span style="color: rgb(0, 0, 0);">){<br /><br /> </span><span style="color: rgb(128, 0, 128);">$rowline</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">$ComputerName,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">$MBXStoreLocation,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">$MBLocation,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Add-Content</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">FreeSpaceGreaterThan1GB.csv</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$rowline</span><span style="color: rgb(0, 0, 0);"><br /> }<br /> </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br /> {<br /> }<br /><br /> }<br />}</span>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com1tag:blogger.com,1999:blog-7309400939930129927.post-5964769959242438012009-01-25T21:36:00.010+00:002009-03-16T13:28:23.257+00:00Using Powershell to Monitor VMware Guests - on a Budget......i.e. a budget of £0.<br /><br />(Update 28/01/09 - FYI..got some feedback about this post and the reason we are not using the built in alerts in the VI client is because the CPU alerts in this case were not granular enough for us.)<br /><br />So this all stemmed from trying to track down which process was causing particular servers' CPU to hit 100% for a period. So first of all my colleague and Get-Scripting co-host <a href="http://teckinfo.blogspot.com/">Alan Renouf</a> traded a script back and forth which ended up as the CheckHighCPU function - it is now pretty cool and comes back with a list of processes sorted by how much CPU they are using and very importantly for our circumstance who is the owner of each process.<br /><br />The servers in question all belong to a particular cluster in ESX. Rather than constantly having to monitor the console, wait for a VM to turn red and then run the script to track down the process we decided to try and monitor them with a Powershell script, kick off the CheckHighCPU function when a server's CPU hit 100% for a significant enough period and email a warning through with the process details - and so the below script was born.<br /><br />OK, its not Operations Manager and to be honest its not really production quality, but it does the job we need it to.<br /><br />The <a href="http://blogs.vmware.com/vipowershell/">VI Toolkit</a> from VMware is a great set of cmdlets you can plug into your Powershell console to manage your VMware environment. You can use the Get-Cluster and Get-VM cmdlets to return a list of all the VM's in that cluster as objects. You can then use the very handy Get-Stat cmdlet to retrieve performance data for each VM.<br /><br />In this case we check the cpu.usage.average statistic of a period of the last few minutes (watch out for the -IntervalMins parameter it can produce a period slightly different to what you would expect) and if its over 99% run the CheckHighCPU function and send the results by email.<br /><br />We then make the script sleep for a short time period so that we are not constantly bombarded with alerts if a warning is triggered.<br /><br />Obviously if we wanted to make it production quality we would add in some error checking and testing to see if an alert had recently been sent, but for the time being its doing a great job for the requirements that exist.<br /><br />You could obviously re-use the below to monitor for different statistics offered by Get-Stat like disk or memory.<br /><br /><br /><br /><span style="color: rgb(0, 0, 255);">Function</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">EmailWarning</span><span style="color: rgb(0, 0, 0);"> ()<br />{</span><span style="color: rgb(0, 0, 255);">param</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$ServerName</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 128);">$Attachment</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Email warning</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Write-Output</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Creating E-Mail Structure</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(128, 0, 128);">$smtpServer</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">servername</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">new-object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Net.Mail.MailMessage</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$att</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">new-object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Net.Mail.Attachment</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$attachment</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(128, 0, 128);">$smtp</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">new-object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Net.Mail.SmtpClient</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$smtpServer</span><span style="color: rgb(0, 0, 0);">)<br /><br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">.From </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">sender</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">.To.Add(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">recipient</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">.Subject </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Server Warning - High CPU on $Servername</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">.Body </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">$Servername has a CPU value of $HighCPU %</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">.Attachments.Add(</span><span style="color: rgb(128, 0, 128);">$att</span><span style="color: rgb(0, 0, 0);">)<br /><br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">Write-Output</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Send E-Mail</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$smtp</span><span style="color: rgb(0, 0, 0);">.Send(</span><span style="color: rgb(128, 0, 128);">$msg</span><span style="color: rgb(0, 0, 0);">)<br /><br /></span><span style="color: rgb(128, 0, 128);">$att</span><span style="color: rgb(0, 0, 0);">.Dispose();<br /><br />}<br /><br /></span><span style="color: rgb(0, 0, 255);">Function</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160);">CheckHighCPU</span><span style="color: rgb(0, 0, 0);"> ()<br />{</span><span style="color: rgb(0, 0, 255);">param</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$Target</span><span style="color: rgb(0, 0, 0);">)<br /><br /></span><span style="color: rgb(128, 0, 128);">$procs_total</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-WmiObject</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Class</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Win32_PerfRawData_PerfProc_Process</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Filter</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">name="_total"</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ComputerName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$Target</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$procs</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-WmiObject</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Class</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Win32_PerfRawData_PerfProc_Process</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Filter</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">name<>"_total"</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ComputerName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$Target</span><span style="color: rgb(0, 0, 0);"><br /><br />[</span><span style="color: rgb(0, 128, 128);">int64</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(128, 0, 128);">$totalpercentuser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$procs_total</span><span style="color: rgb(0, 0, 0);">)<br />{</span><span style="color: rgb(128, 0, 128);">$totalpercentuser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$totalpercentuser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.PercentUserTime}<br /><br />[</span><span style="color: rgb(0, 128, 128);">decimal</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(128, 0, 128);">$perc</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">System.Convert</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">ToDecimal</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$totalpercentuser</span><span style="color: rgb(0, 0, 0);">)<br /><br /></span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> @()<br /></span><span style="color: rgb(0, 0, 255);">Foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$procs</span><span style="color: rgb(0, 0, 0);">){<br /></span><span style="color: rgb(128, 0, 128);">$proc_perct</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> ((</span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.PercentUserTime </span><span style="color: rgb(255, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$perc</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(255, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$proc_perct</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">-gt</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(128, 0, 128);">$Process</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-WmiObject</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">win32_process</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ComputerName</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$target</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(0, 0, 128);">$_</span><span style="color: rgb(0, 0, 0);">.ProcessID </span><span style="color: rgb(255, 0, 0);">-eq</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.IDProcess}<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">""</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">select-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">CPUUsage</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">Owner</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">ProcessID</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.Name </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.name<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.ProcessID </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$proc</span><span style="color: rgb(0, 0, 0);">.IdProcess<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.CPUUsage </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> [</span><span style="color: rgb(0, 128, 128);">Math</span><span style="color: rgb(0, 0, 0);">]::</span><span style="color: rgb(139, 69, 19);">Round</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$proc_perct</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);">.Owner </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$process</span><span style="color: rgb(0, 0, 0);">.GetOwner().user<br /> </span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$MYInfo</span><span style="color: rgb(0, 0, 0);"><br />}<br />}<br /><br /></span><span style="color: rgb(128, 0, 128);">$myCol</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Sort-Object</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">CPUUsage</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Descending</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Out-File</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$file</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(95, 158, 160);">EmailWarning</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$VMname</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$file</span><span style="color: rgb(0, 0, 0);"><br />}<br /><br />Connect-VIServer <span style="font-style: italic;">servername</span><br /></span><span style="color: rgb(128, 0, 128);">$vms</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-Cluster</span><span style="color: rgb(0, 0, 0);"> <span style="font-style: italic;">clustername</span></span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">get-vm</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$time</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-Date</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);"> {<br /><br /></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$vm</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$vms</span><span style="color: rgb(0, 0, 0);">){<br /><br /></span><span style="color: rgb(128, 0, 128);">$VMname</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$vm</span><span style="color: rgb(0, 0, 0);">.name<br /></span><span style="color: rgb(128, 0, 128);">$filename</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$VMname</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">.txt</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$file</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">C:\Scripts\$filename</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$stats</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-Stat</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-entity</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$vm</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-IntervalMins</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-stat</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">cpu.usage.average</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-MaxSamples</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">write-host</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$VMname</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(128, 0, 128);">$stats</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$stats</span><span style="color: rgb(0, 0, 0);">.value </span><span style="color: rgb(255, 0, 0);">-ge</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">99</span><span style="color: rgb(0, 0, 0);">){<br /></span><span style="color: rgb(128, 0, 128);">$HighCPU</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$stats</span><span style="color: rgb(0, 0, 0);">.value<br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">Write-Host</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Warning!</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ForegroundColor</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">red</span><span style="color: rgb(0, 0, 0);"><br />CheckHighCPU </span><span style="color: rgb(128, 0, 128);">$VMname</span><span style="color: rgb(0, 0, 0);"><br />}<br /><br /></span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br />{<br />}<br />}<br /><br /></span><span style="color: rgb(95, 158, 160); font-weight: bold;">Start-Sleep</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-Seconds</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">30</span><span style="color: rgb(0, 0, 0);"><br />}<br /><br /></span><span style="color: rgb(0, 0, 255);">until</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(128, 0, 128);">$time</span><span style="color: rgb(0, 0, 0);">.hour </span><span style="color: rgb(255, 0, 0);">-ge</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">17</span><span style="color: rgb(0, 0, 0);">)<br /></span>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com8tag:blogger.com,1999:blog-7309400939930129927.post-73043945678527169922009-01-25T21:28:00.002+00:002009-01-25T21:33:31.751+00:00Presenting at MM&M User Group UK - Wednesday 18th FebruarySo I was lucky enough to receive an invite from Nathan Winters who runs the MM&M User Group UK (aka Exchange) to present at their next meeting on Wednesday 18th February at Microsoft in London.<br /><br />It will be an evening around using Powershell to manage Exchange, the agenda is as below:<br /><br /><p class="MsoNormal"><span>18:15 - 18:40 Arrival</span><br /></p> <p class="MsoNormal"><span>18:40 - 18:45 Introduction to speakers and the aims of the group</span><br /></p> <p class="MsoNormal"><span>18:45 - 19:30 1st session; Jonathan Medd, Introduction to PowerShell and Using PowerShell to manage Exchange 2003!</span><br /></p> <p class="MsoNormal"><span>19:30 - 19:50 Food!</span><br /></p> <p class="MsoNormal"><span>19:50 - 20:45 2<sup>nd</sup> session; Will Rawlings, Causing no harm with PowerShell, and using PowerShell on a large Exchange environment</span><br /></p> <p class="MsoNormal"><span>20:45 - 21:00 Summing up and suggestions for future meetings.</span><br /></p> <span>21:00 The End!</span><br /><br /><br />If you want to attend you can sign up here <a href="http://www.mmmug.co.uk/forums/thread/26352.aspx">http://www.mmmug.co.uk/forums/thread/26352.aspx </a>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-87639667567858850062009-01-13T21:26:00.002+00:002009-01-13T22:22:54.621+00:00UK Powershell User Group - January MeetingThe January meeting of the UK <span class="blsp-spelling-error" id="SPELLING_ERROR_0">Powershell</span> User Group takes place Wednesday 21st Jan 2009 6.30pm GMT.<br /><br /><span id="ctl00_MainContentPlaceholder_ctl01_ctl00_lblEntry"><p>Memphis Room</p><p>Building 3 </p><p>Microsoft Campus <span class="blsp-spelling-error" id="SPELLING_ERROR_1">TVP</span> </p><p>Reading UK </p><p>We have a Live Meeting with Jeffrey <span class="blsp-spelling-error" id="SPELLING_ERROR_2">Snover</span> talking about <span class="blsp-spelling-error" id="SPELLING_ERROR_3">PowerShell</span> v2 </p><p>Pizza break </p><p>Then Jeremy Pack from HP will then be doing a <span class="blsp-spelling-error" id="SPELLING_ERROR_4">PowerShell</span> demo - exact topic to be confirmed<br /></p></span><br />It should be a great evening. Jeffrey is obviously the man to ask if you have any burning questions about <span class="blsp-spelling-error" id="SPELLING_ERROR_5">Powershell</span>, particularly V2 for this event. Jeremy is a long time member of the user group and is incredibly knowledgeable about <span class="blsp-spelling-error" id="SPELLING_ERROR_6">Powershell</span> so I'm really looking forward to seeing what he is going to talk about.<br /><br />If you want to turn up please contact Richard Siddaway at the below website, you can also find details of the webcast if you wish to watch from afar.<br /><br /><a href="http://richardsiddaway.spaces.live.com/blog/cns%2143CFA46A74CF3E96%211987.entry">http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1987.entry</a>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-80559694351937917742009-01-11T16:37:00.002+00:002009-01-11T22:13:26.299+00:00Modifying AD accounts with Powershell after an Exchange 2003 dial-tone restore<span style="font-family:arial;">Recently I've been testing out some different disaster recovery scenarios for Exchange 2003, one of which involved a </span><a style="font-family: arial;" href="http://www.msexchange.org/tutorials/Exchange-Dial-tone-Restore-Method-Part1.html">dial-tone method</a><span style="font-family:arial;"> - i.e. create some new mailbox servers with blank databases to get users up and running quickly and then merge the restored data back in later. One of the types of dial tone method we used was to create new server names rather than re-use existing Exchange server names.<br /><br />So for example to re-create a four node (3 active, 1 passive) cluster with new names, instead of<br /><br />ExchangeServer1<br /></span><span style="font-family:arial;">Exchange</span><span style="font-family:arial;">Server2<br /></span><span style="font-family:arial;">Exchange</span><span style="font-family:arial;">Server3<br /><br />you would now use something like<br /><br /></span><span style="font-family:arial;">ExchangeServer1New<br /></span><span style="font-family:arial;">ExchangeServer2New<br /></span><span style="font-family:arial;">ExchangeServer3New</span><br /><br />Then you would need to amend the AD user accounts for users on those Exchange Servers to point to the new locations - the following properties need to be changed.<br /><br />homemdb<br />msexchhomeservername<br />homemta<br /><br />None of these properties can be changed through ADUC, you would need to use ADSIEdit if you wanted to use a GUI. Of course those smart people among you would choose to user Powershell anyway.<br /><br />So naturally I turned to my trusty friend the <a href="http://www.quest.com/activeroles-server/arms.aspx">Quest AD cmdlets</a> to help me out.<br /><br />First of all we get all the users who have a mailbox based on one of the original servers; depending on your naming convention you may need to adjust this filter to make sure you are matching the correct people. The three properties mentioned are not returned by default from Get-QADUser so we have to specify them.<br /><br />We then loop through each user and using the Switch statement if we match ExchangeServer1, 2 or 3 we amend the text of each variable to be the new Exchange servername (note: homemta will be the same for all of these users) and then user the Set-QADUser cmdlet to change these properties on the account.<br /><br /><pre><span style="color: rgb(128, 0, 128);">$users</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ldapFilter</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">(msExchHomeServerName=*ExchangeServer*)</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-IncludedProperties</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">homemdb</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">msexchhomeservername</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">homemta</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-sizelimit</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$users</span><span style="color: rgb(0, 0, 0);">){<br /><br /></span><span style="color: rgb(128, 0, 128);">$homemdb</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);">.homemdb<br /></span><span style="color: rgb(128, 0, 128);">$msexchhomeservername</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);">.msexchhomeservername<br /></span><span style="color: rgb(128, 0, 128);">$newhomemta</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">CN=Microsoft MTA,CN=ExchangeServer1New,CN=Servers,CN=Exchange,CN=Administrative Groups,CN=Springfield,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=springfield,DC=local</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);"> -wildcard (</span><span style="color: rgb(128, 0, 128);">$homemdb</span><span style="color: rgb(0, 0, 0);">)<br /><br />{<br /></span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">*ExchangeServer1*</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$homemdb</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer1</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer1New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$msexchhomeservername</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer1</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer1New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Set-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-objectAttributes</span><span style="color: rgb(0, 0, 0);"> @{homemdb</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);">;msexchhomeservername</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);">;homemta</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemta</span><span style="color: rgb(0, 0, 0);">}; </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">*ExchangeServer2*</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$homemdb</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer2</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer2New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$msexchhomeservername</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer2</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer2New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Set-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-objectAttributes</span><span style="color: rgb(0, 0, 0);"> @{homemdb</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);">;msexchhomeservername</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);">;homemta</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemta</span><span style="color: rgb(0, 0, 0);">}; </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">*ExchangeServer3*</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$homemdb</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer3</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer3New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$msexchhomeservername</span><span style="color: rgb(0, 0, 0);">.replace(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer3</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ExchangeServer3New</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">); </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Set-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$user</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-objectAttributes</span><span style="color: rgb(0, 0, 0);"> @{homemdb</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemdblocation</span><span style="color: rgb(0, 0, 0);">;msexchhomeservername</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newmsexchhomeservername</span><span style="color: rgb(0, 0, 0);">;homemta</span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(128, 0, 128);">$newhomemta</span><span style="color: rgb(0, 0, 0);">}; </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 0, 255);">default</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Nothing for this user</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">}<br />}<br /><br /><br />}</span></pre><br />I was also interested to see the resulting performance of this script and was pleasantly surprised to see it change 6000+ accounts in only 10 mins.<br /><br />A sidenote to this method is that you won't actually see the mailboxes appear in Exchange System Manager until either they receive an email or a user logs on to them. To prove that this method had worked I created a quick Distribution Group, used the below one-liner to populate it with all of the above users and then sent an email to this group.<br /><br /><pre><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ldapFilter</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">(msExchHomeServerName=*ExchangeServer*)</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-sizelimit</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Add-QADGroupMember</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">TestGroup</span></pre><br /><br />There are of course many different ways to carry out Exchange DR, but this proved a useful exercise.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-71013550152140792112009-01-06T22:21:00.004+00:002009-01-06T23:16:27.108+00:00Powershell Active Directory One-LinersRecently I<a href="http://jonathanmedd.blogspot.com/2008/12/take-your-own-advice-jonathan.html"> blogged about some scripts</a> I left behind in my previous employment for managing AD - really a lot of them were just quick one liners. Not that that is necessarily a bad thing, one of the best things for me about Powershell is the way you can get great information with very little effort. Of course I am using my good friend the <a href="http://www.quest.com/activeroles-server/arms.aspx">Quest AD cmdlets</a>.<br /><br />I thought I'd share a few of them:<br /><br /><span style="font-weight: bold;">Find Expired Users:</span><br /><br />On the theme of cleaning out AD, find user accounts which have expired.<br /><br /><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-searchroot</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);"><span style="font-style: italic;">domain</span>.local/resources/users</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-SizeLimit</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-ldapFilter</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">(pwdlastset=0)</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">ft</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">name</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">passwordlastset</span><br /><br /><br /><span style="font-weight: bold;">Find Users Not Logged in Since X Days:</span><br /><br />On the same theme, supply X 'how many days to go back' and find users who haven't logged in during that time. (OK I cheated on the one line a bit on this one)<br /><br /><span style="color: rgb(128, 0, 128);">$now</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(95, 158, 160); font-weight: bold;">get-date</span><span style="color: rgb(0, 0, 0);">; </span><span style="color: rgb(128, 0, 128);">$daysSinceLastLogon</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(255, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> X; </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-sizeLimit</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-SearchRoot</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);"><span style="font-style: italic;">domain</span>.local/resources</span><span style="color: rgb(128, 0, 0);">/users</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(0, 0, 255);">where</span><span style="color: rgb(0, 0, 0);"> {</span><span style="color: rgb(0, 0, 128);">$_</span><span style="color: rgb(0, 0, 0);">.lastlogontimestamp.value </span><span style="color: rgb(255, 0, 0);">-and</span><span style="color: rgb(0, 0, 0);"> ((</span><span style="color: rgb(128, 0, 128);">$now</span><span style="color: rgb(255, 0, 0);">-</span><span style="color: rgb(0, 0, 128);">$_</span><span style="color: rgb(0, 0, 0);">.lastlogontimestamp.value).days </span><span style="color: rgb(255, 0, 0);">-gt</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$daysSinceLastLogon</span><span style="color: rgb(0, 0, 0);">)} | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">ft</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">name</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">lastlogontimestamp</span><br /><br />Note: X needs to be more than 14 days to allow for the lastlogontimestamp attribute to have replicated.<br /><br /><span style="font-weight: bold;"><br />Find Users Whose Password is set to Not Expire:</span><br /><br />Keep tabs on those naughty administrators who think they can exempt themselves from the corporate password policy - you know who you are!<br /><br /><span style="color: #5F9EA0; font-weight: bold;">Get-QADUser</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-Sizelimit</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-SearchRoot</span><span style="color: #000000;"> </span><span style="color: #800000;">'</span><span style="color: #800000;">domain.local/resources/users</span><span style="color: #800000;">'</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-PasswordNeverExpires</span><span style="color: #000000;"> </span><span style="color: #0000FF;">$True</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">ft</span><span style="color: #000000;"> </span><span style="color: #800000;">name</span><br /><br /><span style="font-weight: bold;"><br />How Many Users in Active Directory?</span><br /><br />Need to keep track on an expanding user population? Need to figure out how many CAL's you need? Easy.<br /><br /><span style="color: rgb(95, 158, 160); font-weight: bold;">Get-QADUser</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-DontUseDefaultIncludedProperties</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-SearchRoot</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);"><span style="font-style: italic;">domain</span>.local/resources</span><span style="color: rgb(128, 0, 0);">/users</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(95, 158, 160); font-style: italic;">-SizeLimit</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> | </span><span style="color: rgb(95, 158, 160); font-weight: bold;">Measure-Object</span><br /><br /><br />Enjoy!Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com3tag:blogger.com,1999:blog-7309400939930129927.post-19409308602175723282009-01-05T22:31:00.005+00:002009-01-05T22:41:41.869+00:00PowerGUI webcast - Exchange 2003 Powerpack demoI was recently invited to record a <a href="http://www.powergui.org/documentation.jspa">webcast</a> by the Product Manager at Quest for PowerGUI, Darin Pendergraft, demoing the <a href="http://www.powergui.org/entry.jspa?externalID=1956&categoryID=47">Exchange 2003 Powerpack</a> I made for PowerGUI.<br /><br />They came up with the idea to make some videos / webcasts giving some community members the opportunity to show what PowerGUI can do. A lot of people primarily use it only as a script editor, but the management console side of things is brilliant once you get into it - hopefully these examples will help inspire more people to make some powerpacks.<br /><br />I had a lot of fun recording the interview, it was funny to be on the other end of the questions for once, normally I'm asking them for the <a href="http://get-scripting.blogspot.com">Get-Scripting podcast</a>.<br /><br />It runs for about 15 - 20 mins, I hope you enjoy <a href="http://www.powergui.org/documentation.jspa">it</a>.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-52396041269549849442009-01-05T21:42:00.002+00:002009-01-05T21:56:35.651+00:00Get-Scripting Podcast Episode 6So we got <a href="http://get-scripting.blogspot.com/2008/12/get-scripting-podcast-episode-6-ben.html">Episode 6</a> of the Get-Scripting Podcast out last week. You can get it from here:<br /><br /><a href="http://media.libsyn.com/media/getscripting/Get-ScriptingEpisode6.mp3">Download it here</a>, subscribe in <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=286899256">iTunes</a> or via a different <a href="http://feeds.feedburner.com/Get-scripting">feed reader</a><br /><br />Normally Alan, Matt and I all arrange to be in the same place to record the show. Given we live in completely different places in the UK this is not easy and is probably the main reason we keep it to one show per month. We could do a Skype type thing, but we prefer to keep it a face-to-face recording. Now though that I work in the same office as Alan this time we took the opportunity to record the show during a lunchtime and I got Matt to post-edit the result when meeting for family time over Christmas.<br /><br />End result: I think the show was a bit more relaxed because we just let the tape roll and edited afterwards rather than stopping and starting when normally we sometimes re-record bits; logistically much easier; still took about the same time to edit.<br /><br />The interview with Ben Pearce which I had recorded a few weeks earlier was an absolute blast. Ben is such a fun guy to be around and made for a real easy interview because he doesn't stop talking; I think we got some great tips from him for Powershell beginners too.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-54135584731060362282008-12-20T12:41:00.002+00:002008-12-20T13:02:39.411+00:00Powershellers on TwitterSo I was pretty sceptical for a long while about things like <a href="http://twitter.com/jonathanmedd">Twitter</a> and Facebook, but I finally gave in mostly thanks to my buddy <a href="http://twitter.com/alanrenouf">Alan Renouf</a> and to be honest its been brilliant. Its such a useful way to quickly find information and keep up to date with a particular topic, obviously in my case <a href="http://search.twitter.com/search?q=powershell">Powershell</a>.<br /><br />Whilst at Teched it was a great tool to keep up with things which were going on in sessions or what people where up to. I also used it during a Powershell Q&A with Jeffrey Snover to invite fellow Twitterers to give me some questions for him.<br /><br />At the <a href="https://twitter.com/getscripting">Get-Scripting podcast</a> its a really useful tool for us to be able to put out info about the show, particularly when we release a new epsiode and conversley really handy to keep up to date with shows like the Powerscripting Podcast and <a href="https://twitter.com/mindofroot">Mind of Root</a>.<br /><br />Steven Murawski from the Mind of Root podcast has helpfully posted a <a href="http://www.mindofroot.com/powershell-twitterers/">list</a> of Powershell people on Twitter who you can follow.<br /><br />Best news of all <a href="https://twitter.com/jsnover">Jeffrey Snover</a> has just started posting on Twitter! Now that is definitely a good person to follow for Powershell info. ;-) There was lots of chat during the Powerscripting UStream the other night when Jeffrey and Bruce were on the show about how the chat that night was pretty similar to what goes on on Twitter, so I guess that's maybe we he signed up too.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-36606824038023807542008-12-17T22:50:00.003+00:002008-12-17T23:06:47.482+00:00PowerScripting Live CTP3 Special - Thursday 18th DecThis is a must watch PowerScripting Podcast <a href="http://powerscripting.wordpress.com/2008/12/15/big-show-coming-this-thursday/">special</a> - the hint is in the title.<br /><br />Jeffrey Snover and Bruce Payette are the two guests, it should be an awesome show.<br /><br />Thursday 18th Dec 9pm EST, which translates to 2am UK time. I think I'm going to have to stay up for it!Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0tag:blogger.com,1999:blog-7309400939930129927.post-76694094453822961982008-12-11T23:25:00.003+00:002008-12-12T00:13:26.881+00:00Take your own advice Jonathan!During this last year I've done quite a few presentations about Powershell and quite often as part of the demo I have included PowerGUI since I find it a great way to reel people in who aren't quite yet ready to make a jump the whole way to command line scripting.<br /><br />One of the topics I usually talk about around this is how I (like most people seem to) initially used the PowerGUI script editor for writing my scripts, but didn't really get what the PowerGUI console was all about. I couldn't quite get my head around why you would want a<br /><br /><span style="font-weight: bold;">GUI console</span> for a <span style="font-weight: bold;">command shell</span> to manage a <span style="font-weight: bold;">GUI </span>OS or product,<br /><br />it didn't seem to make much sense to me.<br /><br />Luckily, we were very fortunate back in May to head over to Quest in the UK with the Powershell User Group for an evening's event. I decided I'd better figure out what the PowerGUI console was for before attending so watched some of the <a href="http://www.powergui.org/documentation.jspa">videos on the PowerGUI</a> site to give myself a better idea.<br /><br />Doing that and seeing Dmitry's presentation in the night made things finally click. You could use it to make custom management consoles for your own use or even better to give to a colleague or share with the community. That's where the idea for the <a href="http://www.powergui.org/entry.jspa?externalID=1956&categoryID=47">Exchange 2003 PowerPack</a> was born and the <a href="http://get-scripting.blogspot.com/">Get-Scripting podcast</a> was born almost by accident that night too, but those are stories for another day. :-)<br /><br />Anyway, back to the presenting. I often show PowerGUI and explain how you can use it to make custom management consoles to give to colleagues.<br /><br />Recently I have been working out my notice period before heading to a new job and one of the things I have done during that time is create a bunch of scripts for the regular admin tasks I or others carry out (particularly with AD) which I never got round to writing for myself or them and to save whoever took on my role or parts of it a load of hassle.<br /><br />For instance I finally got around to creating a script for de-provisioning users which should really help to improve the previous process which was in place. It was based on my good friend <a href="http://jonoble.spaces.live.com/blog/cns%21CC73D8744F0894A5%21643.entry?sa=683735828">Jonathan Noble's blog post</a> about setting logon hours for an account rather than disabling it so that the email doesn't bounce. Thanks Jon!<br /><br />Of course some of these scripts were to be handed over to the helpdesk. Now without being patronising (because we have some very smart people on our helpdesk) it can be quite a jump for a helpdesk person to read through all the documentation I wrote for each script and start running those scripts from the command shell and seeing their results in a blue on black window.<br /><br />So the cogs started whirring away in the old brain whilst I tried to think of a better way I could deliver these scripts for the helpdesk so they could get up and running with them much quicker and easier without having to read through all the boring documentation first and have a better experience when running them, i.e. don't put them off using the scripts once I'm not there anymore to help them.<br /><br />Finally it clicked. Why didn't I take my own advice I'd been giving out all year about making management consoles for your colleagues and go and do it myself! So the AD Admin Powerpack was born, I packaged up my scripts into this PowerPack, installed PowerGUI for them and instantly the scripts were far more useable.<br /><br />No need to read all of my boring documentation beforehand since its pretty obvious what clicking on script nodes such as 'Find Expired AD users' or 'How many users in Active Directory?' will do.<br /><br />Effective, very simple solutions which save people time, make them more efficient and its makes me feel good to leave something useful like that behind for them to use. Thank you PowerGUI!<br /><br />Of course the girls on the helpdesk love the train icon so it was an even easier win with them.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz_96HkQrs2enSyew-Cl0t2xjku4V0SLjAmbmSyrizWTAYTy7mqW7CZkhv2ic3bR_M6dCPUBWAhMsTIWdUSRuPIkYIImj5vCbv-kV9VyLSwreepv148Si8Owuh46w7Z5epBaVJQaQmQgM/s1600-h/PowerGUI.PNG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 172px; height: 119px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz_96HkQrs2enSyew-Cl0t2xjku4V0SLjAmbmSyrizWTAYTy7mqW7CZkhv2ic3bR_M6dCPUBWAhMsTIWdUSRuPIkYIImj5vCbv-kV9VyLSwreepv148Si8Owuh46w7Z5epBaVJQaQmQgM/s400/PowerGUI.PNG" alt="" id="BLOGGER_PHOTO_ID_5278687723112317842" border="0" /></a>Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com3tag:blogger.com,1999:blog-7309400939930129927.post-45825180418002284802008-11-27T08:49:00.003+00:002008-11-27T08:59:38.940+00:00Get-Scripting Podcast Episode 5 - (Dmitry Sotnikov - Quest AD cmdlets and PowerGUI)We had a lot of fun recording the <a href="http://get-scripting.blogspot.com/2008/11/get-scripting-podcast-episode-5-dmitry.html">latest episode</a> of the Get-Scripting podcast on Tuesday night. Its been great having <a href="http://teckinfo.blogspot.com/">Alan</a> join the show, gives the show a much more conversational feel plus I don't have to come up with all the content. :-)<br /><br />We had a really interesting interview in this episode with <a href="http://dmitrysotnikov.wordpress.com/">Dmitry Sotnikov</a> talking about the Quest AD cmdlets and PowerGUI - go check it <a href="http://get-scripting.blogspot.com/2008/11/get-scripting-podcast-episode-5-dmitry.html">out</a>.<br /><br />Coming up on the next show in December we have an interview with <a href="http://blogs.technet.com/benp">Ben Pearce</a> from Microsoft. Ben is the guy who recently presented Powershell sessions with Jeffrey Snover at TechEd EMEA, does a lot of Powershell training and is great fun to interview.Jonathan Meddhttp://www.blogger.com/profile/16003000142799678177noreply@blogger.com0