<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[gOxiA=苏繁=SuFan Blog]]></title> 
<link>https://maytide.net/index.php</link> 
<description><![CDATA[gOxiA,苏繁,sufan,Microsoft MVP]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[gOxiA=苏繁=SuFan Blog]]></copyright>
<item>
<link>https://maytide.net/read.php/873.htm</link>
<title><![CDATA[配置静态 IP 地址]]></title> 
<author>gOxiA &lt;sufan_cn@msn.com&gt;</author>
<category><![CDATA[PowerShell 和脚本]]></category>
<pubDate>Sat, 09 Jul 2005 02:00:48 +0000</pubDate> 
<guid>https://maytide.net/read.php/873.htm</guid> 
<description>
<![CDATA[ 
	<span><div><p><strong>描述</strong></p></div><div><p>将计算机的 IP 地址设置为 192.168.1.141，并将 IP 网关设置为 192.168.1.100。</p></div><div><p></p><p><br /><strong>脚本代码<br /></strong>strComputer = &quot;.&quot;<br />Set objWMIService = GetObject(&quot;winmgmts:&#92;&#92;&quot; &amp; strComputer &amp; &quot;&#92;root&#92;cimv2&quot;)<br />Set colNetAdapters = objWMIService.ExecQuery _<br />&nbsp; &nbsp;(&quot;Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE&quot;)<br />strIPAddress = Array(&quot;192.168.1.141&quot;)<br />strSubnetMask = Array(&quot;255.255.255.0&quot;)<br />strGateway = Array(&quot;192.168.1.100&quot;)<br />strGatewayMetric = Array(1)<br />For Each objNetAdapter in colNetAdapters<br />&nbsp; &nbsp;errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)<br />&nbsp; &nbsp;errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)<br />&nbsp; &nbsp;If errEnable = 0 Then<br />&nbsp; &nbsp; &nbsp; &nbsp;WScript.Echo &quot;The IP address has been changed.&quot;<br />&nbsp; &nbsp;Else<br />&nbsp; &nbsp; &nbsp; &nbsp;WScript.Echo &quot;The IP address could not be changed.&quot;<br />&nbsp; &nbsp;End If<br />Next</p></div></span>
]]>
</description>
</item>
</channel>
</rss>