autoit 发表于 2008-5-3 14:19:49

在Autoit中使用WMI:第四部分

<p><strong>八、续接WMI的应用</strong></p><p dir="ltr">No.4.进程</p><blockquote dir="ltr" style="margin-right: 0px"><p dir="ltr">1.检查系统同时运行了多少个au3脚本</p><p dir="ltr">使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394372.aspx"><strong>Win32_Process</strong></a> 类并找出名字为AutoIt3.exe的进程.</p><blockquote dir="ltr" style="margin-right: 0px"><p dir="ltr"><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span> <br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span> _<br /><span class="st0">&quot;winmgmts:&#92;&#92;&quot;</span> &amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;CIMV2&quot;</span><span class="br0">)</span> <br /><span class="re0">$colItems</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span><span class="br0">(</span> _<br /><span class="st0">&quot;SELECT * FROM Win32_Process&quot;</span> &amp; _<br /><span class="st0">&quot; WHERE Name = 'AutoIt3.exe'&quot;</span><span class="br0">)</span> <br /><span class="kw1">For</span> <span class="re0">$objItem</span> <span class="kw1">in</span> <span class="re0">$colItems</span> <br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;-------------------------------------------&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;CommandLine: &quot;</span> &amp; <span class="re0">$objItem</span>.<span class="me1">CommandLine</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Name: &quot;</span> &amp; <span class="re0">$objItem</span>.<span class="me1">Name</span> &amp; <span class="re0">@CRLF</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote><p dir="ltr">2.修改进程的优先权</p><p dir="ltr">使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394372.aspx"><strong>Win32_Process</strong></a> 类和 <a href="http://msdn2.microsoft.com/en-us/library/aa393587.aspx"><strong>SetPriority </strong></a>途径</p><blockquote dir="ltr" style="margin-right: 0px"><p dir="ltr"><span class="kw1">Const</span> <span class="re0">$ABOVE_NORMAL</span> = <span class="nu0">32768</span><br /><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colProcesses</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_Process Where Name = 'Notepad.exe'&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objProcess</span> <span class="kw1">in</span> <span class="re0">$colProcesses</span><br /><span class="re0">$objProcess</span>.<span class="me1">SetPriority</span><span class="br0">(</span><span class="re0">$ABOVE_NORMAL</span><span class="br0">)</span> <br /><span class="kw1">Next</span></p></blockquote><p>3.列出每个进程所占用的内存</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394372.aspx"><strong>Win32_Process</strong></a> 类和诸如 <strong>KernelModeTime</strong>, <strong>WorkingSetSize</strong>, <strong>PageFileUsage</strong>, 与 <strong>PageFaults</strong> 的属性</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colProcesses</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_Process&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objProcess</span> <span class="kw1">in</span> <span class="re0">$colProcesses</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Process: &quot;</span> &amp; <span class="re0">$objProcess</span>.<span class="me1">Name</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="re0">$sngProcessTime</span> = <span class="br0">(</span><span class="kw3">String</span><span class="br0">(</span><span class="re0">$objProcess</span>.<span class="me1">KernelModeTime</span><span class="br0">)</span> + _<br /><span class="kw3">String</span><span class="br0">(</span><span class="re0">$objProcess</span>.<span class="me1">UserModeTime</span><span class="br0">)</span><span class="br0">)</span> / <span class="nu0">10000000</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Processor Time: &quot;</span> &amp; <span class="re0">$sngProcessTime</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Process ID: &quot;</span> &amp; <span class="re0">$objProcess</span>.<span class="me1">ProcessID</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Working $Size: &quot;</span> _<br />&amp; <span class="re0">$objProcess</span>.<span class="me1">WorkingSetSize</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Page File Size: &quot;</span> _<br />&amp; <span class="re0">$objProcess</span>.<span class="me1">PageFileUsage</span> &amp; <span class="re0">@CRLF</span><span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Page Faults: &quot;</span> &amp; <span class="re0">$objProcess</span>.<span class="me1">PageFaults</span> &amp; <span class="re0">@CRLF</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote></blockquote><p dir="ltr">No.5.磁盘和文件系统</p><blockquote dir="ltr" style="margin-right: 0px"><p dir="ltr">1.列出每个用户所占用的磁盘空间</p><p dir="ltr">使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394136.aspx"><strong>Win32_DiskQuota</strong></a> 类和 <strong>User</strong> 以及 <strong>DiskSpaceUsed</strong> 属性.</p><blockquote dir="ltr" style="margin-right: 0px"><p dir="ltr"><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colQuotas</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_DiskQuota&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objQuota</span> <span class="kw1">in</span> <span class="re0">$colQuotas</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Volume: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="re0">$objQuota</span>.<span class="me1">QuotaVolume</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;User: &quot;</span>&amp; <span class="re0">@Tab</span> &amp; <span class="re0">$objQuota</span>.<span class="me1">User</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Disk Space Used: &quot;</span> _<br />&amp; <span class="re0">@Tab</span> &amp; <span class="re0">$objQuota</span>.<span class="me1">DiskSpaceUsed</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote><p>2.检查软驱里是否有软盘</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394173.aspx"><strong>Win32_LogicalDisk</strong></a> 类并检查 <strong>FreeSpace</strong> 属性</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span> _<br /><span class="st0">&quot;winmgmts:&#92;&#92;&quot;</span> &amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colItems</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * From Win32_LogicalDisk Where DeviceID = 'A:'&quot;</span><span class="br0">)</span><br /><br /><span class="kw1">For</span> <span class="re0">$objItem</span> <span class="kw1">in</span> <span class="re0">$colItems</span><br /><span class="re0">$intFreeSpace</span> = <span class="re0">$objItem</span>.<span class="me1">FreeSpace</span><br /><span class="kw1">If</span> <span class="re0">$intFreeSpace</span> = <span class="st0">&quot;&quot;</span> <span class="kw1">Then</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;There is no disk in the floppy drive.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Else</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;There is a disk in the floppy drive.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">EndIf</span><br /><span class="kw1">Next</span></p></blockquote><p>3.判断磁盘是否为可移动驱动器</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394173.aspx"><strong>Win32_LogicalDisk</strong></a> 类并检查 <strong>DriveType</strong> 属性.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colDisks</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_LogicalDisk&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objDisk</span> <span class="kw1">in</span> <span class="re0">$colDisks</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DeviceID: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="re0">$objDisk</span>.<span class="me1">DeviceID</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Switch</span> <span class="re0">$objDisk</span>.<span class="me1">DriveType</span><br /><span class="kw1">Case</span> <span class="nu0">1</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;No root directory. &quot;</span> _<br />&amp; <span class="st0">&quot;Drive type could not be &quot;</span> _<br />&amp; <span class="st0">&quot;determined.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Case</span> <span class="nu0">2</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DriveType: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="st0">&quot;Removable drive.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Case</span> <span class="nu0">3</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DriveType: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="st0">&quot;Local hard disk.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Case</span> <span class="nu0">4</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DriveType: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="st0">&quot;Network disk.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Case</span> <span class="nu0">5</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DriveType: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="st0">&quot;Compact disk.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span> <br /><span class="kw1">Case</span> <span class="nu0">6</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DriveType: &quot;</span>&amp; <span class="re0">@Tab</span> _<br />&amp; <span class="st0">&quot;RAM disk.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span> <br /><span class="kw1">Case</span> <span class="kw1">Else</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Drive type could not be&quot;</span> _<br />&amp; <span class="st0">&quot; determined.&quot;</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">EndSwitch</span><br /><span class="kw1">Next</span></p></blockquote><p>4.检查驱动器的文件系统类型</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394173.aspx"><strong>Win32_LogicalDisk</strong></a> 类和 <strong>FileSystem</strong> 属性.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colDisks</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_LogicalDisk&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objDisk</span> <span class="kw1">in</span> <span class="re0">$colDisks</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DeviceID: &quot;</span> &amp; <span class="re0">$objDisk</span>.<span class="me1">DeviceID</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span> <br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;File System: &quot;</span> _<br />&amp; <span class="re0">$objDisk</span>.<span class="me1">FileSystem</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote><p>5.检查磁盘的可用空间</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394173.aspx"><strong>Win32_LogicalDisk</strong></a> 类和 <strong>FreeSpace</strong> 属性.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&quot;</span> _<br />&amp; <span class="st0">&quot;{impersonationLevel=impersonate}!&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colDisks</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * from Win32_LogicalDisk&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objDisk</span> <span class="kw1">in</span> <span class="re0">$colDisks</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;DeviceID: &quot;</span> &amp; <span class="re0">$objDisk</span>.<span class="me1">DeviceID</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span> <br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="st0">&quot;Free Disk Space: &quot;</span> _<br />&amp; <span class="re0">$objDisk</span>.<span class="me1">FreeSpace</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span> <br /><span class="kw1">Next</span></p></blockquote><p>6.进行磁盘整理</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394515.aspx"><strong>Win32_Volume</strong></a> 类和 <a href="http://msdn2.microsoft.com/en-us/library/aa389832.aspx"><strong>Defrag</strong></a> 途径.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&#92;&#92;&quot;</span> _<br />&amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colVolumes</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> <span class="br0">(</span><span class="st0">&quot;Select * from Win32_Volume Where Name = 'K:&#92;&#92;'&quot;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objVolume</span> <span class="kw1">in</span> <span class="re0">$colVolumes</span><br /><span class="re0">$errResult</span> = <span class="re0">$objVolume</span>.<span class="me1">Defrag</span><span class="br0">(</span><span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote></blockquote><p dir="ltr">No.6.网络</p><blockquote dir="ltr" style="margin-right: 0px"><p>1.禁用网络连接</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394217.aspx"><strong>Win32_NetworkAdapterConfiguration</strong></a> 和 <a href="http://msdn2.microsoft.com/en-us/library/aa393047.aspx"><strong>ReleaseDHCPLease</strong></a> 途径.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span><span class="st0">&quot;winmgmts:&#92;&#92;&quot;</span> &amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$colNetCards</span> = <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> _<br /><span class="br0">(</span><span class="st0">&quot;Select * From Win32_NetworkAdapterConfiguration &quot;</span> _<br />&amp; <span class="st0">&quot;Where IPEnabled = True&quot;;</span><span class="br0">)</span><br /><span class="kw1">For</span> <span class="re0">$objNetCard</span> <span class="kw1">in</span> <span class="re0">$colNetCards</span><br /><span class="re0">$objNetCard</span>.<span class="me1">ReleaseDHCPLease</span><span class="br0">(</span><span class="br0">)</span><br /><span class="kw1">Next</span></p></blockquote><p>2.得到适配器信息</p><p>使用 <a href="http://msdn2.microsoft.com/en-us/library/aa394217.aspx"><strong>Win32_NetworkAdapterConfiguration</strong></a> 类.</p><blockquote dir="ltr" style="margin-right: 0px"><p><span class="re0">$strComputer</span> = <span class="st0">&quot;.&quot;</span><br /><span class="re0">$objWMIService</span> = <span class="kw3">ObjGet</span><span class="br0">(</span> _<br /><span class="st0">&quot;winmgmts:&#92;&#92;&quot;</span> &amp; <span class="re0">$strComputer</span> &amp; <span class="st0">&quot;&#92;root&#92;cimv2&quot;</span><span class="br0">)</span><br /><span class="re0">$IPConfigSet</span>= <span class="re0">$objWMIService</span>.<span class="me1">ExecQuery</span> <span class="br0">(</span><span class="st0">&quot;Select IPAddress from Win32_NetworkAdapterConfiguration&quot;</span> _<br />&amp; <span class="st0">&quot; where IPEnabled=TRUE&quot;</span><span class="br0">)</span><br /><br /><span class="kw1">For</span> <span class="re0">$IPConfig</span> <span class="kw1">in</span> <span class="re0">$IPConfigSet</span><br /><span class="kw1">If</span> <span class="kw1">Not</span> <span class="re0">$IPConfig</span>.<span class="me1">IPAddress</span> <span class="kw1">Then</span> <br /><span class="kw1">For</span> <span class="re0">$i</span>=<span class="nu0">0</span> <span class="kw1">To</span> <span class="kw3">UBound</span><span class="br0">(</span><span class="re0">$IPConfig</span>.<span class="me1">IPAddress</span><span class="br0">)</span><br /><span class="kw3">ConsoleWrite</span><span class="br0">(</span> <span class="re0">$IPConfig</span>.<span class="me1">IPAddress</span><span class="br0">(</span> <span class="re0">$i</span><span class="br0">)</span> &amp; <span class="re0">@CRLF</span> <span class="br0">)</span><br /><span class="kw1">Next</span><br /><span class="kw1">EndIf</span><br /><span class="kw1">Next</span></p></blockquote></blockquote>

UID 发表于 2008-12-16 11:23:53

:face (34):这么好的文章没人顶

askask150 发表于 2008-12-18 04:38:27

:face (29):搞定谢谢作者

lantu 发表于 2009-1-13 10:10:36

收藏,不断学习中

还有没有续集啊

foolbyrd 发表于 2009-10-13 20:50:21

学习了,谢谢LZ

汲水先生 发表于 2009-10-22 14:51:54

收藏,不断学习中

还有没有续集啊

871224 发表于 2009-10-30 10:13:36

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

chinaxx 发表于 2011-4-19 09:55:21

这个东西好
页: [1]
查看完整版本: 在Autoit中使用WMI:第四部分