码迷,mamicode.com
首页 > 其他好文 > 详细

[APAC]查找资产表

时间:2015-05-13 19:08:27      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:

$sn = Read-Host -Prompt "请输入SN号(7位 or 10位)"
$xl = New-Object -ComObject "Excel.Application"
$cmdbwb = $xl.Workbooks.Open("F:\Ivan\HZCMDB.xlsx")
$cmdbwss = "01--GE DST", "01--BBG DST", "01--Non GE DST", "02--Laptop"
ForEach ($cmdbwsname in $cmdbwss) {
    $cmdbws = $cmdbwb.Worksheets.Item($cmdbwsname)
    $row = $cmdbws.cells.find($sn).row
    if($row -ne $null) {
[pscustomobject][ordered]@{
EmployeeNo = $cmdbws.range("A$row").text
EmployeeName = $cmdbws.range("B$row").text
SeatNo = $cmdbws.range("C$row").text
Project = $cmdbws.range("D$row").text
Model = $cmdbws.range("E$row").text
ServiceTag = $cmdbws.range("F$row").text
FinanceNo = $cmdbws.range("G$row").text
RAM = $cmdbws.range("H$row").text
Hostname = $cmdbws.range("I$row").text
}}}
$xl.Quit()
$cmdbws = $null
$cmdbwb = $null
$xl = $null
[GC]::Collect()

 

[APAC]查找资产表

标签:

原文地址:http://www.cnblogs.com/IvanChen/p/4500788.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!