<?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>独居Server Core &#187; Powershell</title>
	<atom:link href="http://www.svrcore.com/category/script/powershell/feed" rel="self" type="application/rss+xml" />
	<link>http://www.svrcore.com</link>
	<description>Power Microsoft Technology ... ...</description>
	<lastBuildDate>Wed, 31 Aug 2011 06:21:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Changing the scope so you can view the entire domain in Powershell</title>
		<link>http://www.svrcore.com/changing-the-scope-so-you-can-view-the-entire-domain-in-powershell.html</link>
		<comments>http://www.svrcore.com/changing-the-scope-so-you-can-view-the-entire-domain-in-powershell.html#comments</comments>
		<pubDate>Wed, 13 Jul 2011 08:15:53 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange 2010]]></category>

		<guid isPermaLink="false">http://www.svrcore.com/changing-the-scope-so-you-can-view-the-entire-domain-in-powershell.html</guid>
		<description><![CDATA[The requested search root domain.local/Users’ is not within the scope of this operation. Cannot perform searches [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Exchange 2007批量修改用户邮箱的属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Exchange 2007批量修改用户邮箱的属性</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="下载Exchange Server 2010 SP1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdownload-exchange-server-2010-sp1.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093916.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">下载Exchange Server 2010 SP1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>The requested search root domain.local/Users’ is not within the scope of this operation. Cannot perform searches outside the scope ‘child.domain.local’.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:028f6230-b42c-4199-8fcc-5a71ecfc309a" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">2007 = $AdminSessionADSettings.ViewEntireForest = $true

2010 = Set-AdServerSettings -ViewEntireForest $True
</pre>
</div>
<p>or use –ignonreDefaultScope on the command if applicable, i.e. </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c6c91d26-b6c2-4885-b018-c8f9f373dd5d" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">get-mailbox –ignonreDefaultScope</pre>
</div>
<p><a href="http://technet.microsoft.com/en-us/library/bb124527.aspx">http://technet.microsoft.com/en-us/library/bb124527.aspx</a></p>
<p><strong>How can this be made permanent ?</strong></p>
<p>you could add it to the personal EMS startup</p>
<p>Default Location:<br />
  <br />My Documents\WindowsPowerShell\profile.ps1</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Exchange 2007批量修改用户邮箱的属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Exchange 2007批量修改用户邮箱的属性</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="下载Exchange Server 2010 SP1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdownload-exchange-server-2010-sp1.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093916.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">下载Exchange Server 2010 SP1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.svrcore.com/changing-the-scope-so-you-can-view-the-entire-domain-in-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error log: SRMSVC 12306 in FSRM 2008 R2</title>
		<link>http://www.svrcore.com/error-log-srmsvc-12306-in-fsrm-2008-r2.html</link>
		<comments>http://www.svrcore.com/error-log-srmsvc-12306-in-fsrm-2008-r2.html#comments</comments>
		<pubDate>Thu, 20 Jan 2011 06:13:11 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[File Server]]></category>
		<category><![CDATA[Server 2008 R2]]></category>

		<guid isPermaLink="false">http://www.svrcore.com/error-log-srmsvc-12306-in-fsrm-2008-r2.html</guid>
		<description><![CDATA[A File Server Resource Manager Service email action could not be run. Error-specific details: &#160;&#160; Error: [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Windows Server 2008 R2的DFS及其新特性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fwindows-server-2008-r2s-dfs-and-its-new-features.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows Server 2008 R2的DFS及其新特性</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="更新Hyper-v Server 2008 R2 到 Service Pack 1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fupdate-hyper-v-server-2008-r2-to-service-pack-1.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">更新Hyper-v Server 2008 R2 到 Service Pack 1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="在windows server 2008中如何使用可靠性监视程序" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fin-the-windows-server-2008-how-to-use-the-reliability-monitor.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在windows server 2008中如何使用可靠性监视程序</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="下载Exchange Server 2010 SP1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdownload-exchange-server-2010-sp1.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093916.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">下载Exchange Server 2010 SP1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="一些文件不能被DFS复制？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdfs-can-not-be-copied-some-files.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/04/25/6462730.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">一些文件不能被DFS复制？</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>A File Server Resource Manager Service email action could not be run. </p>
<p>Error-specific details:    <br />&#160;&#160; Error: IFsrmEmailExternal::SendMail, 0x8004531c, Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender</p>
<p><a href="http://www.svrcore.com/images/Newblog/03340f2f0c78_9FB9/FSRM-SRMSVC-12306.jpg" rel="fancybox" title="FSRM-SRMSVC-12306"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="FSRM-SRMSVC-12306" border="0" alt="FSRM-SRMSVC-12306" src="http://www.svrcore.com/images/Newblog/03340f2f0c78_9FB9/FSRM-SRMSVC-12306_thumb.jpg" width="600" height="419" /></a></p>
<p>Leo最近在做文件服务器从2003向2008R2迁移的工作，2008 R2环境搭建好后，发现SMTP配置时，测试不通过。在Event log里出现SRMSVC 12306错误。</p>
<p><span id="more-350"></span></p>
<p>在Exchange HUB上可以找到以下的log记录：</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:418da5e7-ac27-4011-911b-24973092b050" class="wlWriterEditableSmartContent">
<pre class="brush: xml;collapse:true;">2011-01-20T02:38:48.637Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,0,10.200.1.39:25,10.88.1.30:49990,+,,
2011-01-20T02:38:48.637Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,1,10.200.1.39:25,10.88.1.30:49990,*,SMTPSubmit SMTPAcceptAnySender SMTPAcceptAuthoritativeDomainSender AcceptRoutingHeaders,Set Session Permissions
2011-01-20T02:38:48.637Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,2,10.200.1.39:25,10.88.1.30:49990,>,"220 ExchangHUB.Svrcorechina.com Microsoft ESMTP MAIL Service ready at Thu, 20 Jan 2011 10:38:47 +0800",
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,3,10.200.1.39:25,10.88.1.30:49990,<,EHLO Filsrv2008r2,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,4,10.200.1.39:25,10.88.1.30:49990,>,250-ExchangHUB.Svrcorechina.com Hello [10.88.1.30],
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,5,10.200.1.39:25,10.88.1.30:49990,>,250-SIZE,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,6,10.200.1.39:25,10.88.1.30:49990,>,250-PIPELINING,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,7,10.200.1.39:25,10.88.1.30:49990,>,250-DSN,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,8,10.200.1.39:25,10.88.1.30:49990,>,250-ENHANCEDSTATUSCODES,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,9,10.200.1.39:25,10.88.1.30:49990,>,250-STARTTLS,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,10,10.200.1.39:25,10.88.1.30:49990,>,250-X-ANONYMOUSTLS,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,11,10.200.1.39:25,10.88.1.30:49990,>,250-AUTH NTLM LOGIN,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,12,10.200.1.39:25,10.88.1.30:49990,>,250-X-EXPS GSSAPI NTLM,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,13,10.200.1.39:25,10.88.1.30:49990,>,250-8BITMIME,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,14,10.200.1.39:25,10.88.1.30:49990,>,250-BINARYMIME,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,15,10.200.1.39:25,10.88.1.30:49990,>,250-CHUNKING,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,16,10.200.1.39:25,10.88.1.30:49990,>,250-XEXCH50,
2011-01-20T02:38:48.668Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,17,10.200.1.39:25,10.88.1.30:49990,>,250 XRDST,
2011-01-20T02:38:48.715Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,18,10.200.1.39:25,10.88.1.30:49990,<,AUTH ntlm,
2011-01-20T02:38:48.715Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,19,10.200.1.39:25,10.88.1.30:49990,>,334 <authentication response>,
2011-01-20T02:38:48.808Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,20,10.200.1.39:25,10.88.1.30:49990,*,SMTPSubmit SMTPAcceptAnyRecipient BypassAntiSpam AcceptRoutingHeaders,Set Session Permissions
2011-01-20T02:38:48.808Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,21,10.200.1.39:25,10.88.1.30:49990,*,SVRCORE\Filsrv2008r2$,authenticated
2011-01-20T02:38:48.808Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,22,10.200.1.39:25,10.88.1.30:49990,>,235 2.7.0 Authentication successful,
2011-01-20T02:38:48.839Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,23,10.200.1.39:25,10.88.1.30:49990,<,MAIL FROM:<helpdesk@fullertonfinancial.com.cn>,
2011-01-20T02:38:48.839Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,24,10.200.1.39:25,10.88.1.30:49990,*,08CD56A28F01963F;2011-01-20T02:38:48.637Z;1,receiving message
2011-01-20T02:38:48.839Z,ExchangHUB\Default ExchangHUB,08CD56A28F01963F,25,10.200.1.39:25,10.88.1.30:49990,>,550 5.7.1 Client does not have permissions to send as this sender,</pre>
</div>
<p>可以看到2008R2的File Server使用计算机进行验证（虽然安全性更高，但似乎微软也没有清晰的文档对此说明）。</p>
<p>知道问题所在，解决问题就方便了。只要将此计算机赋予给From账户的Send As权限即可。例如：我要使用<a href="mailto:helpdesk@svrcore.com">helpdesk@svrcore.com</a>发送邮件，只需要将SVRCORE\Filsrv2008r2$ 赋予给<a href="mailto:HelpDesk@svrcore.com">HelpDesk@svrcore.com</a>的Send As权限：</p>
<p>使用Exchange Powershell：</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c6fff902-dace-4d3b-9665-dc0fb58f3deb" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Add-Adpermission -Identity "username" -user "domain\comuptername$" -extendedrights "Send-as"</pre>
</div>
<p>FSRM server use its computer account to authenticate the SMTP session before submitting message to exchange. To resolve the issue you must assign FSRM count account ( servername$) send as permission on user mailbox you are using in From field from exchange management Shell as Rich mentioned.<br />
  <br />&#160; <br />For your reference, I have enclosed the steps below: </p>
<p>&#160; <br />1. Open exchange Management Shell </p>
<p>2. Run command </p>
<p></p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a79a5127-3c49-45b4-8a79-3a0a891723b7" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Add-Adpermission -Identity "username" -user "domain\comuptername$" -extendedrights "Send-as"</pre>
</div>
<p>&#160;&#160;&#160; <br />Note: The username is User address you are using in from field. Computername$ is FSRM server computer account name</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Windows Server 2008 R2的DFS及其新特性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fwindows-server-2008-r2s-dfs-and-its-new-features.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows Server 2008 R2的DFS及其新特性</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="更新Hyper-v Server 2008 R2 到 Service Pack 1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fupdate-hyper-v-server-2008-r2-to-service-pack-1.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">更新Hyper-v Server 2008 R2 到 Service Pack 1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="在windows server 2008中如何使用可靠性监视程序" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fin-the-windows-server-2008-how-to-use-the-reliability-monitor.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在windows server 2008中如何使用可靠性监视程序</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="下载Exchange Server 2010 SP1" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdownload-exchange-server-2010-sp1.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093916.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">下载Exchange Server 2010 SP1</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="一些文件不能被DFS复制？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fdfs-can-not-be-copied-some-files.html&from=http%3A%2F%2Fwww.svrcore.com%2Ferror-log-srmsvc-12306-in-fsrm-2008-r2.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/04/25/6462730.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">一些文件不能被DFS复制？</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.svrcore.com/error-log-srmsvc-12306-in-fsrm-2008-r2.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>如何自定义Windows PowerShell环境</title>
		<link>http://www.svrcore.com/how-to-customize-the-windows-powershell-environment.html</link>
		<comments>http://www.svrcore.com/how-to-customize-the-windows-powershell-environment.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 03:45:17 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Profile]]></category>

		<guid isPermaLink="false">http://www.svrcore.com/%e5%a6%82%e4%bd%95%e8%87%aa%e5%ae%9a%e4%b9%89windows-powershell%e7%8e%af%e5%a2%83.html</guid>
		<description><![CDATA[Windows PowerShell最强的一个特质在于其扩展性。这个脚本引擎能以许多方式进行自定义，并扩展到使用默认下不可用的功能。一旦你明白基本术语和cmdlet，接下来就个性化PowerShell。 掌控PowerShell环境 使用脚本环境并不是万能之策。但是用户可以开始使用下面信息控制Windows PowerShell行为。 Profile Profile是在PowerShell启动时运行的脚本。（我喜欢将它看成PowerShell的autoexec.bat，这可能很守旧，但仍然适用。） 有两种类型的profile，能存储于两个地点： System profiles——适用于所有PowerShell会话 Host-specific profiles——只适用于某个主机（i.e. PS+） Global 位于系统System32的$PShome里，（C:windowssystem32WindowsPowerShellv1.0），这个profile适用于在主机上发起的所有PowerShell会话。 User [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Windows 7 RC将在3月1日到期" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fwindows-7-rc-will-expire-on-march-1.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094039.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 7 RC将在3月1日到期</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Windows PowerShell最强的一个特质在于其扩展性。这个脚本引擎能以许多方式进行自定义，并扩展到使用默认下不可用的功能。一旦你明白基本术语和cmdlet，接下来就个性化PowerShell。</p>
<p><strong>掌控PowerShell环境</strong></p>
<p>使用脚本环境并不是万能之策。但是用户可以开始使用下面信息控制Windows PowerShell行为。</p>
<p><strong>Profile</strong></p>
<p>Profile是在PowerShell启动时运行的脚本。（我喜欢将它看成PowerShell的autoexec.bat，这可能很守旧，但仍然适用。）</p>
<p>有两种类型的profile，能存储于两个地点：</p>
<ol>
<li>System profiles——适用于所有PowerShell会话 </li>
</ol>
<p> <span id="more-243"></span>
<ol>
<li></li>
<li>Host-specific profiles——只适用于某个主机（i.e. PS+） </li>
</ol>
<p><strong>Global</strong></p>
<p>位于系统System32的$PShome里，（C:windowssystem32WindowsPowerShellv1.0），这个profile适用于在主机上发起的所有PowerShell会话。</p>
<p><strong>User</strong></p>
<p>具体用户文档在最后载入的profile。位于$Env:UserProfileDocumentsWindowsPowerShellprofile.ps1。</p>
<p>PowerShell也允许你使用主机本身的文档创建自定义主机，不过这已经超出本文的讨论范围，深入到开发领域了。</p>
<p><strong>扩展PowerShell的功能</strong></p>
<p>尽管多数脚本环境包含扩展过程，但是这些方法通常很复杂，适合更有经验的用户。不过Windows PowerShell提供了几种级别的扩展性，新手可以很快学会。</p>
<p><strong>Function</strong></p>
<p>Function是最容易添加的，只需要在功能框里包含一个命令，如function {command}，让用户创建他们自己的cmdlet，通过profile载入并能按需访问。</p>
<p><strong>Snap-in</strong></p>
<p>Snap-ins是在版本1.0中添加二进制cmdlet到PowerShell会话的主要方法。通过如思杰、VMware或Exchange这样的应用供应商交付的编译代码，snap-ins由两个cmdlet控制：Get-PSSnapin和Add-PSSnapin。</p>
<p><strong>Module</strong></p>
<p>出现在Powershell 2.0版本里，module提供了function（管理中心）和snap-in（开发中心）之间的桥梁。Module能按需载入，并能包含二进制cmdlet、function和script，通过下面信息进行管理：</p>
<ul>
<li><em><strong>Get-Module</strong></em>——获取目前载入的module </li>
<li><em><strong>Import-Module</strong></em>——导入module </li>
<li><em><strong>Remove-Module</strong></em>——从目前会话移出module </li>
<li><em><strong>New-Module</strong></em>——创建只存在于内存里的module </li>
</ul>
<p>总的说来，对于每一个新手到经验丰富的开发者，Windows PowerShell还有大量可以增长的空间。查看下面cmdlet获取更多信息：</p>
<ul>
<li>Get-Help about_profiles </li>
<li>Get-Help about_functions </li>
<li>Get-Help about_PSSnapin </li>
<li>Get-Help about_modules </li>
</ul>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Windows 7 RC将在3月1日到期" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fwindows-7-rc-will-expire-on-march-1.html&from=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-customize-the-windows-powershell-environment.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094039.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 7 RC将在3月1日到期</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.svrcore.com/how-to-customize-the-windows-powershell-environment.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Exchange 2007批量修改用户邮箱的属性</title>
		<link>http://www.svrcore.com/exchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html</link>
		<comments>http://www.svrcore.com/exchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html#comments</comments>
		<pubDate>Wed, 03 Mar 2010 03:52:48 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[批量]]></category>

		<guid isPermaLink="false">http://www.svrcore.com/exchange-2007%e6%89%b9%e9%87%8f%e4%bf%ae%e6%94%b9%e7%94%a8%e6%88%b7%e9%82%ae%e7%ae%b1%e7%9a%84%e5%b1%9e%e6%80%a7.html</guid>
		<description><![CDATA[事情的起因是这样滴：BOSS想要把公司所有邮箱账户的登录名都显示到Outlook Address Book里，办法当然简单了，修改Exchange details template（如何修改？）就可以。但是当我操作的时候就发现问题了： 公司的邮箱的登录账户是字母和数字的组成，而邮件地址根据别名生成，新建账户的时候，需要修改别名，用以生成用户的邮件地址。 比如，新建一个账户叫”Leo Huang”,登录名是：“lh1234”.默认的，系统alias值就是lh1234，我需要修改alias为leohuang，以适应邮件地址策略。 （有点绕，如果你不知道我在说什么，直接跳过吧。）。 我想做的是： 1，先修改邮件地址策略，将“%m@svrcore.com”修改为“%s%g@svrcore.com”这样地址策略就默认显示为用户的last name firet name来作为邮件地址。 2，将别名显示为用户的登录名（Exchange新建用户时，别名即为用户登录账户名。）这样修改的好处是，减少了新建账户的操作步骤。 那么我的问题就是，以前被修改过的别名，要重新更改为相应的登录名。也就是说，我要把一个AD [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Add Custom Attribute using data from CSV file" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fadd-custom-attribute-using-data-from-csv-file.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093921.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Add Custom Attribute using data from CSV file</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>事情的起因是这样滴：BOSS想要把公司所有邮箱账户的登录名都显示到Outlook Address Book里，办法当然简单了，修改Exchange details template（<a href="http://www.messagingtalk.org/exchange-details-templates" rel="facebox" target="_blank">如何修改？）</a>就可以。但是当我操作的时候就发现问题了：</p>
<p>公司的邮箱的登录账户是字母和数字的组成，而邮件地址根据别名生成，新建账户的时候，需要修改别名，用以生成用户的邮件地址。</p>
<p>比如，新建一个账户叫”Leo Huang”,登录名是：“lh1234”.默认的，系统alias值就是lh1234，我需要修改alias为leohuang，以适应邮件地址策略。</p>
<p>（有点绕，如果你不知道我在说什么，直接跳过吧。）。</p>
<p>我想做的是：</p>
<p>1，先修改邮件地址策略，将<a href="mailto:&ldquo;%m@svrcore.com">“%m@svrcore.com</a>”修改为<a href="mailto:&ldquo;%s%g@svrcore.com">“%s%g@svrcore.com</a>”这样地址策略就默认显示为用户的last name firet name来作为邮件地址。</p>
<p>2，将别名显示为用户的登录名（Exchange新建用户时，别名即为用户登录账户名。）这样修改的好处是，减少了新建账户的操作步骤。</p>
<p>那么我的问题就是，以前被修改过的别名，要重新更改为相应的登录名。也就是说，我要把一个AD User的信息添加（修改）到Mailbox的属性里去。即我要把SamAccountName的值添加到Alias里去。</p>
<p>我的办法是：</p>
<p>先导出用户的display name和SamAccountName。
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:0e731f48-5472-4262-aa61-a5d69969fd3d" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Get-mailbox | select displayname,samaccountname | export-csv d:\mailbox.csv -Encoding unicode</pre>
</div>
<p>然后，把displayname和SamAccountName作为变量进行赋值。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:db496f6e-60c4-4227-be60-833548d348e1" class="wlWriterEditableSmartContent">
<pre class="brush: powershell;">Import-Csv d:\mailbox.csv | foreach {Get-mailbox $_.DisplayName | Set-Mailbox -Alias $_.SamAccountName}</pre>
</div>
<p>操作完成。</p>
<p>那么发散一下，批量的修改mailbox的属性，都可以这么去操作了。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Add Custom Attribute using data from CSV file" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fadd-custom-attribute-using-data-from-csv-file.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093921.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Add Custom Attribute using data from CSV file</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fexchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.svrcore.com/exchange-2007-batch-modify-properties-of-the-useru002639s-mailbox.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add / Remove a domain user/group to the local Guests group remotely using csv file</title>
		<link>http://www.svrcore.com/add-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html</link>
		<comments>http://www.svrcore.com/add-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html#comments</comments>
		<pubDate>Mon, 25 Jan 2010 09:31:42 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Remotely]]></category>

		<guid isPermaLink="false">http://www.svrcore.com/add-remove-a-domain-usergroup-to-the-local-guests-group-remotely-using-csv-file.html</guid>
		<description><![CDATA[由于IDC的日常运维外包给了vendor，所有就需要给他们一个账户，让他们至少能够远程登录到系统中去。IDC的Server又很多，只好写脚本实现了。Powershell的远程运行要比VBScript要好用得多，所以写了一个Powershell脚本，远程把用户加入到指定的计算机的本地组中。例如，我的域叫“svrcore.local”，需要处理的用户叫“vendor”，加入的组叫“Guests”。 #---------------------------------------- #CSV Sample: #Server, #svr1.svrcore.local #svr2.svrcore.local #svr3.svrcore.local #------------------------------------- #Usage: #import-csv d:\list.csv &#124; d:\adduser.ps1 #---------------------------------------- Process [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Active Directory Explorer v1.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Factive-directory-explorer-v12.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Active Directory Explorer v1.2</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>由于IDC的日常运维外包给了vendor，所有就需要给他们一个账户，让他们至少能够远程登录到系统中去。IDC的Server又很多，只好写脚本实现了。Powershell的远程运行要比VBScript要好用得多，所以写了一个Powershell脚本，远程把用户加入到指定的计算机的本地组中。例如，我的域叫“svrcore.local”，需要处理的用户叫“vendor”，加入的组叫“Guests”。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:f8314155-09fd-4ea3-bb77-785953dada7e" class="wlWriterEditableSmartContent">
<pre class="brush: powershell">#----------------------------------------
#CSV Sample:
#Server,
#svr1.svrcore.local
#svr2.svrcore.local
#svr3.svrcore.local
#-------------------------------------
#Usage:
#import-csv d:\list.csv | d:\adduser.ps1
#----------------------------------------
Process { 

$Server = $_.Server
$strDomain = "svrcore.local"
$strGroup = "vendor"  

$computer = [ADSI]("WinNT://" + $Server + ",computer")
$group = $computer.psbase.children.find("Guests")
$group.Name  

function Listmemebers
{$members = $group.psbase.invoke("Members") | %{$_.GetType().InvokeMember("Name",'GetProperty',$null,$_,$null)}
$Server
$members}

$group.Add("WinNT://" + $strDomain + "/" + $strGroup)
Listmemebers
}</pre>
</div>
<p>相应的，如果你想删除这个用户，只需要把第26行：</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:baee6ed4-4c6f-47fd-8de9-9d61b0976870" class="wlWriterEditableSmartContent">
<pre class="brush: powershell">$group.Add("WinNT://" + $strDomain + "/" + $strGroup)  </pre>
</div>
<p>改为如下形式即可：</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:f7b6ee07-df32-486d-a296-33dcf0116c02" class="wlWriterEditableSmartContent">
<pre class="brush: powershell">$group.Remove("WinNT://" + $strDomain + "/" + $strGroup)  </pre>
</div>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您也许喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Active Directory Explorer v1.2" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Factive-directory-explorer-v12.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Active Directory Explorer v1.2</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="25个常用的Powershell命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2F25-commonly-used-powershell-command.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4093931.png" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">25个常用的Powershell命令</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="如何使用Powershell发送Html邮件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-use-powershell-to-send-html-mail.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何使用Powershell发送Html邮件</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="Changing the scope so you can view the entire domain in Powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fchanging-the-scope-so-you-can-view-the-entire-domain-in-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://img.svrcore.com/img/images/42864a8bb0a2_F7FB/stickman_sex.gif" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Changing the scope so you can view the entire domain in Powershell</font>
                    </a>
                </td>
                <td width="99" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #FFFFFF !important;">
                    <a target="_blank" title="How to view members of a dynamic group using powershell" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.svrcore.com%2Fhow-to-view-members-of-a-dynamic-group-using-powershell.html&from=http%3A%2F%2Fwww.svrcore.com%2Fadd-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #FFFFFF !important; width: 93px !important; height: 93px !important;" src="http://static.wumii.com/site_images/2011/03/23/4094029.jpg" width="93px" height="93px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 99px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">How to view members of a dynamic group using powershell</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.svrcore.com/add-remove-a-domain-user-group-to-the-local-guests-group-remotely-using-csv-file.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

