Dears,
I have wrote a script about collect a accumulated data via Excel sheet, But I run this script and there is no response. Does syntax is wrong for while loop? I apprecaiated your kindly reply ,thanks very.
Param([string]$file)
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $False
$workbook = $excel.Workbooks.Open($file)
$sheet = $workbook.Worksheets.Item("PC服务器虚拟机")
$i = 4
$project = $sheet.Cells.Item($i,1).text
$Name = $sheet.Cells.Item($i,3).text
$Temp = $sheet.Cells.Item($i,5).text
$NumCpu = $sheet.Cells.Item($i,6).text
$NumMem = $sheet.Cells.Item($i,7).text
$SizeDisk = $sheet.Cells.Item($i,8).text
$Clustername = $sheet.Cells.Item($i,13).text
$ESXi = $sheet.Cells.Item($i,14).text
$Vlan = $sheet.Cells.Item($i,17).text
$value = @{"Itemname" = "$project" ;
"vmname" = "$Name" ;
"Tempname" = "$Temp";
"NumCpu" = "$NumCpu";
"NumMem" = "$NumMem";
"SizeDisk" ="$SizeDisk";
"Clustername" = "$Clustername";
"ESXi" = "$ESXi" ;
"Vlan" = "$Vlan" }
$vms = @()
while ( $value.vmname -ne "" )
{
$vms += $value
$i++
}
$excel.Workbooks.Close()
$excel.Quit()