<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>powershell &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/powershell/</link>
	<description>Feed of posts on WordPress.com tagged "powershell"</description>
	<pubDate>Sun, 29 Nov 2009 14:20:56 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Enable Remoting on Windows 7]]></title>
<link>http://arabianpowershell.wordpress.com/2009/11/28/enable-remoting-on-windows-7/</link>
<pubDate>Sat, 28 Nov 2009 15:02:00 +0000</pubDate>
<dc:creator>Sherif Talaat</dc:creator>
<guid>http://arabianpowershell.wordpress.com/2009/11/28/enable-remoting-on-windows-7/</guid>
<description><![CDATA[PowerShell Remoting خاصية من أهم الخواص اللي تميز بيها PowerShell عن غيره من الـ Shells التقليدية. ز]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>PowerShell Remoting خاصية من أهم الخواص اللي تميز بيها PowerShell عن غيره من الـ Shells التقليدية. زي ما قولت قبل كده ان خاصية الـ Remoting بتوفر إمكانية تشغيل وتنفيذ أوامر PowerShell او ما يعرف بـ cmdlets على أي جهاز كمبيوتر داخل الـ network بشرط ان يكون PowerShell موجود (Installed) على الكمبيوتر ده.</p>
<p>على الرغم من أن PowerShell Remoting خاصية أكتر من ممتازة، لا يمكن إستخدامها في أي Workgroup environment أو peer-to-peer (P2P) network. يمكن إستخدامها فقط في Domain-Environment أو AD-Environment لأسباب أمنية (Security).</p>
<p>دلوقتي في Windows 7 بقي ممكن إستخدام خاصية الـ Remoting في أي workgroup أو Peer-to-Peer.</p>
<p>ملحوظة: قبل ما أبدء في الشرح يفترض ان يكون عندك 2 كمبيوتر (A,B) عليهم Windows 7  و Windows PowerShell v2 و التأكد من الـ 2 كمبيوتر في نفس الـ IP Add. range، على سبيل المثال الـ IP Address لكمبيوتر A هيكون 192.168.1.10 والـ IP Address لكمبيوتر B هيكون 192.168.1.20.</p>
<p>دلوقتي هنحاول أن احنا نفتح Remote Session من كمبيوتر A إلي كمبيوتر B عن طريق إستخدام أمر Enter-PSSession:</p>
<p><strong>Enter-PSSession 192.168.1.20</strong></p>
<p>هنلاقي أن PowerShell Console طلع Error بيقول ان في مشكلة في الـ WinRM. الموضوع ببساطة ان الـ Remoting بيعتمد على حاجة اسمها Windows Remote Management المسئولة عن إستقبال اي Remote Connection، سبب الـ Error هو ان الـ WinRM Service مقفولة على الـ Windows عشان هي <a href="http://en.wikipedia.org/wiki/Secure_by_default" target="_blank">Secure by default</a> لأسباب أمنية.</p>
<p><strong>الخطوة الأولي: تشغيل WinRM على كمبيوتر A و B</strong></p>
<p>لتشغيل WinRM هنستخدم أمر  <strong>Set-WSManQuickConfig ، </strong>قبل متستخدم الأمر تأكد من:</p>
<ul>
<li> ان ليك Administrative Privileges.</li>
<li> أنك عايز تشغل WinRM وقادر علي تأمين جهازك وشبكتك وده عشان الأمر ده بيعمل الآتي:</li>
<li> بيتأكد أن WinRM شغالة ولا مش شغالة بيشغلها.</li>
<li> بيغير الـ Start mode للـ WinRM Service ويبقي Automatic.</li>
<li> بيقوم بإنشاء Listner لإستقبال أي request من أي IP Address. دائما اي request بيتم عن طريق HTTP Protocol.</li>
<li> بيعمل Firewall Exception rule للـ WinRM Service عشان يتأكد ان الـFirewall مش هيقفل اي traffic يخص الـ WS-Management.</li>
</ul>
<p>بمجرد كتابة الأمر Set-WSManQuickConfig و الضغط على Enter لتنفيذه، هتظهرلك رسالة توضح الـ 4 نقاط اللي اتكلمنا عليها</p>
<p><a href="http://arabianpowershell.files.wordpress.com/2009/11/setwsmanquickconfig.png"><img style="display:inline;border-width:0;" title="Set-WSManQuickConfig" src="http://arabianpowershell.files.wordpress.com/2009/11/setwsmanquickconfig_thumb.png?w=410&#038;h=118" border="0" alt="Set-WSManQuickConfig" width="410" height="118" /></a></p>
<p>بعد التأكد من تنفيذ الأمر على كمبيوتر A و كمبيوتر B. هنحاول مرة تانية ان نفتح Remote Session من A إلي B عن طريق أمر Enter-PSSession. لكن هيظهر Error تاني بس السبب مختلف المرة دي. أول مرة كان سبب الـError هو ان الـWinRM Service مش شغالة. المرة سبب الـError هو ان الWinRM بترفض (Reject) أي request غير مُأمن بالـ Kerberos او على الأقل يكون بيستخدم نفس الـ Security mechanism أو ان الكمبيوتر اللي بيرسل الـrequest مش موجود في الـtrusted list في الكمبيوتر اللي بيستقبل، و بما أننا  بنستخدم Windows 7 على كمبيوتر A و B يبقي بنستخدم نفس الـ Security mechanism ،يبقي لنا ان الكمبيوتر مش موجود في الـ trusted list. والهدف منها هو التأكد من أن الكمبيوتر المحددة فقط هي المسموح لها بإستخدام خاصية الـ Remoting وليس أي كمبيوتر أخر.</p>
<p>قبل إضافة كمبيوتر B إلي الـ trusted list في كمبيوتر A.</p>
<p>هنستخدم أمر <strong>Test-WSMan </strong>عشان نتأكد ان على الأقل كمبيوتر A وكمبيوتر B قادرين على فتح Remote Sessions بينهم بغض النظر عن قبول او رفض الـ requests.</p>
<p><strong>Test-WSMan 192.168.1.20</strong></p>
<p><strong> </strong></p>
<p><strong>الخطوة الثانية: إضافة كمبيوتر A و B إلي الـ TrustedHosts list</strong></p>
<p>الخطوة رقم 2 هي ان احنا هنعرف الـ WinRM على كل كمبيوتر على الكمبيوتر التاني عشان يسمح بإستقبال أي request لفتح اي remote session عن طريق إضافة الكمبيوتر في الـ trustedhosts list. على سبيل المثال عشان نسمح لكمبيوتر B ان يبعت request إلي كمبيوتر A يبقي لازم نُضيف الـ IP Address لكمبيوتر B في الـtrustedhosts list لكمبيوتر A. ويمكن كتابة “ * ” بدلاً من الـIP Address وفي هذه الحالة سيقوم الـWinRM بإستقبال اي Request من اي كمبيوتر وده بيكون عن طريق الأمر ده:</p>
<p><strong>Set-Item WSMan:\localhost\client\trustedhosts * –force</strong></p>
<p><strong>الخطوة الثالثة: جرب و إستمتع…!!! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> :)</strong></p>
<p>بعد تنفيذ الخطوة رقم 2 أصبحت خاصية  الـ remoting جاهزة للإستخدام.</p>
<p><strong>Enter-PSSession 192.168.1.20</strong></p>
<p>بعد لحظات من الضغط على Enter لتنفيذ الأمر (الفترة اللي بيفتح فيها الـremote session) هيظهر الـ PS prompt لكمبيوتر B. دلوقتي تقدر تنفذ اي cmdlet على كمبيوتر B من خلال كمبيوتر A عن طريق PowerShell Remoting.</p>
<p>يمكن إستخدام أمر <strong>Exit-PSSession</strong> عشان تقفل الـRemote Session.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Tausendertrennzeichen für Dateigrössen in der PowerShell]]></title>
<link>http://megos.wordpress.com/2009/11/28/tausendertrennzeichen-fuer-dateigroessen-in-der-powershell/</link>
<pubDate>Sat, 28 Nov 2009 13:18:56 +0000</pubDate>
<dc:creator>René Brunner</dc:creator>
<guid>http://megos.wordpress.com/2009/11/28/tausendertrennzeichen-fuer-dateigroessen-in-der-powershell/</guid>
<description><![CDATA[Standardmässig gibt die PowerShell beim dir-Befehl (bzw. Get-ChildItem für Directories) Dateigrössen]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Standardmässig gibt die PowerShell beim <i>dir</i>-Befehl (bzw. <i>Get-ChildItem</i> für Directories) Dateigrössen ohne irgendwelche Zifferngruppierung aus, d.h. ohne Tausendertrennzeichen, welche Dateigrössen jenseits von einigen Megabytes überhaupt erst lesbar machen. Das ist für ein sonst so modernes System eigentlich sehr erstaunlich; das konnte MS-DOS wahrscheinlich schon vor 20 Jahren schon besser!</p>
<p>Eine Abklärung in dieser Sache, welche ich diese Woche gemacht habe, ergab zum Glück das Resultat, dass Abhilfe möglich und sogar recht einfach ist, wenn man weiss wie.</p>
<p>Dieser <a href="http://fatbeards.blogspot.com/2009/10/defining-object-formatting-or-how-to.html">Artikel</a> in einem Blog namens <a href="http://fatbeards.blogspot.com/">FatBeard&#8217;s Adventures in PowerShell</a> zeigt sehr schön die Grundzüge des Prinzips: Wenn <i>Get-ChildItem</i> seine Objekte der Klasse <i>System.IO.FileInfo</i> zu einer textuellen, kolonnenorientierten Darstellung wandelt, entnimmt es die Informationen, wie genau zu formattieren sei, einem XML-File namens <i>FileSystem.Format.ps1xml</i> in der <i>$PSHOME</i> Directory.</p>
<p>Man kann von einem solchen <i>.ps1xml</i> File eine Kopie erstellen, an dieser Änderungen vornehmen, und dann der PowerShell mit Hilfe des <i>Update-FormatData</i>-Kommandos und dessen Option <i>-prependPath</i> mitteilen, dass die Kopie zuerst zu konsultieren sei. (Am besten nimmt man eine entsprechende Zeile in seine <i>$PROFILE</i> Datei auf.)</p>
<p>Es ist relativ einfach, in besagtem File betreffend Filesystem-Klassen folgenden XML-Abschnitt zu lokalisieren, der für die fragliche Kolonne mit den Filegrössen zuständig ist:</p>
<pre class="brush: xml;">
&#60;TableColumnItem&#62;
   &#60;PropertyName&#62;Length&#60;/PropertyName&#62;
&#60;/TableColumnItem&#62;
</pre>
<p>&#8230; und ihn zu ersetzen durch den folgenden:</p>
<pre class="brush: xml;">
&#60;TableColumnItem&#62;
   &#60;ScriptBlock&#62;
      [String]::Format(&#34;{0:N0}&#34;,$_.Length)
   &#60;/ScriptBlock&#62;
&#60;/TableColumnItem&#62;
</pre>
<p>Die Kolonne von jetzt 10 Zeichen, die dann für die verbesserte Darstellung nicht mehr reichen, zu verbreitern auf z.B. 15 Zeichen, ist ebenfalls schnell gemacht.</p>
<p>Wer will, kann natürlich noch weiter gehen, etwas mehr programmieren im <i>SkriptBlock</i> und grosse Zahlen in Einheiten von KB, MB und GB ausgeben. Mir persönlich genügen Dateigrössen hübsch mit Tausendertrennzeichen vorerst. Sehen wir in ein paar Jahren weiter, wenn das Zeitalter der Gigabytes, in dem wir uns heute befinden, abgelöst wird durch das Zeitalter der Terabytes.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PowerShell ISE vs cmd.exe : PowerShell ISE vs cmd.exe]]></title>
<link>http://chimac.net/2009/11/27/powershell-ise-vs-cmd-exe-powershell-ise-vs-cmd-exe/</link>
<pubDate>Fri, 27 Nov 2009 22:32:23 +0000</pubDate>
<dc:creator>chimac</dc:creator>
<guid>http://chimac.net/2009/11/27/powershell-ise-vs-cmd-exe-powershell-ise-vs-cmd-exe/</guid>
<description><![CDATA[It requires some work but it worth it if you have lots of machines to setup.  Click here to study.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>It requires some work but it worth it if you have lots of machines to setup.  Click <a href="http://www.tomsguide.com/us/PowerShell-Microsoft-Windows,review-1453.html" target="_self">here</a> to study.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PowerShell &ndash; Working with an Excel Range]]></title>
<link>http://unlockpowershell.wordpress.com/2009/11/27/powershell-working-with-an-excel-range/</link>
<pubDate>Fri, 27 Nov 2009 20:29:59 +0000</pubDate>
<dc:creator>karlmitschke</dc:creator>
<guid>http://unlockpowershell.wordpress.com/2009/11/27/powershell-working-with-an-excel-range/</guid>
<description><![CDATA[I’m working on a server inventory project, and as part of that project, I need to add a field “Monit]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><font color="#0000ff">I’m working on a server inventory project, and as part of that project, I need to add a field “Monitored” – this field will show either SCOM, Nimbus, No, or N/A.</font></p>
<p><font color="#0000ff">N/A will mean the server has an exception to monitoring. These servers are in a text file called NonmonitoredServers.txt:</font></p>
<p><font color="#0000ff">Server098      <br />PRDServer198:PRDServer598       <br />TestServer011:TestServer055</font></p>
<p><font color="#0000ff">The “:” indicates a range of servers – All servers from PRDServer198 through PRDServer598, TestServer011 through TestServer055 and Server098 have an exception to monitoring.</font></p>
<p><font color="#0000ff">The length of the server name, before the numeric part varies, so I can’t just do a $server.SubString(9) and expect to strip off only alphabetic characters. So, I do this:</font></p>
<div style="border-bottom:black 1px solid;border-left:black 1px solid;width:450px;font-family:consolas,lucida console;font-size:10pt;overflow:auto;border-top:black 1px solid;border-right:black 1px solid;padding:5px;">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="font-family:consolas,lucida console;background:#cecece;font-size:10pt;padding:5px;">001              <br />002               <br />003               <br />004               <br />005               <br />006               <br />007               <br />008               </p>
<p>009               </p>
<p>010               <br />011               <br />012               <br />013               <br />014               <br />015               </p>
<p>016               <br />017               <br />018               <br />019               <br />020               <br />021               <br />022               <br />023               </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="font-family:consolas,lucida console;background:#fcfcfc;font-size:10pt;padding:5px;"><span style="color:#ff4500;">$MonitoredServers</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#000000;">@{</span><span style="color:#000000;">}</span>               <br /><span style="color:#ff4500;">$Exceptions</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#0000ff;">Get-Content</span><span style="color:#000000;">&#160;</span><span style="color:#8b0000;">&#34;NonmonitoredServers.txt&#34;</span>               <br /><span style="color:#00008b;">foreach</span><span style="color:#000000;">&#160;</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$Exception</span><span style="color:#000000;">&#160;</span><span style="color:#00008b;">in</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$Exceptions</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;">{</span>               <br /><span style="color:#000000;"></span><span style="color:#00008b;">if</span><span style="color:#000000;">&#160;</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Contains</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;:&#34;</span><span style="color:#000000;">)</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">{</span>               <br /><span style="color:#000000;"></span><span style="color:#006400;">#Exception is a range</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$range</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Replace</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Substring</span><span style="color:#000000;">(</span>`               <br /><span style="color:#000000;"></span><span style="color:#800080;">0</span><span style="color:#a9a9a9;">,</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">IndexOfAny</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;123456789&#34;</span><span style="color:#000000;">)</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">,</span><span style="color:#8b0000;">&#34;&#34;</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$prefix</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">Substring</span><span style="color:#000000;">(</span><span style="color:#800080;">0</span><span style="color:#a9a9a9;">,</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span>`               <br /><span style="color:#000000;"></span><span style="color:#000000;">IndexOfAny</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;123456789&#34;</span><span style="color:#000000;">)</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$lowerRange</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$range</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">split</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;:&#34;</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">0</span><span style="color:#a9a9a9;">]</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$upperRange</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$range</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">split</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;:&#34;</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">1</span><span style="color:#a9a9a9;">]</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$range</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$lowerRange</span><span style="color:#a9a9a9;">..</span><span style="color:#ff4500;">$upperRange</span>               <br /><span style="color:#000000;"></span><span style="color:#00008b;">foreach</span><span style="color:#000000;">&#160;</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$ServerNumber</span><span style="color:#000000;">&#160;</span><span style="color:#00008b;">in</span><span style="color:#000000;">&#160;</span><span style="color:#ff4500;">$range</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">{</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$MonitoredServers</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">add</span><span style="color:#000000;">(</span><span style="color:#8b0000;">&#34;$prefix$ServerNumber&#34;</span><span style="color:#a9a9a9;">.</span>`               <br /><span style="color:#000000;"></span><span style="color:#000000;">ToUpper</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">,</span><span style="color:#8b0000;">&#34;N/A&#34;</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">}</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">}</span>               <br /><span style="color:#000000;"></span><span style="color:#00008b;">else</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">{</span>               <br /><span style="color:#000000;"></span><span style="color:#006400;">#Exception is a single device</span>               <br /><span style="color:#000000;"></span><span style="color:#ff4500;">$MonitoredServers</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">add</span><span style="color:#000000;">(</span><span style="color:#ff4500;">$Exception</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">ToUpper</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">,</span><span style="color:#8b0000;">&#34;N/A&#34;</span><span style="color:#000000;">)</span>               <br /><span style="color:#000000;"></span><span style="color:#000000;">}</span>               <br /><span style="color:#000000;">}</span> </div>
</td>
</tr>
</tbody>
</table></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Poweshell to remove all Secondary Email address for given set of users ]]></title>
<link>http://smtpport25.wordpress.com/2009/11/27/poweshell-to-remove-all-secondary-email-address-for-given-set-of-users/</link>
<pubDate>Fri, 27 Nov 2009 14:45:46 +0000</pubDate>
<dc:creator>Krishna</dc:creator>
<guid>http://smtpport25.wordpress.com/2009/11/27/poweshell-to-remove-all-secondary-email-address-for-given-set-of-users/</guid>
<description><![CDATA[Below powershell helps to pull out all the  secondary email address for the given set of users Get-C]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Below powershell helps to pull out all the  secondary email address for the given set of users</p>
<p><strong>Get-Content C:\users.txt&#124;Get-Mailbox &#124; foreach {<br />
for ($i=$_.EmailAddresses.Count;$i -ge 0; $i&#8211;)<br />
{<br />
$_.EmailAddresses[$i].ProxyAddressString</strong></p>
<p><strong>if ($_.EmailAddresses[$i].ProxyAddressString  -like &#8220;smtp:*&#8221; )<br />
{<br />
$_.EmailAddresses.RemoveAt($i)<br />
}</strong></p>
<p><strong>}<br />
$_&#124;set-mailbox<br />
}</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[New cmdlets to manage AD computer accounts]]></title>
<link>http://dmitrysotnikov.wordpress.com/2009/11/27/new-cmdlets-to-manage-ad-computer-accounts/</link>
<pubDate>Fri, 27 Nov 2009 11:00:09 +0000</pubDate>
<dc:creator>Dmitry Sotnikov</dc:creator>
<guid>http://dmitrysotnikov.wordpress.com/2009/11/27/new-cmdlets-to-manage-ad-computer-accounts/</guid>
<description><![CDATA[Up to version 1.3, we used to have one cmdlet for computer accounts (namely Get-QADComputer) &#8211;]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Up to <a href="http://dmitrysotnikov.wordpress.com/2009/11/25/ad-cmdlets-1-3-rtmed/">version 1.3</a>, we used to have one cmdlet for computer accounts (namely <a title="Get-QADComputer" href="http://wiki.powergui.org/index.php/Get-QADComputer">Get-QADComputer</a>) &#8211; now we have 6:</p>
<ul>
<li><a title="Get-QADComputer" href="http://wiki.powergui.org/index.php/Get-QADComputer">Get-QADComputer</a></li>
<li><a title="New-QADComputer" href="http://wiki.powergui.org/index.php/New-QADComputer">New-QADComputer</a></li>
<li><a title="Set-QADComputer" href="http://wiki.powergui.org/index.php/Set-QADComputer">Set-QADComputer</a></li>
<li><a title="Set-QADComputer" href="http://wiki.powergui.org/index.php/Set-QADComputer"></a><a title="Enable-QADComputer" href="http://wiki.powergui.org/index.php/Enable-QADComputer">Enable-QADComputer</a></li>
<li><a title="Enable-QADComputer" href="http://wiki.powergui.org/index.php/Enable-QADComputer"></a><a title="Disable-QADComputer" href="http://wiki.powergui.org/index.php/Disable-QADComputer">Disable-QADComputer</a></li>
<li><a title="Disable-QADComputer" href="http://wiki.powergui.org/index.php/Disable-QADComputer"></a><a title="Reset-QADComputer" href="http://wiki.powergui.org/index.php/Reset-QADComputer">Reset-QADComputer</a></li>
</ul>
<p>You can kind of guess what they do by their names, but let&#8217;s quickly go through them one by one and give a few quick examples.</p>
<ul>
<li><a title="Get-QADComputer" href="http://wiki.powergui.org/index.php/Get-QADComputer">Get-QADComputer</a></li>
</ul>
<p>Retrieves AD computer account objects based on the criteria you specify. E.g. (anyone still running Vista? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p><code>Get-QADComputer spb* -OSName 'Windows Vista*' &#124; Format-Table Name, ManagedBy</code></p>
<ul>
<li><a title="New-QADComputer" href="http://wiki.powergui.org/index.php/New-QADComputer">New-QADComputer</a></li>
</ul>
<p>Creates new computer account in AD (does not join the actual computer though) and sets the attributes you specify:  </p>
<p><code>New-QADComputer -Name 'LAB-SRV3' -SamAccountName 'LAB-SRV3' -ParentContainer 'CN=Computers,DC=lab,DC=local' -Location 'AMS/HQ/Building A'</code></p>
<ul>
<li><a title="Set-QADComputer" href="http://wiki.powergui.org/index.php/Set-QADComputer">Set-QADComputer</a></li>
</ul>
<p>Modifies AD computer account properties (can work in bulk when you pipe Get-QADComputer output into this one).  </p>
<p><code>Set-QADComputer 'quest.local/computers/Comp4' -ManagedBy 'QUEST\DSotnikov'</code></p>
<p> or </p>
<p> <code>Get-QADComputer spb* &#124; Set-QADComputer -Location 'St. Petersburg'</code></p>
<ul>
<li><a title="Enable-QADComputer" href="http://wiki.powergui.org/index.php/Enable-QADComputer">Enable-QADComputer</a></li>
<li><a title="Enable-QADComputer" href="http://wiki.powergui.org/index.php/Enable-QADComputer"></a><a title="Disable-QADComputer" href="http://wiki.powergui.org/index.php/Disable-QADComputer">Disable-QADComputer</a></li>
</ul>
<p>Enable or disable one or multiple computer accounts:  </p>
<p><code>Enable-QADComputer 'CN=LAB-SRV1,CN=Computers,DC=dom,DC=local'</code> </p>
<p>or </p>
<p><code>Get-QADComputer -SearchRoot 'dom.local/labComputers' &#124; Disable-QADComputer</code></p>
<ul>
<li><a title="Reset-QADComputer" href="http://wiki.powergui.org/index.php/Reset-QADComputer">Reset-QADComputer</a></li>
</ul>
<p>Reset a computer account in Active Directory. When resetting a computer account, you reset the secure channel between the computer that uses that account to join the domain and a domain controller in the domain.Resetting a computer account breaks that computer&#8217;s connection to the domain and requires it to rejoin the domain.</p>
<p><code>Reset-QADComputer 'CN=LAB-SRV1,CN=Computers,DC=dom,DC=local'</code> </p>
<p>More information can be found in <a href="http://wiki.powergui.org/index.php/QAD_cmdlets_reference">AD cmdlets online reference</a> and <a href="http://www.quest.com/QuestWebPowershellCmdletDwnldARS">PDF guide</a>. <a href="http://www.quest.com/powershell/activeroles-server.aspx">Download the new AD cmdlets now</a> and let us know what you think by posting to the <a href="http://powergui.org/forum.jspa?forumID=173">AD PowerShell discussion forum</a>!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[VMM Tricks: How to get the audit trail records from a VMM Job ]]></title>
<link>http://fawzi.wordpress.com/2009/11/27/vmm-tricks-how-to-get-the-audit-trail-records-from-a-vmm-job/</link>
<pubDate>Fri, 27 Nov 2009 08:44:22 +0000</pubDate>
<dc:creator>Mohamed Fawzi</dc:creator>
<guid>http://fawzi.wordpress.com/2009/11/27/vmm-tricks-how-to-get-the-audit-trail-records-from-a-vmm-job/</guid>
<description><![CDATA[Source Today, in VMM, you can open the Administrator Console and click on the Jobs view to see all t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://blogs.technet.com/m2/archive/2009/11/27/how-to-get-the-audit-trail-records-from-a-vmm-job.aspx">Source</a></p>
<p>Today, in VMM, you can open the Administrator Console and click on the Jobs view to see all the Jobs in VMM. When you select an individual job, you can click on the &#8220;Change Tracking&#8221; tab and view any changes that were recorded in VMM as part of this job.</p>
<p>In this post, i will show you how to do this in PowerShell since it is not as intuitive. Basically, audit trail records that are placed in the change tracking tab are not cached on the client computer by default. the only way to surface them in powershell is to individually invoke the get-job commandlet and pass it the Job parameter while asking for the FULL job to be downloaded. the following powershell script does exactly that and displayed the audit trail records for all jobs in the system.</p>
<p>#get all jobs in the system<br />
$jobs = get-job -all<br />
foreach ($job in $jobs)<br />
{</p>
<p>#get the details including the audit records for each single job in VMM<br />
$singlejob = get-job -job $job -full<br />
$auditrecordsexist = $singlejob &#124; select AreAuditRecordsAvailable<br />
if ($auditrecordsexist)<br />
{</p>
<p>#if any audit records exist, print them out<br />
foreach ($record in $singlejob.AuditRecords)<br />
{<br />
$record<br />
$prev = $record.Previous<br />
$newr = $record.New<br />
$prev<br />
$newr<br />
}<br />
}<br />
}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Send email using Powershell]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/send-email-using-powershell/</link>
<pubDate>Thu, 26 Nov 2009 17:12:54 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/send-email-using-powershell/</guid>
<description><![CDATA[This script leverages Powershell to automate the sending of a custom email message using Outlook. Si]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This script leverages Powershell to automate the sending of a custom email message using Outlook. Simply modify the &#8216;NewMail.Subject&#8217;, &#8216;NewMail.To&#8217; and &#8216;NewMail.Body&#8217; values that I&#8217;ve used, to adapt it for your purposes. Remember to save this script with the required ‘*.ps1′ extension or it will not work!</p>
<p>&#8216;@<br />
$olMailItem = 0<br />
$olApp = new-object -comobject Outlook.application<br />
$NewMail = $olApp.CreateItem($olMailItem)<br />
$NewMail.Subject = &#8220;Testing&#8221;<br />
$NewMail.To = &#8220;Brian Bernard&#8221;<br />
$NewMail.Body = &#8220;Verbum sat sapienti.&#8221; `<br />
$NewMail.Send()</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Delete email using Powershell]]></title>
<link>http://soulfulsyntax.wordpress.com/2009/11/26/delete-email-using-powershell/</link>
<pubDate>Thu, 26 Nov 2009 17:06:37 +0000</pubDate>
<dc:creator>ChocolateSoul</dc:creator>
<guid>http://soulfulsyntax.wordpress.com/2009/11/26/delete-email-using-powershell/</guid>
<description><![CDATA[Here is a Powershell script that I wrote that can automatically delete email messages from Outlook. ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here is a Powershell script that I wrote that can automatically delete email messages from Outlook. It will delete any email in your Inbox that matches the From value specified in the Items.Restrict variable, so modify this to your desired Display Name to have it work for you. Remember to save this script with the required &#8216;*.ps1&#8242; extension or it will not work!</p>
<p>&#8216;@<br />
$olFolderInbox = 6<br />
$o = new-object -comobject Outlook.application<br />
$n = $o.GetNamespace(&#8220;MAPI&#8221;)<br />
$f = $n.GetDefaultFolder($olFolderInbox)<br />
$Items = $f.Items<br />
$FilteredItems = $Items.Restrict(&#8220;[From] = &#8216;Sanaa Lathan&#8217;&#8221;)<br />
for ($i = $FilteredItems.Count; $i -gt 0; $i&#8211;) {<br />
$FilteredItems.Item($i).Delete()<br />
}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PowerShell Sessions in PDC2009]]></title>
<link>http://arabianpowershell.wordpress.com/2009/11/26/powershell-sessions-in-pdc2009/</link>
<pubDate>Thu, 26 Nov 2009 14:44:31 +0000</pubDate>
<dc:creator>Sherif Talaat</dc:creator>
<guid>http://arabianpowershell.wordpress.com/2009/11/26/powershell-sessions-in-pdc2009/</guid>
<description><![CDATA[دي الــ Sessions اللي كانت بتتكلم على Windows PowerShell في مؤتمر PDC السنوي. Building Your Administ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>دي الــ Sessions اللي كانت بتتكلم على Windows PowerShell في مؤتمر PDC السنوي.</p>
<p><a href="http://microsoftpdc.com/Sessions/SVR12" target="_blank">Building Your Administration GUI over Windows PowerShell</a></p>
<p><a href="http://microsoftpdc.com/Sessions/SVR13" target="_blank">Windows PowerShell: An Automation Toolbox for Building Solutions That Span Small Businesses, Enterprises, and Cloud Services</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Powershell scripts for SharePoint 2010 services - &lsquo;Stop &amp; Start&rsquo;]]></title>
<link>http://sharepointcoding.wordpress.com/2009/11/26/powershell-scripts-for-sharepoint-2010-services-stop-start/</link>
<pubDate>Thu, 26 Nov 2009 13:32:43 +0000</pubDate>
<dc:creator>alex350r</dc:creator>
<guid>http://sharepointcoding.wordpress.com/2009/11/26/powershell-scripts-for-sharepoint-2010-services-stop-start/</guid>
<description><![CDATA[We all now know that SharePoint 2010 is resource intensive, especially intensive with its ram usage.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>We all now know that SharePoint 2010 is resource intensive, especially intensive with its ram usage. </p>
<p>I originally installed full blown SharePoint 2010 on my laptop (which has 4gb of ram) only to see most of that ram being used up and none left for visual studio to run.</p>
<p>I would recommend anyone who wants to install it on their workstation that only has 4gb of ram to install SharePoint Foundation instead which needs much less ram and will be fine for simple SharePoint 2010 dev or just playing around.</p>
<p>After I had installed it on my workstation I went on a search of some powershell scripts that I could use to stop SharePoint’s services when its not in use and start them up when needed.</p>
<p>It turns out Emmanuel Bergerat had created some and posted them on his blog, see here &#8211; </p>
<p><a title="http://blogs.msdn.com/emberger/archive/2009/11/16/stop-and-go-with-sharepoint-2010-on-your-workstation.aspx" href="http://blogs.msdn.com/emberger/archive/2009/11/16/stop-and-go-with-sharepoint-2010-on-your-workstation.aspx">http://blogs.msdn.com/emberger/archive/2009/11/16/stop-and-go-with-sharepoint-2010-on-your-workstation.aspx</a></p>
<p>Thanks Emmanuel!</p>
<p>I have modified these scripts to work with SharePoint Foundation instead of full SharePoint Server 2010. </p>
<p>You can find the scripts on my SkyDrive – link at the bottom of the post.</p>
<p>To get them to work you will need to open them and edit the line &#8211; </p>
<p><strong>&#8216;MSSQL$SHAREPOINT&#8217;,&#34;SQLWriter&#34;,&#8217;SQLAgent$SHAREPOINT&#8217; &#124; ForEach-Object</strong></p>
<p>You need to change the name of the SQL Service (in my case MSSQL$SHAREPOINT) to the name matching yours. This name will depend on what your SQL instance is called, if you install SharePoint ‘standalone’ then it will most likely be the same as mine.</p>
<p>Run the scripts in the following order &#8211; </p>
<p>1. ‘Manual.ps1’ – Sets services to manual startup (Only need to run this once)</p>
<p>2. ‘Start.ps1’ – Starts SQL &#38; SharePoint Foundation services</p>
<p>3. ‘Stop.ps1’ – Stops SQL &#38; SharePoint Foundation services</p>
<p>Hope this helps! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>&#160;</p>
<p><font size="2"><strong>Link: </strong></font><a title="http://cid-0b297b44873297a0.skydrive.live.com/browse.aspx/.Public/SharePoint%202010/Powershell%20Scripts" href="http://cid-0b297b44873297a0.skydrive.live.com/browse.aspx/.Public/SharePoint%202010/Powershell%20Scripts" target="_blank"><font size="2"><strong>SharePoint Foundation Powershell Scripts</strong></font></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Gregg Robertson &ndash; Some good PowerShell/PowerCli links]]></title>
<link>http://powercli.wordpress.com/2009/11/26/gregg-robertson-some-good-powershellpowercli-links/</link>
<pubDate>Thu, 26 Nov 2009 13:03:31 +0000</pubDate>
<dc:creator>Matt Roblin</dc:creator>
<guid>http://powercli.wordpress.com/2009/11/26/gregg-robertson-some-good-powershellpowercli-links/</guid>
<description><![CDATA[Gregg has recently got stuck into the world of PowerShell – he has posted his first impressions and ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Gregg has recently got stuck into the world of PowerShell – he has posted his first impressions and some good training video links on his blog so take a look <a href="http://consultingblogs.emc.com/greggrobertson/archive/2009/11/25/powershell-powergui-powercli-and-vcheck.aspx">here</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Send-MailMessage - Exchange 207 sp2 and Exchange 2010]]></title>
<link>http://smtpport25.wordpress.com/2009/11/26/send-mailmessage-exchange-207-sp2-and-exchange-2010/</link>
<pubDate>Thu, 26 Nov 2009 08:13:44 +0000</pubDate>
<dc:creator>Krishna</dc:creator>
<guid>http://smtpport25.wordpress.com/2009/11/26/send-mailmessage-exchange-207-sp2-and-exchange-2010/</guid>
<description><![CDATA[Sending email throught command had multiple steps,  now Exchagne 2007 SP2 which works on Powershell ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sending email throught command had multiple steps,  now Exchagne 2007 SP2 which works on Powershell V2 has introduced a new cmdlet Send-Mailmessage. Sending email with Send-MailEssage is just single line command Below is the example of the same</p>
<p><strong>Send-MailMessage –From </strong><a href="mailto:Krishna.k@domain.com"><strong>Krishna.k@domain.com</strong></a><strong> –To </strong><a href="mailto:Rajesh@domain.com"><strong>Rajesh@domain.com</strong></a><strong> –Subject “Send-MailMessage Test” –Body “Send-MailMessage Test”  -Attachments &#8220;c:\Attachment.txt&#8221; –SmtpServer Hubserver.domain</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Powershell to Get all the Exchange Services Status]]></title>
<link>http://smtpport25.wordpress.com/2009/11/26/powershell-to-get-all-the-exchange-services-status/</link>
<pubDate>Thu, 26 Nov 2009 07:32:23 +0000</pubDate>
<dc:creator>Krishna</dc:creator>
<guid>http://smtpport25.wordpress.com/2009/11/26/powershell-to-get-all-the-exchange-services-status/</guid>
<description><![CDATA[Powershell check can pull all the Exchange Services status runing on the exchange 2007 Servers $Exch]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Powershell check can pull all the Exchange Services status runing on the exchange 2007 Servers</p>
<p><strong>$Exchserver = &#8220;&#60;Servername&#62;&#8221;<br />
$ExchServices = (gwmi -computer $Exchserver -query &#8220;select * from win32_service where Name like &#8216;MSExchange%&#8217; or Name like &#8216;IIS%&#8217; or Name like &#8216;SMTP%&#8217; or Name like &#8216;POP%&#8217; or Name like &#8216;W3SVC%&#8217;&#8221;)<br />
$Services = @()<br />
Foreach ($Service in $ExchServices){<br />
$Service.Caption<br />
$Service.Startname<br />
$Service.StartMode<br />
$Service.State<br />
}</strong></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[AD Cmdlets 1.3 from Quest RTM'ed]]></title>
<link>http://chrisfederico.wordpress.com/2009/11/25/ad-cmdlets-1-3-from-quest-rtmed/</link>
<pubDate>Thu, 26 Nov 2009 03:08:31 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid>http://chrisfederico.wordpress.com/2009/11/25/ad-cmdlets-1-3-from-quest-rtmed/</guid>
<description><![CDATA[If you have not used Quests AD Cmdlets your missing out on a real treat . Head over to Dmitry&#8217;]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>If you have not used Quests AD Cmdlets your missing out on a real treat . Head over to Dmitry&#8217;s blog for more information . You will not be disappointed.</p>
<p>http://dmitrysotnikov.wordpress.com/2009/11/25/ad-cmdlets-1-3-rtmed/</p>
<p>They are free and feature rich <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#160;</p>
<p>Chris</p>
<p>&#160;</p>
<p>&#160;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[SSD Defragmentierung unter Windows 7 und Trim Befehl]]></title>
<link>http://newyear2006.wordpress.com/2009/11/26/ssd-defragmentierung-unter-windows-7-und-trim-befehl/</link>
<pubDate>Thu, 26 Nov 2009 01:10:54 +0000</pubDate>
<dc:creator>newyear2006</dc:creator>
<guid>http://newyear2006.wordpress.com/2009/11/26/ssd-defragmentierung-unter-windows-7-und-trim-befehl/</guid>
<description><![CDATA[Aufgeschreckt durch diesen Artikel: http://blogs.technet.com/filecab/archive/2009/11/25/windows-7-di]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Aufgeschreckt durch diesen Artikel: <a title="http://blogs.technet.com/filecab/archive/2009/11/25/windows-7-disk-defragmenter-user-interface-overview.aspx" href="http://blogs.technet.com/filecab/archive/2009/11/25/windows-7-disk-defragmenter-user-interface-overview.aspx">http://blogs.technet.com/filecab/archive/2009/11/25/windows-7-disk-defragmenter-user-interface-overview.aspx</a>, hat sich folgendes ergeben.</p>
<p>Obwohl ja Windows 7 offiziell den Trim Befehl bei SSD Festplatten unterstützt <a title="http://blogs.msdn.com/e7/archive/2009/05/05/support-and-q-a-for-solid-state-drives-and.aspx" href="http://blogs.msdn.com/e7/archive/2009/05/05/support-and-q-a-for-solid-state-drives-and.aspx">http://blogs.msdn.com/e7/archive/2009/05/05/support-and-q-a-for-solid-state-drives-and.aspx</a>, ist die Sache wie immer nicht so einfach.</p>
<p>Denn eine SSD muss von Windows 7 erstmal als SSD erkannt werden, sonst wird sie wie eine schnelle Festplatte behandelt. Mit allen Konsequenzen! Z. B. auch eines unnötigen Defragmentierungslauf, der nicht nur die Lebensdauer der SSD verkürzt sondern auch noch gleichzeitig unnötig die Akkulaufzeit eines Notebook oder Netbooks reduziert.</p>
<p>Angeblich soll der Befehl </p>
<p>fsutil behavior query DisableDeleteNotify </p>
<p>0 liefern, wenn der Trim Befehl aktiv ist, oder auch nicht. Durch zum jetzigen Zeitpunkt immer noch nicht verfügbare offizielle Information von Microsoft hat mal wieder Google die Meinungsführerschaft übernommen, so das reih auf und reih ab darüber Spekuliert wird. <a title="http://www.hardwareluxx.de/community/showthread.php?t=615540" href="http://www.hardwareluxx.de/community/showthread.php?t=615540">http://www.hardwareluxx.de/community/showthread.php?t=615540</a>. Witzig auch dieser Forumseintrag: <a title="http://social.technet.microsoft.com/Forums/en-US/w7itprohardware/thread/d06e1cb5-d518-447e-b3d6-db2d580899cb" href="http://social.technet.microsoft.com/Forums/en-US/w7itprohardware/thread/d06e1cb5-d518-447e-b3d6-db2d580899cb">http://social.technet.microsoft.com/Forums/en-US/w7itprohardware/thread/d06e1cb5-d518-447e-b3d6-db2d580899cb</a>. Ein Microsoft-Mitarbeiter verweist auf den obigen Blogeintrag, aber meines Erachtens stimmt da was nicht, denn auch bei einer normalen Festplatte kommt bei DisableDeleteNotify 0 als Ergebnis.</p>
<p>Aber jetzt zu meinem eigentlichen Problem die Defragmentierung. Wie stelle ich zuerst mal fest, ob der Defragmentierungsdienst läuft? Tja liebe Freunde der GUI, Pech gehabt. Seit Windows Vista gibt es so viele Anwendungs- und Dienstprotokolle, dass man Tage mit verbringen kann den richtigen Dienst zu finden. Auch die Möglichkeit Filter zu setzen ist nicht so der schnelle Bringer.</p>
<p>Aber als neuer bekennender Fan von Powershell, erledigen wir die Sache kurz mal damit:</p>
<blockquote><p>Get-EventLog System &#124; Sort-Object TimeGenerated &#124; Where-Object {$_.Message –like &#34;*defrag*&#34;} &#124; fl</p>
</blockquote>
<p>Dieser Befehl gibt die neuesten Einträge als letztes aus. Nun weiß man also wann in der Richtung das letzte mal was passiert ist.</p>
<p>Da getreu dem Motto von Windows 7 mit den Triggered Events nur das laufen soll, was benötigt wird, läuft der Defragmentierungsdienst auch nicht immer.</p>
<p>Um nun das Defragmentieren zu Unterbinden, sucht man in der Aufgabenplanung den Defrag-Eintrag. Man hat nun die Option den Eintrag komplett zu löschen, zu deaktivieren oder beim Aufruf von Defrag.EXE mit dem Parameter /E eine Ausnahme für das betreffende Laufwerk anzugeben. Wie es einem beliebt.</p>
<p>Bleibt noch die Frage, ob an Defrag noch weitere Dinge kleben, die durch die Ausnahme nun nicht mehr funktionieren, mal sehen.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Korrekte Powershell Abfrage von Eventlog Eintr&auml;gen nach Datum]]></title>
<link>http://newyear2006.wordpress.com/2009/11/26/korrekte-powershell-abfrage-von-eventlog-eintrgen-nach-datum/</link>
<pubDate>Wed, 25 Nov 2009 23:05:45 +0000</pubDate>
<dc:creator>newyear2006</dc:creator>
<guid>http://newyear2006.wordpress.com/2009/11/26/korrekte-powershell-abfrage-von-eventlog-eintrgen-nach-datum/</guid>
<description><![CDATA[Inspiriert durch einen Vortrag von Dr. Tobias Weltner auf einer Microsoft Veranstaltung in Karlsruhe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Inspiriert durch einen Vortrag von Dr. Tobias Weltner auf einer Microsoft Veranstaltung in Karlsruhe, hatte ich die Gelegenheit mir die neuen Möglichkeiten des Remoting in Powershell 2.0 anzusehen.</p>
<p>Als ich nun meine ersten Gehversuche in Powershell machte, brauchte ich Spieldaten. Da bietet sich natürlich die Eventlog an.</p>
<p>Als erstes wurde </p>
<blockquote><p>Get-Eventlog System</p>
</blockquote>
<p>ausgeführt. Dieser Befehl listet nun alle Eventlog Einträge auf. Das kann dann schon mal dauern…</p>
<p>Schnell war klar da muss ein Filter her. Also mal kurz gegooglet:</p>
<blockquote><p><a title="http://www.google.de/search?q=powershell+get-eventlog+filter" href="http://www.google.de/search?q=powershell+get-eventlog+filter">http://www.google.de/search?q=powershell+get-eventlog+filter</a></p>
</blockquote>
<p>Zu Tage kam Ralf Schnells Blogeintrag: <a title="http://blogs.technet.com/ralfschnell/archive/2009/08/12/abfrage-von-eventlog-eintr-gen-mit-powershell.aspx" href="http://blogs.technet.com/ralfschnell/archive/2009/08/12/abfrage-von-eventlog-eintr-gen-mit-powershell.aspx">http://blogs.technet.com/ralfschnell/archive/2009/08/12/abfrage-von-eventlog-eintr-gen-mit-powershell.aspx</a></p>
<p>Dort war die Rede vom where-Object mit Bedingung.</p>
<p>Da hab ich dann gleich mal gelernt, dass <strong>man sich nicht auf die Spaltenüberschriften verlassen kann,</strong> denn die werden einfach gekürzt! So ist z. B. bei Aufruf von</p>
<blockquote><p>Get-EventLog System –Newest 1</p>
</blockquote>
<p>bei der Zeitausgabe als Überschrift Time zu lesen. Aber man kann mit Time nachher nichts anfangen, denn es steckt eigentlich TimeGenerated dahinter.</p>
<p>&#60;KleineSpitze&#62;   <br />So weit so gut, aber das was Herr Schnell nun versucht und in einem Kommentar auf Powershell V1 bzw. V2 oder XP, Vista oder Windows 7 Unzulänglichkeiten zu schieben versucht, hätte ich von vielen erwartet aber nicht von einem Microsoft Mitarbeiter der MCP, MCSE, MCSA, MCT und ITIL Service Manager zertifiziert ist. So macht man seine eigenen Produkte schlecht!    <br />&#60;/KleineSpitze&#62;</p>
<p>Um nun also die Daten korrekt verarbeiten zu können muss man also den Typ von TimeGenerated rausfinden. Diesen bekommt man schön durch </p>
<blockquote><p>Get-EventLog System –newest 1 &#124; Get-Member</p>
</blockquote>
<p>aufgelistet. Falls es mal zuviele werden sollten, kann man gezielt nach einem suchen:</p>
<blockquote><p>Get-EventLog System –newest 1 &#124; Get-Member &#124; Where-Object {$_.Name –like &#34;time*&#34;}</p>
</blockquote>
<p>Dort ist nun bei Definition die Rede von System.DateTime. Da Powershell auf dem .Net-Framework aufsetzt und alles ja Objekte sind, hat man von da ausgehend alle Möglichkeiten: <a title="http://msdn.microsoft.com/en-us/library/system.datetime.aspx" href="http://msdn.microsoft.com/en-us/library/system.datetime.aspx">http://msdn.microsoft.com/en-us/library/system.datetime.aspx</a></p>
<p>Man kann nun also durch </p>
<blockquote><p>Get-EventLog System &#124; Where-Object {$_.TimeGenerated.Month –eq 11 –and $_.TimeGenerated.Year –eq 2009}</p>
</blockquote>
<p>alle Eventlog-Einträge aus dem November 2009 anzeigen lassen.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Use the &ndash;Filter, Luke]]></title>
<link>http://unlockpowershell.wordpress.com/2009/11/25/use-the-filter-luke/</link>
<pubDate>Wed, 25 Nov 2009 21:12:00 +0000</pubDate>
<dc:creator>karlmitschke</dc:creator>
<guid>http://unlockpowershell.wordpress.com/2009/11/25/use-the-filter-luke/</guid>
<description><![CDATA[Quite often, I see questions like “Why is my Get-Recipient command so slow?”, with a syntax like: 00]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Quite often, I see questions like “Why is my Get-Recipient command so slow?”, with a syntax like:</p>
</p>
<div style="border-bottom:black 1px solid;border-left:black 1px solid;width:450px;font-family:consolas,lucida console;font-size:10pt;overflow:auto;border-top:black 1px solid;border-right:black 1px solid;padding:5px;">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="font-family:consolas,lucida console;background:#cecece;font-size:10pt;padding:5px;">001              <br />002               <br />003               </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="font-family:consolas,lucida console;background:#fcfcfc;font-size:10pt;padding:5px;"><span style="color:#ff4500;">$user1</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#0000ff;">Get-Recipient</span><span style="color:#000000;">&#160;</span><span style="color:#000080;">-ResultSize</span><span style="color:#000000;">&#160;</span><span style="color:#8a2be2;">unlimited</span><span style="color:#000000;">&#160;</span>`               <br /><span style="color:#a9a9a9;">&#124;</span><span style="color:#0000ff;">Where-Object</span><span style="color:#000000;">&#160;</span><span style="color:#000000;">{</span><span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">emailaddresses</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">-eq</span><span style="color:#000000;">&#160;</span>`               <br /><span style="color:#8b0000;">&#8216;karlmitschke@contoso.com&#8217;</span><span style="color:#000000;">}</span> </div>
</td>
</tr>
</tbody>
</table></div>
<p style="margin:0;" class="MsoNormal"><font color="#000000" size="3" face="Calibri">You would think that would work lickity split, because there is only 1 result, me. </font></p>
<p><span style="font-family:&#34;color:#0070c0;font-size:11pt;"><font color="#000000">Ah, not so fast, grasshopper.&#160; We are doing client side filtering – all recipients are returned by the Get-Recipient call, and THEN we pass those objects to the Where-Object.</font></span></p>
<p><span style="font-family:&#34;color:#0070c0;font-size:11pt;"><font color="#000000">On my Exchange 2007 system, this takes over a minute to return my information in $user1</font></span></p>
<p><font color="#000000">So, I did some research,</font> and read about –Filters and doing server side filtering: </p>
<p><a href="http://blogs.technet.com/evand/archive/2007/02/19/filterable-properties-in-exchange-2007-rtm.aspx">http://blogs.technet.com/evand/archive/2007/02/19/filterable-properties-in-exchange-2007-rtm.aspx</a> and <a href="http://technet.microsoft.com/en-us/library/bb738155.aspx">http://technet.microsoft.com/en-us/library/bb738155.aspx</a></p>
<p>Modifying my script to use the –Filter produces results in less than 1 second:</p>
<div style="border-bottom:black 1px solid;border-left:black 1px solid;width:450px;font-family:consolas,lucida console;font-size:10pt;overflow:auto;border-top:black 1px solid;border-right:black 1px solid;padding:5px;">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="font-family:consolas,lucida console;background:#cecece;font-size:10pt;padding:5px;">001              <br />002               </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="font-family:consolas,lucida console;background:#fcfcfc;font-size:10pt;padding:5px;"><span style="color:#ff4500;">$user2</span><span style="color:#000000;">&#160;</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">&#160;</span><span style="color:#0000ff;">Get-Recipient</span><span style="color:#000000;">&#160;</span><span style="color:#000080;">-Filter</span><span style="color:#000000;">&#160;</span>`               <br /><span style="color:#000000;">{</span><span style="color:#0000ff;">EmailAddresses</span><span style="color:#000000;">&#160;</span><span style="color:#000080;">-eq</span><span style="color:#000000;">&#160;</span><span style="color:#8b0000;">&#8216;karlmitschke@contoso.com&#8217;</span><span style="color:#000000;">}</span> </div>
</td>
</tr>
</tbody>
</table></div>
<p>I suggest that you check for the –Filter parameter for any cmdlet that you use, and learn its syntax!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[AD Cmdlets 1.3 RTMed]]></title>
<link>http://dmitrysotnikov.wordpress.com/2009/11/25/ad-cmdlets-1-3-rtmed/</link>
<pubDate>Wed, 25 Nov 2009 16:18:34 +0000</pubDate>
<dc:creator>Dmitry Sotnikov</dc:creator>
<guid>http://dmitrysotnikov.wordpress.com/2009/11/25/ad-cmdlets-1-3-rtmed/</guid>
<description><![CDATA[Late last week we released to the web the latest version (1.3) of our free Active Directory cmdlets ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Late last week we released to the web the latest version (1.3) of <a href="http://www.quest.com/activeroles-server/arms.aspx">our free Active Directory cmdlets</a> (also known as QAD-cmdlets, widely used by tens of thousands admins and compatible with more or less any version of Active Directory or ADAM/ADLDS).</p>
<p>You can read more about the cmdlets in <a href="http://www.quest.com/QuestWebPowershellCmdletDwnldARS">this PDF guide</a>, or <a href="http://wiki.powergui.org/index.php/QAD_cmdlets_reference">online reference</a>.</p>
<p>This is a significant update with some 14 new cmdlets, 24 new parameters, 43 enhanced ones, and a few bugs fixed (not that we had any really <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<p>Detailed What&#8217;s New information can be found on page 19 of the <a href="http://www.quest.com/QuestWebPowershellCmdletDwnldARS">PDF guide</a> and in my upcoming blog posts. <a href="http://www.quest.com/powershell/activeroles-server.aspx">Download the new AD cmdlets now</a> and let us know what you think by posting to the <a href="http://powergui.org/forum.jspa?forumID=173">AD PowerShell discussion forum</a>!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[New Distribution Lists]]></title>
<link>http://shortshell.wordpress.com/2009/11/25/new-distribution-lists/</link>
<pubDate>Wed, 25 Nov 2009 03:30:59 +0000</pubDate>
<dc:creator>superhumanben</dc:creator>
<guid>http://shortshell.wordpress.com/2009/11/25/new-distribution-lists/</guid>
<description><![CDATA[Recently I&#8217;ve had to create 100+ distribution lists at the same time. Each with a different ow]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Recently I&#8217;ve had to create 100+ distribution lists at the same time. Each with a different owner. Rather than create each individual one at a time, I figured I&#8217;d throw together a quick Powershell script. It&#8217;s a very simple script for those who&#8217;re used to scripting languages but it&#8217;s my first without help and it just plain works. So I&#8217;m happy with it. Note however, you will need the <a href="http://www.powergui.org/entry.jspa?externalID=763&#38;categoryID=46">Active Directory PowerPack</a> to create DLs. We are running Exchange 2007 at my work so I also needed <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=30eebc7c-a35a-41ae-9cd1-2047847fde85&#38;displaylang=en">Microsoft Exchange Server 2007 SP1 Management Pack</a> to create email enabled DLs.</p>
<p><code>$file = Import-Csv r:\Test.csv<br />
foreach ($entry in $file) {<br />
	$null = New-DistributionGroup -name $entry.name -SamAccountName $entry.SamAccountName -type Distribution -ManagedBy $entry.owner -OrganizationalUnit $entry.Location<br />
	Set-QADGroup -Identity $entry.Name -Description ("Owner: " + $entry.owner)<br />
	Add-ADPermission -Identity $entry.Name -User $entry.owner -AccessRights "WriteProperty" -ExtendedRights "Self-Membership" -Properties Member -InheritanceType None<br />
}</code></p>
<p>The greatest thing about Powershell is the logic just makes sense. In line 3, &#8220;-name $entry.name&#8221; calls to the CSV column named appropriately name. This corresponds directly to Display Name. SamAccountName corresponds to Pre-Windows 2000 name. The rest are self explanatory. See an example of the CSV below.</p>
<p><a href="http://shortshell.wordpress.com/files/2009/11/test-csv.jpg"><img src="http://shortshell.wordpress.com/files/2009/11/test-csv.jpg?w=300" alt="" title="Test.csv" class="alignleft size-medium wp-image-8" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Powershell - Part 3 - Variables]]></title>
<link>http://powertoe.wordpress.com/2009/11/25/powershell-part-3-variables/</link>
<pubDate>Wed, 25 Nov 2009 03:05:12 +0000</pubDate>
<dc:creator>Tome</dc:creator>
<guid>http://powertoe.wordpress.com/2009/11/25/powershell-part-3-variables/</guid>
<description><![CDATA[Time to learn some more basics.  In our last tutorial we looked at some of the special variables giv]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Time to learn some more basics.  In our <a href="http://powertoe.wordpress.com/2009/11/16/powershell-part-2-opening-files-writing-to-the-screen-the-pipeline-and-dot-values/" target="_blank">last tutorial</a> we looked at some of the special variables given to us within Powershell, but now it&#8217;s time to discuss how user variables work.  Let&#8217;s start off simply.</p>
<blockquote><address><strong><span style="font-style:normal;">$var1 = &#8216;blahblahblah&#8217;</span></strong></address>
<address><strong><span style="font-style:normal;">echo $var1</span></strong></address>
</blockquote>
<p>By using the $ before the word var1 we&#8217;ve created a variable.  Using the equal sign we are able to set this variable to the string &#8216;blahblahblahblah&#8217;.  Powershell is a very dynamic language in that it allows you to create and assign variables without casting them to a data type.  This can be a double-edged sword so it&#8217;s a good idea to understand how this can cause problems.  Take the following for example:</p>
<blockquote><address><span style="font-style:normal;"><strong>$var1 = 5</strong></span></address>
<address><span style="font-style:normal;"><strong>$var2 = &#8220;blah&#8221;</strong></span></address>
<address><span style="font-style:normal;"><strong>echo ($var1 + $var2)</strong></span></address>
</blockquote>
<p>Here we are trying to use a number (it&#8217;s a number because there are no quotes) and a string (it&#8217;s a string because it has quotes) with the + operator.  If they were both strings this would concatenate them.  If they were both Int32 they would add them together.  Because they are different we get an error that &#8220;blah&#8221; cannot be converted to Int32.  Powershell is extremely flexible with its data types.  Since the .net implementation of the Int32 class and the string class have Converto() functions the script will attempt to automatically convert the variable to the type expected by the operation.  In the above example the first variable is an Int32 so it assumes you are trying to add another number to this one.  If we reverse this and start with the string and use the + sign the compiler sees the first variable as a string and expects to concatenate.  Since an Int32 can easily be converted to a string reversing the operation works without failure:</p>
<blockquote><address><span style="font-style:normal;"><strong>$var1 = 5</strong></span></address>
<address><span style="font-style:normal;"><strong>$var2 = &#8220;blah&#8221;</strong></span></address>
<address><span style="font-style:normal;"><strong>echo ($var2 + $var1)</strong></span></address>
</blockquote>
<p>You can also call a conversion through the .Net methods available to the data type.  For example returning to our original problem code you can successfully do the following to ensure that the Int32 is interpreted as a string:</p>
<blockquote><address><span style="font-style:normal;"><strong>$var1 = 5</strong></span></address>
<address><span style="font-style:normal;"><strong>$var2 = &#8220;blah&#8221;</strong></span></address>
<address><span style="font-style:normal;"><strong>echo ($var1.tostring() + $var2)</strong></span></address>
</blockquote>
<p>Another way to get around this problem is to explicitly cast the variable to what you want it to be.  This is done with [] brackets before the variable:</p>
<blockquote><address><strong><span style="font-style:normal;">[string]$var1 = 5</span></strong></address>
<address><strong><span style="font-style:normal;">$var2 = &#8220;blah&#8221;</span></strong></address>
<address><strong><span style="font-style:normal;">echo ($var1 + $var2)</span></strong></address>
</blockquote>
<p><span style="font-style:normal;">Before we end this portion of the tutorial it&#8217;s important to discuss one more item, interpolation.  Powershell uses the same methods for interpolation that Perl uses.  If it&#8217;s in a double quote it will be interpolated.  If it&#8217;s in a single quote it is a string literal.  In both cases it is a string, but it&#8217;s how the string handles variables inside its quotes that makes them different.  The following illustrates this:</span></p>
<blockquote><address><span style="font-style:normal;"><strong>$var1 = &#8216;blahblahblah&#8217;</strong></span></address>
<address><span style="font-style:normal;"><strong>echo &#8220;This is what my variable is set to: $var1&#8243;</strong></span></address>
<address><span style="font-style:normal;"><strong>echo &#8216;This will not work: $var1&#8242;</strong></span></address>
</blockquote>
<p><span style="font-style:normal;">We have now learned the basics of what Perl calls a scalar variable.  In the next tutorial we will discuss arrays.</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Get-DistributionGroupMember Recursively]]></title>
<link>http://unlockpowershell.wordpress.com/2009/11/24/get-distributiongroupmember-recursively/</link>
<pubDate>Tue, 24 Nov 2009 23:27:48 +0000</pubDate>
<dc:creator>karlmitschke</dc:creator>
<guid>http://unlockpowershell.wordpress.com/2009/11/24/get-distributiongroupmember-recursively/</guid>
<description><![CDATA[I had a need to get distribution group members for a specific group. Most people seem to install the]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"><font face="Calibri"><font size="3">I had a need to get distribution group members for a specific group. Most people seem to install the free “ActiveRoles Management Shell for Active Directory” from Quest Software when they are facing a task such as this. </font></font></span>
</p>
</p>
</p>
<p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"></span></p>
</p>
<p> <span style="color:#0070c0;"><font face="Calibri"><font size="3">With the Quest “ActiveRoles Management Shell”, you can do this like “Get-QadGroupMember &#60;group name&#62;–Indirect” </font>
</p>
<p>   </font></span>
</p>
<p style="margin:0;" class="MsoNormal"><span style="font-family:&#34;color:#333333;"></span></p>
</p>
<p> <span style="color:#0070c0;"><font size="3"><font face="Calibri">I’m kind of contrary, and so I wanted to do the same thing with the Exchange Management Shell that came with our Exchange 2007 installation. So, I created the script shown here. Save it as get-exgrouprecurse.ps1. </font>
</p>
<p>   </font></span>
</p>
<p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"></span></p>
</p>
<p> <span style="color:#0070c0;"><font size="3"><font face="Calibri">Run it as: </font>
</p>
<p>   </font></span>
</p>
<p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"><font size="3"><font face="Calibri">get-exgrouprecurse -group &#60;group name&#62; </font></font></span>
</p>
</p>
</p>
<p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"><font size="3"><font face="Calibri">or get-exgrouprecurse &#60;group name&#62; </font></font></span>
</p>
</p>
</p>
<p style="margin:0;" class="MsoNormal"><span style="color:#0070c0;"></span></p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2309a96b-f53a-4a88-8881-cb905936711f" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;color:#000;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#fff;overflow:auto;">
<ol style="background:#ffffff;white-space:nowrap;margin:0;padding:0 0 0 5px;">
<li><span style="color:#008000;">#####################################</span></li>
<li style="background:#f3f3f3;"><span style="color:#008000;">#&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;#</span></li>
<li><span style="color:#008000;"># Script to retreive group members&#160;&#160;#&#160;&#160;</span></li>
<li style="background:#f3f3f3;"><span style="color:#008000;">#&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;#</span></li>
<li><span style="color:#008000;">#&#160;&#160;&#160;&#160;Karl Mitschke March 7 2008&#160;&#160;&#160;&#160;&#160;#</span></li>
<li style="background:#f3f3f3;"><span style="color:#008000;">#&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;#</span></li>
<li><span style="color:#008000;">#####################################</span></li>
<li style="background:#f3f3f3;">&#160;</li>
<li><span style="color:#008000;">######################################</span></li>
<li style="background:#f3f3f3;"><span style="color:#008000;">#&#160;&#160;heavily modified from recipe 7.3&#160;&#160;# </span></li>
<li><span style="color:#008000;">#&#160;&#160;&#160;in &#39;Active Directory Cookbook&#39;&#160;&#160;&#160;#</span></li>
<li style="background:#f3f3f3;"><span style="color:#008000;">#&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;by Robbie Allen&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;#</span></li>
<li><span style="color:#008000;">######################################</span></li>
<li style="background:#f3f3f3;">&#160;</li>
<li><span style="color:#008000;">#requires -pssnapin Microsoft.Exchange.Management.PowerShell.Admin</span></li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;">param</span><span style="color:#000000;">(</span><span style="color:#800080;">$group</span><span style="color:#000000;">)</span></li>
<li><span style="color:#800080;">$UnknownGroup</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> @{}</span></li>
<li style="background:#f3f3f3;"><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">DisplayMembers</span><span style="color:#000000;">(</span><span style="color:#800080;">$group</span><span style="color:#000000;">)</span></li>
<li><span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$SubGroup</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> @{}</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$AllMembers</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> @()</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#ff0000;">!</span><span style="color:#800080;">$group</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$group</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Read-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;Enter the groups display name&#34;</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$group</span><span style="color:#000000;">.Contains(</span><span style="color:#800000;">&#34;&#39;&#34;</span><span style="color:#000000;">))</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$group</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$group</span><span style="color:#000000;">.Replace(</span><span style="color:#800000;">&#34;&#39;&#34;</span><span style="color:#000000;">,</span><span style="color:#800000;">&#39;&#34;&#39;</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$group</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;/?&#34;</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;Usage:&#34;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;&#34;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;get-exgrouprecurse -group &#60;group name&#62;&#34;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;&#34;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;or get-exgrouprecurse &#60;group name&#62;&#34;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;Returns an object containing the group member, and the group name.&#34;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">break</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$validate</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-Group</span><span style="color:#000000;"> </span><span style="color:#800080;">$group</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$validate</span><span style="color:#000000;">.RecipientTypeDetails.ToString() </span><span style="color:#ff0000;">-match</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;mail&#34;</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$searchGroup</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-DistributionGroupMember</span><span style="color:#000000;"> </span><span style="color:#800080;">$group</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$searchGroup</span><span style="color:#000000;">)</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{&#160;&#160;&#160;&#160;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$member</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$searchGroup</span><span style="color:#000000;">)</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$membertype</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$member</span><span style="color:#000000;">.RecipientTypeDetails</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$membertype</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-match</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;Group&#34;</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$samname</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$member</span><span style="color:#000000;">.SamAccountName.ToString()</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$SubGroup</span><span style="color:#000000;">.ContainsKey(</span><span style="color:#800080;">$samname</span><span style="color:#000000;">) </span><span style="color:#ff0000;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">$true</span><span style="color:#000000;">)</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Output</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;^ already seen group member (stopping to avoid loop)&#34;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="color:#000000;"></span><span style="color:#0000ff;">else</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$SubGroup</span><span style="color:#000000;">.Add(</span><span style="color:#800080;">$samname</span><span style="color:#000000;">,</span><span style="color:#800080;">$member</span><span style="color:#000000;">.DisplayName.ToString())</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}&#160;&#160;&#160;&#160;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">else</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$member</span><span style="color:#000000;">.PrimarySmtpAddress </span><span style="color:#ff0000;">-and</span><span style="color:#000000;"> </span><span style="color:#800080;">$member</span><span style="color:#000000;">.RecipientTypeDetails </span><span style="color:#ff0000;">-notcontains</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;group&#34;</span><span style="color:#000000;">)</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">new-object</span><span style="color:#000000;"> </span><span style="color:#800000;">psObject</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> &#124; </span><span style="color:#5f9ea0;">Add-Member</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-membertype</span><span style="color:#000000;"> </span><span style="color:#800000;">noteproperty</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Name</span><span style="color:#000000;"> </span><span style="color:#800000;">GroupMember</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Value</span><span style="color:#000000;"> </span><span style="color:#800080;">$member</span><span style="color:#000000;">.name</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> &#124; </span><span style="color:#5f9ea0;">Add-Member</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-MemberType</span><span style="color:#000000;"> </span><span style="color:#800000;">noteproperty</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Name</span><span style="color:#000000;"> </span><span style="color:#800000;">GroupName</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Value</span><span style="color:#000000;"> </span><span style="color:#800080;">$group</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$AllMembers</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800080;">$obj</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">else</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$UnknownGroup</span><span style="color:#000000;">.add(</span><span style="color:#800080;">$group</span><span style="color:#000000;">,1)</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;">(</span><span style="color:#800080;">$SubGroup</span><span style="color:#000000;">.Values.Count </span><span style="color:#ff0000;">-gt</span><span style="color:#000000;"> 0)</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$subGroup</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$SubGroup</span><span style="color:#000000;">.values)</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">DisplayMembers</span><span style="color:#000000;"> </span><span style="color:#800080;">$subGroup</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$UnknownGroup</span><span style="color:#000000;">.Keys.Count </span><span style="color:#ff0000;">-gt</span><span style="color:#000000;"> 0)</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$LostGroup</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$UnknownGroup</span><span style="color:#000000;">.keys)</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">new-object</span><span style="color:#000000;"> </span><span style="color:#800000;">psObject</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> &#124; </span><span style="color:#5f9ea0;">Add-Member</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-membertype</span><span style="color:#000000;"> </span><span style="color:#800000;">noteproperty</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-name</span><span style="color:#000000;"> </span><span style="color:#800000;">GroupMember</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Value</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;Cannot enumerate group&#34;</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$obj</span><span style="color:#000000;"> &#124; </span><span style="color:#5f9ea0;">Add-Member</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-MemberType</span><span style="color:#000000;"> </span><span style="color:#800000;">noteproperty</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Name</span><span style="color:#000000;"> </span><span style="color:#800000;">GroupName</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">-Value</span><span style="color:#000000;"> </span><span style="color:#800080;">$LostGroup</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$AllMembers</span><span style="color:#000000;"> </span><span style="color:#ff0000;">+=</span><span style="color:#000000;"> </span><span style="color:#800080;">$obj</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#800080;">$UnknownGroup</span><span style="color:#000000;">.Clear()</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;">}&#160;&#160;&#160;&#160;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;">}&#160;&#160;&#160;&#160;</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#0000ff;">else</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;">{</span></li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Output</span><span style="color:#000000;"> </span><span style="color:#800000;">&#34;$group does not appear to be mail enabled.&#34;</span></li>
<li style="background:#f3f3f3;">&#160;&#160;&#160;&#160;<span style="color:#000000;">}</span></li>
<li>&#160;&#160;&#160;&#160;<span style="color:#000000;"></span><span style="color:#5f9ea0;">Write-Output</span><span style="color:#000000;"> </span><span style="color:#800080;">$AllMembers</span><span style="color:#000000;"> </span></li>
<li style="background:#f3f3f3;"><span style="color:#000000;">}</span></li>
<li><span style="color:#5f9ea0;">DisplayMembers</span><span style="color:#000000;"> </span><span style="color:#800080;">$group</span></li>
</ol></div>
</p></div>
</p></div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How to do mailbox recovery]]></title>
<link>http://bitzin.wordpress.com/2009/11/24/how-to-do-mailbox-recovery/</link>
<pubDate>Tue, 24 Nov 2009 19:53:32 +0000</pubDate>
<dc:creator>bitzin</dc:creator>
<guid>http://bitzin.wordpress.com/2009/11/24/how-to-do-mailbox-recovery/</guid>
<description><![CDATA[Here is how you would restore a mailbox after the Store has been mounted. It would restore into some]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here is how you would restore a mailbox after the Store has been mounted. It would restore into someone else account under the &#8216;restore&#8217;  folder:</p>
<address>Restore-Mailbox -RSGMailbox &#8216;Bob&#8217; -RSGDatabase &#8216;Recovery Storage Group\Immense East&#8217; -id &#8220;2&#8242; -TargetFolder &#8216;restored&#8217; -BadItemLimit 900</address>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[PowerShell ISE Output Transcription]]></title>
<link>http://microsoftblog.globalknowledge.com/2009/11/24/powershell-ise-output-transcription/</link>
<pubDate>Tue, 24 Nov 2009 15:36:59 +0000</pubDate>
<dc:creator>timatgk</dc:creator>
<guid>http://microsoftblog.globalknowledge.com/2009/11/24/powershell-ise-output-transcription/</guid>
<description><![CDATA[My past couple of posts have looked at PowerShell ISE and described a few aspects of the Script and ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My past couple of posts have looked at PowerShell ISE and described a few aspects of the Script and Command panes, with a brief mention of the Output pane.</p>
<p>Now I&#8217;d like to address some noteworthy aspects of the Output pane.</p>
<p>One of the natural habits I have developed when working with PowerShell is to run Start-Transcript before I get into any new work. The transcription feature has been a part of PowerShell since version 1.0. Having a transcript of the commands I&#8217;ve typed as well as the output from the shell can be used in auditing, peer review and training, documentation, and script development. It&#8217;s almost hard to imagine using transcripts – the same would be true of history. In fact, if I have forgotten to run Start-Transcript before I get into script development, as often happens with the realization that what the previous few commands have done would be even better in a script, and with prototyping, my quick remedy is to run Start-Transcript and then immediately follow-up with a good dose of Get-History. That way everything I&#8217;ve done recently is in the transcript, well at least the commands but not the output.</p>
<p>I panicked when I first found out that the PowerShell ISE console host does not support transcription! If you type Start-Transcript in PowerShell ISE, you get an error to this effect. Then I took a deep breath and it dawned on me: I&#8217;m in an <em>integrated</em> scripting environment. It&#8217;s not quite the same, but has it&#8217;s own form of power.</p>
<p>Consider the following sequence.</p>
<p>&#60;Ctrl&#62;+N    &#8211; creates a new script document tab</p>
<p>&#60;Ctrl&#62;+&#60;Shift&#62;+O    &#8211; navigates to the Output pane</p>
<p>&#60;Ctrl&#62;+A    &#8211; selects all of the commands and output in the Output pane</p>
<p>&#60;Ctrl&#62;+C    &#8211; copies the whole Output pane contents</p>
<p>&#60;Ctrl&#62;+I    &#8211; navigates to the Script pane</p>
<p>&#60;Ctrl&#62;+V    &#8211; pastes the Output pane contents into the Script pane</p>
<p>&#60;Ctrl&#62;+S    &#8211; initiates saving the output</p>
<p>Remember: nOacivs (or Oacnvs, etc.) It just rolls off the fingertips after you&#8217;ve done it many times. But what does this sequence do? Because the Output pane contains each Command that has been typed during this PowerShell ISE session and the resulting output, it&#8217;s quite similar to the transcript output, although not automatic. But this kind of taking some commands and output from the session is up-front and explicit. It&#8217;s not as hidden in the background, thereby it&#8217;s more clear what needs to be done in separating the wheat from the chaff. You can carefully choose what parts of the recent interactive sequence you want for one or more scripts.</p>
<p>Then, once you&#8217;ve culled together parts of scripts in this way, the real fun begins, and PowerShell ISE is there to support you – the debugging of scripts. We&#8217;ll come back and revisit PowerShell ISE later to discuss that story.</p>
<p><strong>Related Course</strong></p>
<p><a href="http://www.globalknowledge.com/training/course.asp?pageid=9&#38;courseid=11107&#38;catid=184&#38;country=United+States">Automating Windows Server 2008 Administration with Windows Powershell (M6434) </a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[And the winner is PowerGUI]]></title>
<link>http://dmitrysotnikov.wordpress.com/2009/11/24/and-the-winner-is-powergui/</link>
<pubDate>Tue, 24 Nov 2009 13:54:06 +0000</pubDate>
<dc:creator>Dmitry Sotnikov</dc:creator>
<guid>http://dmitrysotnikov.wordpress.com/2009/11/24/and-the-winner-is-powergui/</guid>
<description><![CDATA[Remember that weird Windows IT Pro contest in which they put PowerGUI against gmail, iTunes, and a t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Remember that weird Windows IT Pro contest in which they put <a href="http://dmitrysotnikov.wordpress.com/2009/08/25/powergui-versus-itunes/">PowerGUI against gmail, iTunes, and a thousand other free and open source products</a>?</p>
<p>Well, the funniest part is &#8211; thanks to your support &#8211; we won the <a href="http://www.quest.com/newsroom/news-releases-show.aspx?contentid=10724">silver award in that huge category</a>!</p>
<p><a href="http://windowsitpro.com/article/articleid/102984/2009-windows-it-pro-editors-best-and-community-choice-awards.html">Here&#8217;s</a> what the magazine had to say (and with which I happily agree!):</p>
<blockquote><p>&#8220;There are a lot of PowerShell scripting and GUI tools on the market these days, but PowerGUI remains one of the best, and it&#8217;s free!&#8221; —Jeff James, editor in chief, Windows IT Pro</p></blockquote>
<p>And my congratulations to <a href="http://www.quest.com/newsroom/news-releases-show.aspx?contentid=10724">14 other product teams from Quest winning in multiple other categories</a> &#8211; great job by everyone and a reminder of the comprehensiveness of the product set we have here:</p>
<p>In <em>Windows It Pro’s</em> Community Choice Awards:</p>
<ul>
<li>Gold for <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fauthentication-Services&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Authentication+Services+&#38;index=2&#38;md5=5814043f8c6fcef7280bd5993d8f7803">Authentication        Services </a>(Best Interoperability Product),</li>
<li>Silver for <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fgpoadmin&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Group+Policy+Manager%2FGPOAdmin%C2%AE&#38;index=3&#38;md5=927b56f5a7e1a2145fb020b2c244c80c">Group        Policy Manager/GPOAdmin<sup>®</sup></a> (Best Active Directory and Group        Policy Product),</li>
<li>Bronze for <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Flanding%2F%3Fid%3D4463&#38;esheet=6106961&#38;lan=en_US&#38;anchor=ChangeAuditor%C2%AE&#38;index=4&#38;md5=c39e625e832eeabbb01fe64fb8a77816">ChangeAuditor<sup>®</sup></a> (Best Auditing and Compliance Product).</li>
</ul>
<p>Quest’s database management solutions received <em>SQL Server Magazine</em> Editors’ Best Awards recognition in two categories:</p>
<ul>
<li> Best Backup &#38; Recovery (SQL Server) Product: <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Flitespeed-for-sql-server&#38;esheet=6106961&#38;lan=en_US&#38;anchor=LiteSpeed%C2%AE+for+SQL+Server&#38;index=5&#38;md5=4e3932eaffd8671767ec0268fb443c64">LiteSpeed<sup>®</sup> for SQL Server</a> (Gold)</li>
<li> Best Development SQL Server Tool: <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Ftoad-for-sql-server&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Toad%C2%AE+for+SQL+Server&#38;index=6&#38;md5=0b4b70071f457ea91e99ddd5ab04b287">Toad<sup>®</sup> for SQL Server</a> (Gold)</li>
</ul>
<p>Quest also was recognized by the editors at <em>Windows IT Pro</em> in the        following categories:</p>
<ul>
<li> Best Free or Open Source IT Tool<strong>: </strong><a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fpowershell%2Fpowergui.aspx&#38;esheet=6106961&#38;lan=en_US&#38;anchor=PowerGUI%E2%84%A2&#38;index=7&#38;md5=30dd99334c67760247301bc4c96c0529">PowerGUI<sup>™</sup></a> (Silver)</li>
<li> Best Auditing &#38; Compliance Product: <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Flanding%2F%3Fid%3D4463&#38;esheet=6106961&#38;lan=en_US&#38;anchor=ChangeAuditor%C2%AE&#38;index=8&#38;md5=adf0ae01c0919d515f15b901a87d6b65">ChangeAuditor<sup>®</sup></a> (Silver)</li>
<li> Best Interoperability Product: <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fauthentication-Services&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Authentication+Services&#38;index=9&#38;md5=361bd5080578bed4d15e7ca198f717cf">Authentication          Services</a> (Bronze)</li>
<li> Best Systems Management Product: <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fgpoadmin&#38;esheet=6106961&#38;lan=en_US&#38;anchor=GPOAdmin%C2%AE&#38;index=10&#38;md5=f14c291691c7f1d8f523f6e533f2aa61">GPOAdmin<sup>®</sup></a> (Bronze)</li>
</ul>
<p>Quest’s Windows management products also received nods from the readers        of <em>Redmond</em> and <em>SQL Server Magazine</em>. In the <em>Redmond </em>Readers’        Choice Awards:</p>
<ul>
<li> Quest <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fmigration-manager-for-active-directory%2F&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Migration+Manager&#38;index=11&#38;md5=0dede711fb1125f7fae97d324564f4ad">Migration        Manager</a> received both the “ISV Winner” and “Preferred Product” in        the Best Migration Product category.</li>
<li>Quest <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fdefender&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Defender&#38;index=12&#38;md5=9f1f82a1df61ea95afbb0043e2f7dc9e">Defender</a> was recognized as a “Preferred Product” in the Best Smart        Card/Biometric/Two-Factor Authentication System category.</li>
</ul>
<p><em>SQL Server        Magazine </em>and<em> Windows IT Pro’s </em>Community Choice Awards named:</p>
<ul>
<li> <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fsite-administrator-for-sharepoint&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Site+Administrator+for+SharePoint&#38;index=13&#38;md5=cbac1a6c45c1aa4517fe2e851b0f2153">Site        Administrator for SharePoint</a> the gold award winner for Best        SharePoint Product.</li>
</ul>
<p><em>SQL Server Magazine’s </em>Community Choice Awards gave:</p>
<ul>
<li> Quest’s <a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2FFoglight-Performance-Analysis-for-SQL-Server%2F&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Foglight%C2%AE+Performance+Analysis+for+SQL+Server&#38;index=14&#38;md5=f25fc8539b8ed9bae968c972ff99443f">Foglight<sup>®</sup> Performance Analysis for SQL Server</a> the silver for Best Database        Monitoring and Performance Products, and</li>
<li><a href="http://cts.businesswire.com/ct/CT?id=smartlink&#38;url=http%3A%2F%2Fwww.quest.com%2Fspotlight-on-sql-server-enterprise%2F&#38;esheet=6106961&#38;lan=en_US&#38;anchor=Spotlight%C2%AE+on+SQL+Server+Enterprise&#38;index=15&#38;md5=6fd570f26de7bd471c84f5e08e711582">Spotlight<sup>® </sup>on SQL Server Enterprise</a> was named a “Preferred Product” by <em>Redmond</em> Readers’ Choice Awards.</li>
</ul>
</div>]]></content:encoded>
</item>

</channel>
</rss>
