<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rolands Erinnermich &#187; Codeschnipsel</title>
	<atom:link href="http://www.roland-ehle.de/archives/category/scripting/codeschnipsel/feed" rel="self" type="application/rss+xml" />
	<link>http://www.roland-ehle.de</link>
	<description>Infos, Links, Scripte und mehr rund um E-Mail</description>
	<lastBuildDate>Thu, 08 Sep 2011 06:00:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Exchange 2007: Berechtigungen auf Verteilergruppen prüfen</title>
		<link>http://www.roland-ehle.de/archives/1151</link>
		<comments>http://www.roland-ehle.de/archives/1151#comments</comments>
		<pubDate>Sun, 04 Jul 2010 17:40:12 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[itproblogs.de]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Berechtigungen prüfen]]></category>
		<category><![CDATA[Verteilergruppen]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1151</guid>
		<description><![CDATA[Wie beschrieben gibt es zwischen Exchange 2007 und Exchange 2010 unter anderem den Unterschied, dass in Exchange 2010 mehrere Verwalter auf Verteilergruppen eingetragen werden können. Aus diesem Grund kann der hier veröffentlichte Code nicht für Exchange 2007 verwendet werden. Mit dem folgenden Powershell Code werden die Verteilernamen und die Namen des eingetragenen Verwalters ausgegeben, wenn ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1151">Exchange 2007: Berechtigungen auf Verteilergruppen prüfen</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Wie <a href="http://www.roland-ehle.de/archives/1125" title="Exchange: Verwalter von Verteilergruppen" target="_blank" class="liinternal">beschrieben</a> gibt es zwischen Exchange 2007 und Exchange 2010 unter anderem den Unterschied, dass in Exchange 2010 mehrere Verwalter auf Verteilergruppen eingetragen werden können. Aus diesem Grund kann der <a href="http://www.roland-ehle.de/archives/1149" title="Exchange 2010: Berechtigungen auf Verteilergruppen prüfen" target="_blank" class="liinternal">hier veröffentlichte Code</a> nicht für Exchange 2007 verwendet werden.</p>
<p style="text-align: justify;">Mit dem folgenden Powershell Code werden die Verteilernamen und die Namen des eingetragenen Verwalters ausgegeben, wenn die erforderlichen Active Directory Berechtigungen Read Property und Write Property auf &#8220;Member&#8221; fehlen:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#Alle Verteiler prüfen, bei denen das Attribut ManagedBy nicht leer ist</span>
<span style="color: #800080;">$groups</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>distributiongroup <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-Object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.ManagedBy <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">#Schleife wird für jede gefundene Gruppe ausgeführt</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$groups</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
<span style="color: #008000;">#Inhalt von ManagedBy abrufen</span>
<span style="color: #800080;">$manager</span> <span style="color: pink;">=</span> <span style="color: #800080;">$group</span>.ManagedBy
&nbsp;
<span style="color: #008000;">#Prüfen ob der Verwalter Berechtigungen auf das Property &quot;Member&quot; hat</span>
<span style="color: #800080;">$permprop</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>adpermission <span style="color: #800080;">$group</span>.DistinguishedName <span style="color: pink;">-</span>user <span style="color: #800080;">$manager</span>.DistinguishedName <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-Object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Properties <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'Member'</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">#Wenn keine Berechtigungen vorhanden sind Ausgabe des Gruppennamens und des Verwalters</span>
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$permprop</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Gruppe: &quot;</span> <span style="color: #800080;">$group</span>.SamAccountName <span style="color: #800000;">&quot;Verwalter: &quot;</span> <span style="color: #800080;">$manager</span>.DistinguishedName
<span style="color: #000000;">&#125;</span> <span style="color: #0000FF;">Else</span> <span style="color: #000000;">&#123;</span>
&nbsp;
<span style="color: #008000;">#Auf das Property &quot;Member&quot; werden Read Property und Write Property Berechtigungen benötigt</span>
<span style="color: #800080;">$permright</span> <span style="color: pink;">=</span> <span style="color: #800080;">$permprop</span>.AccessRights
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$permright</span> <span style="color: #FF0000;">-notcontains</span> <span style="color: #800000;">&quot;ReadProperty, WriteProperty&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Gruppe: &quot;</span> <span style="color: #800080;">$group</span>.SamAccountName <span style="color: #800000;">&quot;Verwalter: &quot;</span> <span style="color: #800080;">$manager</span>.DistinguishedName
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/152" rel="bookmark" class="wherego_title">Blackberry: Steuercodes in Betreffzeile von E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/1001" rel="bookmark" class="wherego_title">Update: Exchange 2007 / 2010 &#8211; tägliche Messagingstatistik</a></li><li><a href="http://www.roland-ehle.de/archives/1016" rel="bookmark" class="wherego_title">Projekt: Überwachung BlackBerry Enterprise Server mit Nagios &#8211; OIDs</a></li><li><a href="http://www.roland-ehle.de/archives/1084" rel="bookmark" class="wherego_title">Update Rollup 4 für Exchange 2010</a></li><li><a href="http://www.roland-ehle.de/archives/899" rel="bookmark" class="wherego_title">Exchange 2010: Mitgliedschaftsgenehmigung für Verteilergruppen</a></li><li><a href="http://www.roland-ehle.de/archives/1155" rel="bookmark" class="wherego_title">Exchange 2007 / 2010: Senden Als via OWA</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p> <p><a href="http://www.roland-ehle.de/?flattrss_redirect&amp;id=1151&amp;md5=347495b563341cd9eaf8f778012ab695" title="Flattr" target="_blank"><img src="http://www.roland-ehle.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1151/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2010: Berechtigungen auf Verteilergruppen prüfen</title>
		<link>http://www.roland-ehle.de/archives/1149</link>
		<comments>http://www.roland-ehle.de/archives/1149#comments</comments>
		<pubDate>Sun, 04 Jul 2010 16:59:45 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[itproblogs.de]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Berechtigungen prüfen]]></category>
		<category><![CDATA[Verteilergruppen]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1149</guid>
		<description><![CDATA[Im Artikel über Verwalter von Verteilergruppen habe ich berichtet, dass man in der Exchange 2010 Verwaltungskonsole zwar einen Verwalter eintragen kann, dieser dadurch aber nicht die Berechtigungen erhält, die Gruppe über das Outlook Adressbuch zu bearbeiten, sprich Mitglieder hinzuzufügen bzw. zu entfernen. Mit dieser Erkenntnis wäre es interessant zu wissen, bei welchen Verteilern der eingetragene ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1149">Exchange 2010: Berechtigungen auf Verteilergruppen prüfen</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Im Artikel über <a href="http://www.roland-ehle.de/archives/1125" title="Verwalter von Verteilergruppen" target="_blank" class="liinternal">Verwalter von Verteilergruppen</a> habe ich berichtet, dass man in der Exchange 2010 Verwaltungskonsole zwar einen Verwalter eintragen kann, dieser dadurch aber nicht die Berechtigungen erhält, die Gruppe über das Outlook Adressbuch zu bearbeiten, sprich Mitglieder hinzuzufügen bzw. zu entfernen.</p>
<p style="text-align: justify;">Mit dieser Erkenntnis wäre es interessant zu wissen, bei welchen Verteilern der eingetragene Manager nicht über die erforderlichen Bearbeitungsrechte verfügt, um ggf. die Berechtigungen nachzutragen.</p>
<p style="text-align: justify;">Der folgende Powershell Code gibt jeweils eine Zeile mit dem Namen des Verteilers und dem Distinguished Name des eingetragenen Verwalters aus, wenn die Active Directory Berechtigungen ReadProperty und WriteProperty auf die Eigenschaft Member nicht gesetzt sind. Es werden alle Verteiler geprüft. Der Code kann unter Exchange 2007 nicht verwendet werden, da hier noch einiges anders ist. Für Exchange 2007 werde ich das entsprechende Script separat veröffentlichen.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">#Alle Verteiler prüfen, bei denen das Property &quot;ManagedBy&quot; gefüllt ist</span>
<span style="color: #800080;">$groups</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>distributiongroup <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-Object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.ManagedBy <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">#Schleife wird für jeden gefundenen Verteiler durchlaufen</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$groups</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #008000;">#Es können mehrere Verwalter eingetragen werden, deshalb der Zusatz -expandProperty</span>
	<span style="color: #800080;">$managers</span> <span style="color: pink;">=</span> <span style="color: #800080;">$group</span>.ManagedBy
&nbsp;
	<span style="color: #008000;">#Schleife wird für jeden gefundenen Verwalter durchlaufen</span>
	<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$manager</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$managers</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #008000;">#Prüfe ob für den Verwalter eine Berechtigung für das Property &quot;Member&quot; eingetragen ist</span>
		<span style="color: #800080;">$permprop</span> <span style="color: pink;">=</span> get<span style="color: pink;">-</span>adpermission <span style="color: #800080;">$group</span>.SamAccountName <span style="color: pink;">-</span>user <span style="color: #800080;">$manager</span>.DistinguishedName <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">where-Object</span> <span style="color: #000000;">&#123;</span><span style="color: #000080;">$_</span>.Properties <span style="color: #FF0000;">-match</span> <span style="color: #800000;">'Member'</span><span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #008000;">#Wenn keine Berechtigung vorhanden ist, Ausgabe des Gruppennamens und des Verwalters</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$permprop</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Gruppe: &quot;</span> <span style="color: #800080;">$group</span>.SamAccountName <span style="color: #800000;">&quot;Verwalter: &quot;</span> <span style="color: #800080;">$manager</span>.DistinguishedName
		<span style="color: #000000;">&#125;</span> <span style="color: #0000FF;">Else</span> <span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #008000;">#Es müssen die Berechtigungen Read Property _und_ Write Property auf &quot;Member&quot; vorhanden sein</span>
			<span style="color: #800080;">$permright</span> <span style="color: pink;">=</span> <span style="color: #800080;">$permprop</span>.AccessRights
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$permright</span> <span style="color: #FF0000;">-notcontains</span> <span style="color: #800000;">&quot;ReadProperty, WriteProperty&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Gruppe: &quot;</span> <span style="color: #800080;">$group</span>.SamAccountName <span style="color: #800000;">&quot;Verwalter: &quot;</span> <span style="color: #800080;">$manager</span>.DistinguishedName
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p style="text-align: justify;">Hinweise: Die mehrfachenAbfragen get-adpermission sind leider erforderlich, da sonst das Abfrageergebnis nicht verarbeitet werden kann. Das Script wurde in einer Umgebung mit Exchange 2010 SP1 (Beta) erfolgreich getestet. Wer Fehler findet, bitte in den Kommentaren melden. Danke.</p>

<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/152" rel="bookmark" class="wherego_title">Blackberry: Steuercodes in Betreffzeile von E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/992" rel="bookmark" class="wherego_title">Exchange 2010: Empfängerfilter und andere Antispamfunktionen</a></li><li><a href="http://www.roland-ehle.de/archives/845" rel="bookmark" class="wherego_title">Exchange 2010: Zertifikatsanforderung generieren mit New-ExchangeCertificate</a></li><li><a href="http://www.roland-ehle.de/archives/1004" rel="bookmark" class="wherego_title">Am Wochenende ist das Internet leider geschlossen</a></li><li><a href="http://www.roland-ehle.de/archives/909" rel="bookmark" class="wherego_title">Exchange 2010:Disclaimer per Transportregel anhängen</a></li><li><a href="http://www.roland-ehle.de/archives/1122" rel="bookmark" class="wherego_title">BlackBerry Enterprise Server 5.0.2 Single Sign-On konfigurieren</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p> <p><a href="http://www.roland-ehle.de/?flattrss_redirect&amp;id=1149&amp;md5=b4c5dabd970b46c09601e9c468ec7137" title="Flattr" target="_blank"><img src="http://www.roland-ehle.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1149/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange: Verwalter von Verteilergruppen</title>
		<link>http://www.roland-ehle.de/archives/1125</link>
		<comments>http://www.roland-ehle.de/archives/1125#comments</comments>
		<pubDate>Sat, 03 Jul 2010 03:16:19 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Exchange 2003]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[itproblogs.de]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Berechtigungen]]></category>
		<category><![CDATA[Besitzer]]></category>
		<category><![CDATA[Default Role Assignment Policy]]></category>
		<category><![CDATA[Distributiongroup]]></category>
		<category><![CDATA[Managed By]]></category>
		<category><![CDATA[Verteilergruppen]]></category>
		<category><![CDATA[Verwaltet von]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1125</guid>
		<description><![CDATA[Alles wie gehabt? Administratoren, die es gewohnt sind, die Verwaltung einer Exchange Organisation über grafische Oberflächen durchzuführen, müssen beim Einsatz von Exchange 2007 bzw. Exchange 2010 in einigen Bereichen umdenken. Zu den alltäglichen Aufgaben gehört das Festlegen eines Verwalters für Verteilergruppen, dem dadurch zumeist auch die Berechtigungen zugewiesen werden sollen, Mitglieder hinzuzufügen, bzw. wieder zu entfernen. ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1125">Exchange: Verwalter von Verteilergruppen</a></span>]]></description>
			<content:encoded><![CDATA[<h2>Alles wie gehabt?</h2>
<p style="text-align: justify;">Administratoren, die es gewohnt sind, die Verwaltung einer Exchange Organisation über grafische Oberflächen durchzuführen, müssen beim Einsatz von Exchange 2007 bzw. Exchange 2010 in einigen Bereichen umdenken.</p>
<p style="text-align: justify;">Zu den alltäglichen Aufgaben gehört das Festlegen eines Verwalters für Verteilergruppen, dem dadurch zumeist auch die Berechtigungen zugewiesen werden sollen, Mitglieder hinzuzufügen, bzw. wieder zu entfernen.  In Exchange 2003 Umgebungen hat man diese Aufgabe gewöhnlich in der Active Directory Benutzer und Computer Verwaltungskonsole (ADUC) ausgeführt. Wer dies in Exchange 2007 und Exchange 2010 Umgebungen beibehält, braucht nicht umzudenken.</p>
<p style="text-align: justify;">Dabei ist es wichtig zu wissen, dass es hier um zwei verschiedene Dinge geht:</p>
<ul>
<li style="text-align: justify;">die Anzeige des Verwalters in den Eigenschaften der Verteilergruppe im Adressbuch</li>
<li style="text-align: justify;">die Berechtigungen Read Member und Write Member (Mitglieder lesen / Mitglieder schreiben)</li>
</ul>
<p style="text-align: justify;"><span style="color: #ff0000;">Weder über die Exchange 2007 Verwaltungskonsole, noch über die Verwaltungskonsole für Exchange 2010 können die Berechtigungen Read Member bzw. Write Member vergeben werden!<span id="more-1125"></span></span></p>
<h2>Verwalter mit Berechtigungen per ADUC setzen</h2>
<p>In der Active Directory Benutzer und Computer Verwaltungskonsole die Eigenschaften der Verteilergruppe öffnen und den Reiter &#8220;Verwaltet von&#8221; bw. &#8220;Managed By&#8221; auswählen. Durch Klick auf &#8220;Ändern&#8221; und anschließender Auswahl des gewünschten Verwalters wird die Anzeige des Gruppenverwalters im Adressbuch festgelegt. Das Aktivieren der Option &#8220;Vorgesetzter kann Mitgliedsliste ändern&#8221; werden die oben genannten Berechtigungen vergeben.</p>
<p><a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-129.png" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1139" title="Verteilergruppe im ADUC" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-129-263x300.png" alt="" width="263" height="300" /></a></p>
<p>Es kann hier nur ein Verwalter eingetragen werden. Wenn mehrere User die Berechtigungen zur Anpassung des Verteilers benötigen, müssen die Berechtigungen über &#8220;Sicherheit&#8221;, Erweitert hinzugefügt werden (siehe Screenshot)</p>
<p><a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-130.png" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1140" title="Berechtigungen" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-130-239x300.png" alt="" width="239" height="300" /></a></p>
<h2>Verwalter über die Exchange Verwaltungskonsole setzen</h2>
<p>In der Verwaltungskonsole für Exchange kann sowohl unter Exchange 2007 als auch unter Exchange 2010 ein Gruppenverwalter eingetragen werden, der dann im Adressbuch angezeigt wird.</p>
<p>Der Unterschied zwischen Exchange 2007 und Exchange 2010 an dieser Stelle besteht darin, dass bei Exchange 2010 auch mehrere Verwalter eingetragen werden können.</p>
<p><a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-136.png" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1144" title="Verteilergruppe in der Exchange Verwaltungskonsole" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-136-261x300.png" alt="" width="261" height="300" /></a></p>
<h2>Verwalter per Powershell setzen</h2>
<p>Der Powershellbefehl mit dessen Hilfe ein Verwalter definiert werden kann und mit dem gleichzeitig die erforderlichen Berechtigungen gesetzt werden, sieht so aus:</p>
<p>﻿﻿﻿</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;">Set<span style="color: pink;">-</span>DistributionGroup <span style="color: pink;">-</span>Identity verteilername <span style="color: pink;">-</span>ManagedBy username <span style="color: pink;">|</span> add<span style="color: pink;">-</span>adpermission <span style="color: pink;">-</span>user username <span style="color: pink;">-</span>AccessRights ReadProbperty<span style="color: pink;">,</span> WriteProperty <span style="color: pink;">-</span>Properties ‘Member’</pre></div></div>

<h2>Rollenberechtigungen in Exchange 2010</h2>
<p>Durch Anpassung der &#8220;Default Role Assignment Policy&#8221;, die für alle Benutzer gilt, kann man den Anwendern pauschal die Berechtigung zuweisen, alle Verteilergruppen zu bearbeiten, für die sie als Verwalter eingetragen sind.</p>
<p><a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-134.png" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1142" title="Default Role Assignment Policy" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-134-300x217.png" alt="" width="300" height="217" /></a> <a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-133.png" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1143" title="Berechtigungen MyGroups" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-133-277x300.png" alt="" width="277" height="300" /></a></p>
<p>Die Bearbeitung ist dann allerdings nur über die Exchange Systemsteuerung in Outlook Web App möglich. Ein Hinzufügen oder Entfernen von Mitgliedern über das Outlook Adressbuch ist nicht möglich.</p>
<p><a href="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-132.jpg" class="liimagelink" rel="lightbox[1125]"><img class="alignnone size-medium wp-image-1141" title="Anzeige Verteiler die ich besitze" src="http://www.roland-ehle.de/wp-content/uploads/2010/07/sshot-132-300x103.jpg" alt="Anzeige Verteiler die ich besitze" width="300" height="103" /></a></p>
<h2>Fazit</h2>
<p style="text-align: justify;">Auch bei Einsatz von Exchange 2007 und Exchange 2010 bleibt die Active Directory Benutzer und Computer Verwaltungskonsole das Tool, mit dem Verwalter für Gruppen gesetzt werden, sofern man keine Powershell einsetzen möchte.</p>
<p style="text-align: justify;">Bei Exchange 2010 besteht zwar die Möglichkeit, den Anwendern die Berechtigung einzuräumen, Verteiler für die sie als Verwalter/Besitzer eingetragen sind über Outlook Web App verwalten zu können. Ob dies in Umgebungen erfolgreich umgesetzt werden kann, wo Anwender Verteiler bisher über das Outlook Adressbuch  gepflegt haben, bezweifle ich.</p>

<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/992" rel="bookmark" class="wherego_title">Exchange 2010: Empfängerfilter und andere Antispamfunktionen</a></li><li><a href="http://www.roland-ehle.de/archives/152" rel="bookmark" class="wherego_title">Blackberry: Steuercodes in Betreffzeile von E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/1151" rel="bookmark" class="wherego_title">Exchange 2007: Berechtigungen auf Verteilergruppen prüfen</a></li><li><a href="http://www.roland-ehle.de/archives/1137" rel="bookmark" class="wherego_title">BlackBerry: Menüpunkt Enterprise-Aktivierung fehlt</a></li><li><a href="http://www.roland-ehle.de/archives/1004" rel="bookmark" class="wherego_title">Am Wochenende ist das Internet leider geschlossen</a></li><li><a href="http://www.roland-ehle.de/archives/1001" rel="bookmark" class="wherego_title">Update: Exchange 2007 / 2010 &#8211; tägliche Messagingstatistik</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p> <p><a href="http://www.roland-ehle.de/?flattrss_redirect&amp;id=1125&amp;md5=a89b5ca5b53090f82f4604e62230b830" title="Flattr" target="_blank"><img src="http://www.roland-ehle.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1125/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2007: Kontakte mit mehreren primären SMTP-Adressen bereinigen</title>
		<link>http://www.roland-ehle.de/archives/1097</link>
		<comments>http://www.roland-ehle.de/archives/1097#comments</comments>
		<pubDate>Wed, 23 Jun 2010 08:18:23 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[itproblogs.de]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Mail-Contact]]></category>
		<category><![CDATA[multiple primary SMTP addresses]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1097</guid>
		<description><![CDATA[Nach dem Import von Kontakten durch eine Third-Party-Anwendung trat das Problem auf, dass einige dieser Kontakte mehrere primär SMTP-Adressen hatten. Mit folgendem Powershell Code wurden diese Kontakte bereinigt: foreach ($contact in get-mailcontact -resultsize unlimited){ $a = $contact.ExternalEmailAddress.tostring().Remove(0,5); set-mailcontact $contact -primarysmtpaddress $a } Quelle: http://everydaysysadmin.com/posts/2009/01/multiple-primary-smtp-addresses <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1097">Exchange 2007: Kontakte mit mehreren primären SMTP-Adressen bereinigen</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Nach dem Import von Kontakten durch eine Third-Party-Anwendung trat das Problem auf, dass einige dieser Kontakte mehrere primär SMTP-Adressen hatten. Mit folgendem Powershell Code wurden diese Kontakte bereinigt:</p>
<p style="text-align: justify;">

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$contact</span> <span style="color: #0000FF;">in</span> get<span style="color: pink;">-</span>mailcontact <span style="color: pink;">-</span>resultsize unlimited<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$a</span> <span style="color: pink;">=</span> <span style="color: #800080;">$contact</span>.ExternalEmailAddress.tostring<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.Remove<span style="color: #000000;">&#40;</span><span style="color: #804000;">0</span><span style="color: pink;">,</span><span style="color: #804000;">5</span><span style="color: #000000;">&#41;</span>;
set<span style="color: pink;">-</span>mailcontact <span style="color: #800080;">$contact</span> <span style="color: pink;">-</span>primarysmtpaddress <span style="color: #800080;">$a</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Quelle: <a href="http://everydaysysadmin.com/posts/2009/01/multiple-primary-smtp-addresses" title="Multiple Primary SMTP Addresses" target="_blank" class="liexternal">http://everydaysysadmin.com/posts/2009/01/multiple-primary-smtp-addresses</a><br />
</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/1155" rel="bookmark" class="wherego_title">Exchange 2007 / 2010: Senden Als via OWA</a></li><li><a href="http://www.roland-ehle.de/archives/1007" rel="bookmark" class="wherego_title">Exchange 2007: Verteilergruppen-Mitglieder vom Typ E-Mail Kontakt</a></li><li><a href="http://www.roland-ehle.de/archives/1125" rel="bookmark" class="wherego_title">Exchange: Verwalter von Verteilergruppen</a></li><li><a href="http://www.roland-ehle.de/archives/1099" rel="bookmark" class="wherego_title">MAPI Subsystem für BlackBerry Enterprise Server</a></li><li><a href="http://www.roland-ehle.de/archives/1096" rel="bookmark" class="wherego_title">Exchange 2007: Installation Servicepack 3 auf einem Single Copy Cluster</a></li><li><a href="http://www.roland-ehle.de/archives/502" rel="bookmark" class="wherego_title">Exchange 2007: Postfachzugriffe loggen</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p> <p><a href="http://www.roland-ehle.de/?flattrss_redirect&amp;id=1097&amp;md5=1588a5b9b0af508687dc8b97eaa2b173" title="Flattr" target="_blank"><img src="http://www.roland-ehle.de/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1097/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2007: Verteilergruppen-Mitglieder vom Typ E-Mail Kontakt</title>
		<link>http://www.roland-ehle.de/archives/1007</link>
		<comments>http://www.roland-ehle.de/archives/1007#comments</comments>
		<pubDate>Sun, 06 Jun 2010 10:22:37 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[BES]]></category>
		<category><![CDATA[E-Mail Kontakt]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Export]]></category>
		<category><![CDATA[Mitglieder]]></category>
		<category><![CDATA[Verteilergruppen]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1007</guid>
		<description><![CDATA[Wieder eine Aufgabe aus dem echten Leben: Kunde importierte in der Vergangenheit die Exchange-Empfänger eines anderen Unternehmens manuell(!) als Kontakte ins eigene Adressbuch.  In Zukunft soll dies automatisiert mit dem Tool GalSync von Netsec geschehen. Um bei der ersten Synchronisation mit GalSync einen sauberen Stand zu haben, wurde beschlossen, alle bisher vorhandenen Kontakte vor der ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1007">Exchange 2007: Verteilergruppen-Mitglieder vom Typ E-Mail Kontakt</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Wieder eine Aufgabe aus dem echten Leben: Kunde importierte in der Vergangenheit die Exchange-Empfänger eines anderen Unternehmens manuell(!) als Kontakte ins eigene Adressbuch.  In Zukunft soll dies automatisiert mit dem Tool <a href="http://www.netsec.de/de/produkte/galsync/" title="NetSec GalSync" target="_blank" class="liexternal">GalSync</a> von Netsec geschehen.</p>
<p style="text-align: justify;">Um bei der ersten Synchronisation mit GalSync einen sauberen Stand zu haben, wurde beschlossen, alle bisher vorhandenen Kontakte vor der ersten Synchronisation zu entfernen. Nur leider wurden einige dieser Kontakte in der Vergangenheit als Mitglieder zu Verteilergruppen hinzugefügt. Die Aufgabenstellung, die ich dann per Powershell löste, war folgende:<span id="more-1007"></span></p>
<ul>
<li style="text-align: justify;">Alle Kontakte der Firma B herausfinden, die Mitglied in Verteilergruppen sind</li>
<li>Vorbereitung eines Scripts für die automatisierte Wiederaufnahme der Kontakte in die Verteilergruppen</li>
</ul>
<p>Das folgende Script erstellt eine Datei membersadd.ps1, mit deren Hilfe die Kontakte nach der ersten Synchronisation wieder in die Verteilergruppen aufgenommen werden.</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">function</span> get<span style="color: pink;">-</span>orga2members <span style="color: #000000;">&#123;</span>
&nbsp;
<span style="color: #008000;"># Definition der Variablen</span>
<span style="color: #800080;">$final</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$i</span> <span style="color: pink;">=</span> <span style="color: #804000;">1</span>
<span style="color: #800080;">$y</span> <span style="color: pink;">=</span> <span style="color: #804000;">1</span>
&nbsp;
<span style="color: #008000;"># Finde alle Verteilerlisten</span>
<span style="color: #800080;">$dls</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>DistributionGroup
&nbsp;
<span style="color: #008000;"># Führe die folgenden Befehle für jede Verteilerliste aus</span>
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$dl</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$dls</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #008000;"># Zähler um 1 erhöhen</span>
	<span style="color: #800080;">$i</span><span style="color: pink;">++</span>
&nbsp;
	<span style="color: #800080;">$AllContacts</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #800080;">$AllContactsEmail</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
	<span style="color: #008000;"># Prüfe ob Kontakte Mitglieder sind, die @domainpart.tld als Primäre SMTP Adresse haben</span>
	<span style="color: #800080;">$AllContacts</span> <span style="color: pink;">+=</span> Get<span style="color: pink;">-</span>DistributionGroupMember <span style="color: pink;">-</span>Identity <span style="color: #800080;">$dl</span> <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Where-Object</span> <span style="color: #000000;">&#123;</span> <span style="color: #000080;">$_</span>.PrimarySMTPAddress <span style="color: #FF0000;">-match</span> <span style="color: #800000;">&quot;@domainpart.tld&quot;</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> displayName<span style="color: pink;">,</span> PrimarySMTPAddress
&nbsp;
	<span style="color: #008000;"># Wenn der vorhergehende Befehl keinen Treffer hatte, muss auch nichts weiter gemacht werden</span>
	<span style="color: #0000FF;">If</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$AllContacts</span> <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #008000;"># Zähler um 1 erhöhen</span>
		<span style="color: #800080;">$y</span><span style="color: pink;">++</span>
&nbsp;
		<span style="color: #008000;"># Führe folgende Befehle für jeden Kontakt aus</span>
		<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$contact</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$AllContacts</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
&nbsp;
			<span style="color: #800080;">$mail</span> <span style="color: pink;">=</span> <span style="color: #800080;">$contact</span>.PrimarySMTPAddress
&nbsp;
			<span style="color: #008000;"># Hiermit wird der Befehl zusammengestellt, um den Kontakt später wieder in den Verteiler aufzunehmen</span>
			<span style="color: #800080;">$task</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Add-DistributionGroupMember -Identity &quot;</span><span style="color: #800000;">&quot;$dl&quot;</span><span style="color: #800000;">&quot; -Member $mail&quot;</span>
&nbsp;
			<span style="color: #008000;"># Ein bisschen Kontrolle muss sein, deshalb zur Sicherheit</span>
			<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> psObject
			<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Verteilerliste&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$dl</span>
			<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Empfänger Name&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$contact</span>.displayName
			<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Add-Member</span> <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Empfänger Adresse&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$contact</span>.PrimarySMTPAddress
&nbsp;
			<span style="color: #800080;">$AllContactsEmail</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$obj</span>
&nbsp;
			<span style="color: #008000;"># Ausgabe des Befehls in eine Datei, für die spätere Ausführung</span>
			<span style="color: #800080;">$task</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> membersadd.ps1 <span style="color: #008080; font-style: italic;">-encoding</span> default <span style="color: #008080; font-style: italic;">-append</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #800080;">$final</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$AllContactsEmail</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$final</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">export-csv</span> alleverteiler.csv <span style="color: #008080; font-style: italic;">-NoTypeInformation</span> <span style="color: #008080; font-style: italic;">-encoding</span> default
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$i</span> <span style="color: #800000;">&quot; Verteiler gefunden&quot;</span>
<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$y</span> <span style="color: #800000;">&quot; Verteiler müssen angefasst werden&quot;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/1155" rel="bookmark" class="wherego_title">Exchange 2007 / 2010: Senden Als via OWA</a></li><li><a href="http://www.roland-ehle.de/archives/453" rel="bookmark" class="wherego_title">Exchange 2007: Selektiver Umzug von Postfächern per Powershell Script</a></li><li><a href="http://www.roland-ehle.de/archives/1006" rel="bookmark" class="wherego_title">Plural von BlackBerry</a></li><li><a href="http://www.roland-ehle.de/archives/502" rel="bookmark" class="wherego_title">Exchange 2007: Postfachzugriffe loggen</a></li><li><a href="http://www.roland-ehle.de/archives/1149" rel="bookmark" class="wherego_title">Exchange 2010: Berechtigungen auf Verteilergruppen prüfen</a></li><li><a href="http://www.roland-ehle.de/archives/631" rel="bookmark" class="wherego_title">Exchange 2007: Neue unbeschränkte Verteilerliste anlegen</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1007/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Powershell: Kalenderwoche gemäß ISO 8601</title>
		<link>http://www.roland-ehle.de/archives/1003</link>
		<comments>http://www.roland-ehle.de/archives/1003#comments</comments>
		<pubDate>Sat, 05 Jun 2010 01:05:16 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[BES]]></category>
		<category><![CDATA[ISO 5601]]></category>
		<category><![CDATA[Kalenderwoche]]></category>
		<category><![CDATA[Nummer]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1003</guid>
		<description><![CDATA[In der Powershell kann man sich mit folgendem Befehl die Nummer der aktuellen Kalenderwoche ausgeben lassen: get-date -uFormat %V Nur leider entspricht die Ausgabe nicht der Nummerierung der Kalenderwochen gemäß ISO 8601, in der folgende Parameter festgelegt sind: Erster Tag der Woche ist Montag Erste Woche des Jahres (also KW1) ist die erste 4-Tage-Woche In der Powershell hingegen werden ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1003">Powershell: Kalenderwoche gemäß ISO 8601</a></span>]]></description>
			<content:encoded><![CDATA[<p>In der Powershell kann man sich mit folgendem Befehl die Nummer der aktuellen Kalenderwoche ausgeben lassen:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008080; font-weight: bold;">get-date</span> <span style="color: #008080; font-style: italic;">-uFormat</span> <span style="color: pink;">%</span>V</pre></div></div>

<p>Nur leider entspricht die Ausgabe nicht der Nummerierung der Kalenderwochen gemäß ISO 8601, in der folgende Parameter festgelegt sind:</p>
<ul>
<li>Erster Tag der Woche ist Montag</li>
<li>Erste Woche des Jahres (also KW1) ist die erste 4-Tage-Woche</li>
</ul>
<p>In der Powershell hingegen werden andere Parameter für die Bestimmung der Nummer der Kalenderwoche verwendet:</p>
<ul>
<li>Erster Tag der Woche ist Sonntag</li>
<li>Erste Woche des Jahres beginnt am 01.01.<span id="more-1003"></span></li>
</ul>
<p>Wenn man die Kalenderwoche gemäß ISO 8601 benötigt, hilft folgende Funktion,  die für ein übergebenes Datum die Kalenderwoche im Format KWNN/JJJJ ausgibt:</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #0000FF;">function</span> get<span style="color: pink;">-</span>isoweeknumber<span style="color: #000000;">&#40;</span><span style="color: #800080;">$Date</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #008000;"># get the day of week as &amp;lt;Int&amp;gt;</span>
<span style="color: #000000;">&#91;</span><span style="color: #008080;">int</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$dayOfWeek</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Date</span>.DayOfWeek
<span style="color: #008000;"># if 0 (Sunday) change it to 7</span>
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">-not</span> <span style="color: #800080;">$dayOfWeek</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><span style="color: #800080;">$dayOfWeek</span> <span style="color: pink;">=</span> <span style="color: #804000;">7</span><span style="color: #000000;">&#125;</span>
<span style="color: #008000;"># adjust date to nearest Thursday (middle of the week), past or future</span>
<span style="color: #800080;">$midWeek</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Date</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: #804000;">4</span> <span style="color: pink;">-</span> <span style="color: #800080;">$dayOfWeek</span><span style="color: #000000;">&#41;</span>
<span style="color: #008000;"># year the week belongs to</span>
<span style="color: #800080;">$year</span> <span style="color: pink;">=</span> <span style="color: #800080;">$midWeek</span>.year
<span style="color: #008000;"># week number</span>
<span style="color: #800080;">$week</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>Math<span style="color: #000000;">&#93;</span>::Ceiling<span style="color: #000000;">&#40;</span><span style="color: #800080;">$midWeek</span>.DayOfYear <span style="color: pink;">/</span> <span style="color: #804000;">7</span><span style="color: #000000;">&#41;</span>
<span style="color: #008000;"># output the ISO week date</span>
<span style="color: #800000;">'KW{0:00}/{1:0000}'</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$week</span><span style="color: pink;">,</span> <span style="color: #800080;">$year</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Fundstelle:<a href=" http://robertrobelo.spaces.live.com/blog/cns!1D7FE2F4A61D31E1!284.entry" title="ISO 8601 week date" target="_blank" class="liinternal"> http://robertrobelo.spaces.live.com/blog/cns!1D7FE2F4A61D31E1!284.entry</a></p>
<p>Informationen zum Thema Outlook und Kalenderwoche:  <a href="http://www.roland-ehle.de/archives/354" title="Outlook: Nummer der Kalenderwoche im Kalender" target="_blank" class="liinternal">http://www.roland-ehle.de/archives/354</a><br />
</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/760" rel="bookmark" class="wherego_title">Powershell: Gruppenmitgliedschaften (memberof) auflisten</a></li><li><a href="http://www.roland-ehle.de/archives/939" rel="bookmark" class="wherego_title">Exchange 2010: Getrenntes Postfach löschen</a></li><li><a href="http://www.roland-ehle.de/archives/1002" rel="bookmark" class="wherego_title">Lessons learnt Powershell 1.0</a></li><li><a href="http://www.roland-ehle.de/archives/764" rel="bookmark" class="wherego_title">Zustellbestätigung für per Powershell versendete E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/354" rel="bookmark" class="wherego_title">Outlook: Nummer der Kalenderwoche im Kalender</a></li><li><a href="http://www.roland-ehle.de/archives/1004" rel="bookmark" class="wherego_title">Am Wochenende ist das Internet leider geschlossen</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1003/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update: Exchange 2007 / 2010 &#8211; tägliche Messagingstatistik</title>
		<link>http://www.roland-ehle.de/archives/1001</link>
		<comments>http://www.roland-ehle.de/archives/1001#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:18:57 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Message Tracking Logs]]></category>
		<category><![CDATA[Messagingstatistik]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Statistik]]></category>
		<category><![CDATA[Transportserver]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=1001</guid>
		<description><![CDATA[Das hier veröffentliche Script zur Erstellung und dem Versand einer täglichen Messagingstatistik habe ich nochmals erweitert. In dieser Version werden zusätzlich folgende Informationen ausgegeben: Volumen der größten versendeten E-Mail durchschnittliche E-Mail-Größe (Out) Volumen der größten empfangenen E-Mail durchschnittliche E-Mail-Größe (In) $hubs = Get-TransportServer # Get the start date for the tracking log search $Start = (Get-Date -Hour 00 -Minute 00 -Second ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/1001">Update: Exchange 2007 / 2010 &#8211; tägliche Messagingstatistik</a></span>]]></description>
			<content:encoded><![CDATA[<p>Das <a href="http://www.roland-ehle.de/archives/997" title="Tägliche Messagingstatistik" target="_blank" class="liinternal">hier</a> veröffentliche Script zur Erstellung und dem Versand einer täglichen Messagingstatistik habe ich nochmals erweitert. In dieser Version werden zusätzlich folgende Informationen ausgegeben:</p>
<ul>
<li>Volumen der größten versendeten E-Mail</li>
<li>durchschnittliche E-Mail-Größe (Out)</li>
<li>Volumen der größten empfangenen E-Mail</li>
<li>durchschnittliche E-Mail-Größe (In)</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$hubs</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>TransportServer
&nbsp;
<span style="color: #008000;"># Get the start date for the tracking log search</span>
<span style="color: #800080;">$Start</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #008080; font-style: italic;">-Hour</span> 00 <span style="color: #008080; font-style: italic;">-Minute</span> 00 <span style="color: #008080; font-style: italic;">-Second</span> 00<span style="color: #000000;">&#41;</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Get the end date for the tracking log search</span>
<span style="color: #800080;">$End</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #008080; font-style: italic;">-Hour</span> <span style="color: #804000;">23</span> <span style="color: #008080; font-style: italic;">-Minute</span> <span style="color: #804000;">59</span> <span style="color: #008080; font-style: italic;">-Second</span> <span style="color: #804000;">59</span><span style="color: #000000;">&#41;</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$Datum</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Start</span>.ToShortDateString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$receive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hubs</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>messagetrackinglog <span style="color: #008080; font-style: italic;">-Start</span> <span style="color: #800080;">$Start</span> <span style="color: #008080; font-style: italic;">-End</span> <span style="color: #800080;">$End</span> <span style="color: pink;">-</span>EventID <span style="color: #800000;">&quot;RECEIVE&quot;</span> <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> Sender<span style="color: pink;">,</span>RecipientCount<span style="color: pink;">,</span>TotalBytes<span style="color: pink;">,</span>Recipients
<span style="color: #800080;">$send</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hubs</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>messagetrackinglog <span style="color: #008080; font-style: italic;">-Start</span> <span style="color: #800080;">$Start</span> <span style="color: #008080; font-style: italic;">-End</span> <span style="color: #800080;">$End</span> <span style="color: pink;">-</span>EventID <span style="color: #800000;">&quot;SEND&quot;</span> <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> Sender<span style="color: pink;">,</span>RecipientCount<span style="color: pink;">,</span>TotalBytes
<span style="color: #800080;">$mreceive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$receive</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> TotalBytes <span style="color: #008080; font-style: italic;">-maximum</span> <span style="color: #008080; font-style: italic;">-minimum</span> <span style="color: #008080; font-style: italic;">-average</span> <span style="color: #008080; font-style: italic;">-sum</span>
<span style="color: #800080;">$msend</span> <span style="color: pink;">=</span> <span style="color: #800080;">$send</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> TotalBytes <span style="color: #008080; font-style: italic;">-maximum</span> <span style="color: #008080; font-style: italic;">-minimum</span> <span style="color: #008080; font-style: italic;">-average</span> <span style="color: #008080; font-style: italic;">-sum</span>
&nbsp;
<span style="color: #800080;">$anzahl</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.count <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.count
<span style="color: #800080;">$volumen</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$mreceive</span>.sum <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.sum<span style="color: #000000;">&#41;</span> <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$volumen</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$volumen</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
&nbsp;
<span style="color: #800080;">$msendmb</span> <span style="color: pink;">=</span> <span style="color: #800080;">$msend</span>.sum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$vsend</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$msendmb</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
<span style="color: #800080;">$bigsend</span> <span style="color: pink;">=</span> <span style="color: #800080;">$msend</span>.maximum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$avsend</span> <span style="color: pink;">=</span> <span style="color: #800080;">$msend</span>.average <span style="color: pink;">/</span> <span style="color: #804000;">1024</span>
&nbsp;
<span style="color: #800080;">$bigsendmb</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$bigsend</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
<span style="color: #800080;">$avsendkb</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$avsend</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; KB&quot;</span>
&nbsp;
<span style="color: #800080;">$mreceivemb</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.sum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$vreceive</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$mreceivemb</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
<span style="color: #800080;">$bigreceive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.maximum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$avreceive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.average <span style="color: pink;">/</span> <span style="color: #804000;">1024</span>
&nbsp;
<span style="color: #800080;">$bigreceivemb</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$bigreceive</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
<span style="color: #800080;">$avreceivekb</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$avreceive</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; KB&quot;</span>
&nbsp;
<span style="color: #008000;">#$senders = $send | Group-Object Sender | Sort-Object Count -Descending</span>
<span style="color: #008000;">#$topsender = $senders[0].Name</span>
<span style="color: #008000;">#$topsender += $senders[0].Count</span>
&nbsp;
<span style="color: #008000;">#$receivers = $receive | Group-Object Recipients | Sort-Object Count -Descending</span>
<span style="color: #008000;">#$topreceiver = $receivers[0]</span>
<span style="color: #008000;">#$topreceiver</span>
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> psObject
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Datum&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$Datum</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Anzahl Gesendete E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$msend</span>.Count
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Gesendete E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$vsend</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen der größten E-Mail Out&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$bigsendmb</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Durchschnittliche Größe Out&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$avsendkb</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Anzahl Empfangene E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$mreceive</span>.Count
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Empfangene E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$vreceive</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen der größten E-Mail In&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$bigreceivemb</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Durchschnittliche Größe In&quot;</span> <span style="color: #008080; font-style: italic;">-value</span> <span style="color: #800080;">$avreceivekb</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Gesamtanzahl&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$anzahl</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Gesamt&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$volumen</span>
&nbsp;
<span style="color: #800080;">$out</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Datum</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.count <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vsend</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$mreceive</span>.count <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vreceive</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$anzahl</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$volumen</span>
<span style="color: #800080;">$out</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> c:\daily.csv <span style="color: #008080; font-style: italic;">-append</span> <span style="color: #008080; font-style: italic;">-encoding</span> default
&nbsp;
<span style="color: #0000FF;">function</span> sendmail<span style="color: #000000;">&#40;</span><span style="color: #800080;">$body</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$SmtpClient</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> system.net.mail.smtpClient
<span style="color: #800080;">$MailMessage</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.net.mail.mailmessage
<span style="color: #800080;">$SmtpClient</span>.Host <span style="color: pink;">=</span> <span style="color: #800000;">&quot;mailserver.domain.local&quot;</span>
<span style="color: #800080;">$mailmessage</span>.from <span style="color: pink;">=</span> <span style="color: #800000;">&quot;sender@domain.tld&quot;</span>
<span style="color: #800080;">$mailmessage</span>.To.add<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;recipient@domain.tld&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$mailmessage</span>.CC.add<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;recipient@domain.tld&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$mailmessage</span>.Subject <span style="color: pink;">=</span> “Exchange daily report <span style="color: #0000FF;">for</span> <span style="color: #800080;">$Datum</span>”
<span style="color: #800080;">$MailMessage</span>.IsBodyHtml <span style="color: pink;">=</span> <span style="color: #800080;">$false</span>
<span style="color: #800080;">$mailmessage</span>.Body <span style="color: pink;">=</span> <span style="color: #800080;">$body</span>
&nbsp;
<span style="color: #800080;">$smtpclient</span>.Send<span style="color: #000000;">&#40;</span><span style="color: #800080;">$mailmessage</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;@{&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;=&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;; &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;}&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
sendmail $obj</pre></div></div>


<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/267" rel="bookmark" class="wherego_title">Blackberry: Gerät auf Werkseinstellungen zurücksetzen</a></li><li><a href="http://www.roland-ehle.de/archives/867" rel="bookmark" class="wherego_title">Exchange 2010: Zertifikat importieren und aktivieren</a></li><li><a href="http://www.roland-ehle.de/archives/1016" rel="bookmark" class="wherego_title">Projekt: Überwachung BlackBerry Enterprise Server mit Nagios &#8211; OIDs</a></li><li><a href="http://www.roland-ehle.de/archives/1004" rel="bookmark" class="wherego_title">Am Wochenende ist das Internet leider geschlossen</a></li><li><a href="http://www.roland-ehle.de/archives/845" rel="bookmark" class="wherego_title">Exchange 2010: Zertifikatsanforderung generieren mit New-ExchangeCertificate</a></li><li><a href="http://www.roland-ehle.de/archives/909" rel="bookmark" class="wherego_title">Exchange 2010:Disclaimer per Transportregel anhängen</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/1001/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Exchange 2007 / Exchange 2010: Täglicher Report über Messagestatistik</title>
		<link>http://www.roland-ehle.de/archives/997</link>
		<comments>http://www.roland-ehle.de/archives/997#comments</comments>
		<pubDate>Mon, 24 May 2010 23:40:35 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[BES]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[MessageTrackingLog]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Statistik]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=997</guid>
		<description><![CDATA[Nach langer Zeit wieder ein Artikel. Die Statistiker freuen sich, wenn sie immer mit Zahlen und Auswertungen "gefüttert" werden. Mit dem folgenden Powershell-Script kann eine Messagestatistik für eine Exchange 2007 Umgebung erstellt werden, die folgende Daten des Vortages enthält: Anzahl gesendeter E-Mails Volumen der gesendeten E-Mail Anzahl empfangener E-Mails Volumen der empfangenen E-Mails Gesamtanzahl der E-Mails Gesamtvolumen Wier immer bei meinen ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/997">Exchange 2007 / Exchange 2010: Täglicher Report über Messagestatistik</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Nach langer Zeit wieder ein Artikel. Die Statistiker freuen sich, wenn sie immer mit Zahlen und Auswertungen &#8220;gefüttert&#8221; werden. Mit dem folgenden Powershell-Script kann eine Messagestatistik für eine Exchange 2007 Umgebung erstellt werden, die folgende Daten des Vortages enthält:</p>
<ul>
<li style="text-align: justify;">Anzahl gesendeter E-Mails</li>
<li>Volumen der gesendeten E-Mail</li>
<li>Anzahl empfangener E-Mails</li>
<li>Volumen der empfangenen E-Mails</li>
<li>Gesamtanzahl der E-Mails</li>
<li>Gesamtvolumen</li>
</ul>
<p style="text-align: justify;">Wier immer bei meinen Powershell-Ergüssen gilt: Script wurde in einer produktiven Umgebung erfolgreich getestet, und mir ist bewußt, dass man es sicherlich besser machen kann. Das Ergebnis der Auswertung wird in einer Textdatei für eine spätere Gesamtauswertung abgelegt und per E-Mail versendet.<span id="more-997"></span></p>
<p style="text-align: justify;">Die E-Mail sieht dann wie folgt aus:</p>
<blockquote><p>Datum: 24.05.2010<br />
Anzahl Gesendete E-Mails:        336<br />
Volumen Gesendete E-Mails:   60,08 MB<br />
Anzahl Empfangene E-Mails:     1189<br />
Volumen Empfangene E-Mails:                185,85 MB<br />
Gesamtanzahl: 1525<br />
Volumen Gesamt:          245,93 MB</p></blockquote>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$hubs</span> <span style="color: pink;">=</span> Get<span style="color: pink;">-</span>TransportServer
&nbsp;
<span style="color: #008000;"># Get the start date for the tracking log search</span>
<span style="color: #800080;">$Start</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #008080; font-style: italic;">-Hour</span> 00 <span style="color: #008080; font-style: italic;">-Minute</span> 00 <span style="color: #008080; font-style: italic;">-Second</span> 00<span style="color: #000000;">&#41;</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #008000;"># Get the end date for the tracking log search</span>
<span style="color: #800080;">$End</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #008080; font-weight: bold;">Get-Date</span> <span style="color: #008080; font-style: italic;">-Hour</span> <span style="color: #804000;">23</span> <span style="color: #008080; font-style: italic;">-Minute</span> <span style="color: #804000;">59</span> <span style="color: #008080; font-style: italic;">-Second</span> <span style="color: #804000;">59</span><span style="color: #000000;">&#41;</span>.AddDays<span style="color: #000000;">&#40;</span><span style="color: pink;">-</span><span style="color: #804000;">1</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$Datum</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Start</span>.ToShortDateString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$receive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hubs</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>messagetrackinglog <span style="color: #008080; font-style: italic;">-Start</span> <span style="color: #800080;">$Start</span> <span style="color: #008080; font-style: italic;">-End</span> <span style="color: #800080;">$End</span> <span style="color: pink;">-</span>EventID <span style="color: #800000;">&quot;RECEIVE&quot;</span> <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> Sender<span style="color: pink;">,</span>RecipientCount<span style="color: pink;">,</span>TotalBytes<span style="color: pink;">,</span>Recipients
<span style="color: #800080;">$send</span> <span style="color: pink;">=</span> <span style="color: #800080;">$hubs</span> <span style="color: pink;">|</span> get<span style="color: pink;">-</span>messagetrackinglog <span style="color: #008080; font-style: italic;">-Start</span> <span style="color: #800080;">$Start</span> <span style="color: #008080; font-style: italic;">-End</span> <span style="color: #800080;">$End</span> <span style="color: pink;">-</span>EventID <span style="color: #800000;">&quot;SEND&quot;</span> <span style="color: pink;">-</span>ResultSize Unlimited <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> Sender<span style="color: pink;">,</span>RecipientCount<span style="color: pink;">,</span>TotalBytes
<span style="color: #800080;">$mreceive</span> <span style="color: pink;">=</span> <span style="color: #800080;">$receive</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> TotalBytes <span style="color: #008080; font-style: italic;">-maximum</span> <span style="color: #008080; font-style: italic;">-minimum</span> <span style="color: #008080; font-style: italic;">-average</span> <span style="color: #008080; font-style: italic;">-sum</span>
<span style="color: #800080;">$msend</span> <span style="color: pink;">=</span> <span style="color: #800080;">$send</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">Measure-Object</span> TotalBytes <span style="color: #008080; font-style: italic;">-maximum</span> <span style="color: #008080; font-style: italic;">-minimum</span> <span style="color: #008080; font-style: italic;">-average</span> <span style="color: #008080; font-style: italic;">-sum</span>
&nbsp;
<span style="color: #800080;">$anzahl</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.count <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.count
<span style="color: #800080;">$volumen</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$mreceive</span>.sum <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.sum<span style="color: #000000;">&#41;</span> <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$volumen</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$volumen</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
&nbsp;
<span style="color: #800080;">$msendmb</span> <span style="color: pink;">=</span> <span style="color: #800080;">$msend</span>.sum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$vsend</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$msendmb</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
&nbsp;
<span style="color: #800080;">$mreceivemb</span> <span style="color: pink;">=</span> <span style="color: #800080;">$mreceive</span>.sum <span style="color: pink;">/</span> <span style="color: #000000;">&#40;</span><span style="color: #804000;">1024</span> <span style="color: pink;">*</span> <span style="color: #804000;">1024</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$vreceive</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;{0:N2}&quot;</span> <span style="color: #FF0000;">-f</span> <span style="color: #800080;">$mreceivemb</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; MB&quot;</span>
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> psObject
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Datum&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$Datum</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Anzahl Gesendete E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$msend</span>.Count
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Gesendete E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$vsend</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Anzahl Empfangene E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$mreceive</span>.Count
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Empfangene E-Mails&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$vreceive</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Gesamtanzahl&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$anzahl</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">|</span>Add<span style="color: pink;">-</span>Member <span style="color: #008080; font-style: italic;">-MemberType</span> noteproperty <span style="color: #008080; font-style: italic;">-Name</span> <span style="color: #800000;">&quot;Volumen Gesamt&quot;</span> <span style="color: #008080; font-style: italic;">-Value</span> <span style="color: #800080;">$volumen</span>
&nbsp;
<span style="color: #800080;">$out</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Datum</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$msend</span>.count <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vsend</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$mreceive</span>.count <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$vreceive</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$anzahl</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$volumen</span>
<span style="color: #800080;">$out</span> <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">out<span style="color: #FF0000;">-file</span></span> c:\daily.csv <span style="color: #008080; font-style: italic;">-append</span> <span style="color: #008080; font-style: italic;">-encoding</span> default
&nbsp;
<span style="color: #0000FF;">function</span> sendmail<span style="color: #000000;">&#40;</span><span style="color: #800080;">$body</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #800080;">$SmtpClient</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> system.net.mail.smtpClient
<span style="color: #800080;">$MailMessage</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> system.net.mail.mailmessage
<span style="color: #800080;">$SmtpClient</span>.Host <span style="color: pink;">=</span> <span style="color: #800000;">&quot;mailserver.domain.local&quot;</span>
<span style="color: #800080;">$mailmessage</span>.from <span style="color: pink;">=</span> <span style="color: #800000;">&quot;sender@domain.tld&quot;</span>
<span style="color: #800080;">$mailmessage</span>.To.add<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;recipient@domain.tld&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$mailmessage</span>.CC.add<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;recipient@domain.tld&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$mailmessage</span>.Subject <span style="color: pink;">=</span> “Exchange daily report <span style="color: #0000FF;">for</span> <span style="color: #800080;">$Datum</span>”
<span style="color: #800080;">$MailMessage</span>.IsBodyHtml <span style="color: pink;">=</span> <span style="color: #800080;">$false</span>
<span style="color: #800080;">$mailmessage</span>.Body <span style="color: pink;">=</span> <span style="color: #800080;">$body</span>
&nbsp;
<span style="color: #800080;">$smtpclient</span>.Send<span style="color: #000000;">&#40;</span><span style="color: #800080;">$mailmessage</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;@{&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;=&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;:<span style="color: #008080; font-weight: bold;">`t</span>&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;; &quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$obj</span> <span style="color: pink;">=</span> <span style="color: #800080;">$obj</span> <span style="color: #FF0000;">-replace</span><span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;}&quot;</span><span style="color: pink;">,</span><span style="color: #800000;">&quot;<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span><span style="color: #000000;">&#41;</span>
&nbsp;
sendmail $obj</pre></div></div>

<p style="text-align: justify;">Will man das Powershell Script als Scheduled Task (Geplante Aufgabe) täglich ausführen, dann geht das am einfachsten über eine Batchdatei:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">start C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile &quot;D:\Exchange\bin\exshell.psc1&quot; -command &quot;. 'D:\Auto_Scripts\daily-report.ps1'&quot;
&nbsp;
<span style="color: #00b100; font-weight: bold;">exit</span></pre></div></div>

<p style="text-align: justify;">Nachtrag: Das Script läuft auch unter Exchange 2010, nur muss der Aufruf in der Batchdatei etwas anders aussehen:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command &quot;. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; D:\Auto_Scripts\daily-report.ps1&quot;
<span style="color: #00b100; font-weight: bold;">Exit</span></pre></div></div>


<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/152" rel="bookmark" class="wherego_title">Blackberry: Steuercodes in Betreffzeile von E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/992" rel="bookmark" class="wherego_title">Exchange 2010: Empfängerfilter und andere Antispamfunktionen</a></li><li><a href="http://www.roland-ehle.de/archives/1155" rel="bookmark" class="wherego_title">Exchange 2007 / 2010: Senden Als via OWA</a></li><li><a href="http://www.roland-ehle.de/archives/1016" rel="bookmark" class="wherego_title">Projekt: Überwachung BlackBerry Enterprise Server mit Nagios &#8211; OIDs</a></li><li><a href="http://www.roland-ehle.de/archives/825" rel="bookmark" class="wherego_title">Exchange 2010: Moderierte Verteilerlisten</a></li><li><a href="http://www.roland-ehle.de/archives/994" rel="bookmark" class="wherego_title">Links</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/997/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Exchange 2010:Disclaimer per Transportregel anhängen</title>
		<link>http://www.roland-ehle.de/archives/909</link>
		<comments>http://www.roland-ehle.de/archives/909#comments</comments>
		<pubDate>Fri, 22 Jan 2010 19:22:39 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Disclaimer]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[formatieren]]></category>
		<category><![CDATA[Transportregel]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=909</guid>
		<description><![CDATA[Im Artikel Änderung bei den Transportregeln habe ich mich dazu verleiten lassen, eine Aussage zu machen, ohne vorher nochmals in die Hilfe geschaut zu haben. Danke @Frank Carius für den Hinweis. Die Aussage, dass der Text des Disclaimer nicht mehr formatiert werden kann, ist falsch, korrekt ist, dass der Text nicht mehr über die Exchange ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/909">Exchange 2010:Disclaimer per Transportregel anhängen</a></span>]]></description>
			<content:encoded><![CDATA[<p>Im Artikel <a href="http://www.roland-ehle.de/archives/905" title="Änderung bei Transportregeln" target="_blank" class="liinternal">Änderung bei den Transportregeln</a> habe ich mich dazu verleiten lassen, eine Aussage zu machen, ohne vorher nochmals in die Hilfe geschaut zu haben. Danke @Frank Carius für den Hinweis.</p>
<p>Die Aussage, dass der Text des Disclaimer nicht mehr formatiert werden kann, ist falsch, korrekt ist, dass der Text nicht mehr über die Exchange Verwaltungskonsole formatiert werden kann, sondern nur per Powershell. Ein neuer Disclaimer wird per Powershell wie folgt angelegt:</p>
<blockquote><p>New-TransportRule -Name ExternalDisclaimer -Enabled $true -SentToScope &#8216;NotInOrganization&#8217; -ApplyHtmlDisclaimerLocation &#8216;Append&#8217; -ApplyHtmlDisclaimerText &#8220;&lt;h3&gt;Disclaimer Title&lt;/h3&gt;&lt;p&gt;This is the disclaimer text.&lt;/p&gt;&#8221; -ApplyHtmlDisclaimerFallbackAction Wrap</p></blockquote>
<p>Etwas HTML-Syntax Know-How ist hierbei gefragt, um den Text ordentlich zu formatierten.</p>
<p>Quelle:<a href="http://technet.microsoft.com/de-de/library/dd876914.aspx" title="Konfigurieren einer Verzichtserklärung" target="_blank" class="liexternal"> http://technet.microsoft.com/de-de/library/dd876914.aspx</a><br />
</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/1016" rel="bookmark" class="wherego_title">Projekt: Überwachung BlackBerry Enterprise Server mit Nagios &#8211; OIDs</a></li><li><a href="http://www.roland-ehle.de/archives/1125" rel="bookmark" class="wherego_title">Exchange: Verwalter von Verteilergruppen</a></li><li><a href="http://www.roland-ehle.de/archives/1102" rel="bookmark" class="wherego_title">Redesign vorerst abgeschlossen und Umfrage</a></li><li><a href="http://www.roland-ehle.de/archives/905" rel="bookmark" class="wherego_title">Exchange 2010: Änderung bei den Transportregeln</a></li><li><a href="http://www.roland-ehle.de/archives/1001" rel="bookmark" class="wherego_title">Update: Exchange 2007 / 2010 &#8211; tägliche Messagingstatistik</a></li><li><a href="http://www.roland-ehle.de/archives/911" rel="bookmark" class="wherego_title">Exchange 2007/2010: Erste Hilfe</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/909/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Powershell: Umgang mit null-valued expression</title>
		<link>http://www.roland-ehle.de/archives/893</link>
		<comments>http://www.roland-ehle.de/archives/893#comments</comments>
		<pubDate>Fri, 15 Jan 2010 22:01:28 +0000</pubDate>
		<dc:creator>Roland</dc:creator>
				<category><![CDATA[Codeschnipsel]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[null-valued expression]]></category>

		<guid isPermaLink="false">http://www.roland-ehle.de/?p=893</guid>
		<description><![CDATA[Wenn man Abfrageergebnisse mittels Powershell weiterverarbeiten möchte, stößt man auf Probleme, sobald die Abfrage keinen Wert ergeben hat. Praktisches Beispiel: Abfrage der Mailboxgrößen mit get-mailboxstatistics. Will man die Werte per value.ToMB() in Megabyte umrechnen, erhält man die Fehlermeldung: "You cannot call a method on a null-valued expression." Lösung: Vor der Umrechnung muss geprüft werden, ob ein ... <span style="color:#777"> . . . &#8594; Mehr: <a href="http://www.roland-ehle.de/archives/893">Powershell: Umgang mit null-valued expression</a></span>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Wenn man Abfrageergebnisse mittels Powershell weiterverarbeiten möchte, stößt man auf Probleme, sobald die Abfrage keinen Wert ergeben hat. Praktisches Beispiel: Abfrage der Mailboxgrößen mit get-mailboxstatistics. Will man die Werte per value.ToMB() in Megabyte umrechnen, erhält man die Fehlermeldung: &#8220;You cannot call a method on a null-valued expression.&#8221;</p>
<p style="text-align: justify;"><strong>Lösung:</strong></p>
<p style="text-align: justify;">Vor der Umrechnung muss geprüft werden, ob ein Wert vorhanden ist. Dabei kann man auf die eingebaute Variable $Null zurückgreifen, also:</p>
<p style="text-align: justify;">if  ($mb.TotalItemSize -eq $Null)  {<br />
Anweisung<br />
} Else {<br />
Anweisung<br />
}</p>

<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://www.roland-ehle.de/archives/764" rel="bookmark" class="wherego_title">Zustellbestätigung für per Powershell versendete E-Mails</a></li><li><a href="http://www.roland-ehle.de/archives/1004" rel="bookmark" class="wherego_title">Am Wochenende ist das Internet leider geschlossen</a></li><li><a href="http://www.roland-ehle.de/archives/1003" rel="bookmark" class="wherego_title">Powershell: Kalenderwoche gemäß ISO 8601</a></li><li><a href="http://www.roland-ehle.de/archives/760" rel="bookmark" class="wherego_title">Powershell: Gruppenmitgliedschaften (memberof) auflisten</a></li><li><a href="http://www.roland-ehle.de/archives/1155" rel="bookmark" class="wherego_title">Exchange 2007 / 2010: Senden Als via OWA</a></li><li><a href="http://www.roland-ehle.de/archives/453" rel="bookmark" class="wherego_title">Exchange 2007: Selektiver Umzug von Postfächern per Powershell Script</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div><p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.roland-ehle.de/archives/893/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

