I got a little script to count vm in a vcenter.
data is pulled into an xls file "report.xls"
evrything is working fine but when i ran the script it overwrite the old one ( and the data :smileysad: )
t want to know if it's possible to do that : each time i run the script it keep data in row 2 but fill data in row 3 with the new date.
if someone can help iam stuck
Thanks a lot
here my script
$TotalVMs = Get-VM
$TotalVMsCount = $TotalVMs.count
$xlsfile = "D:\report.xls"
$date = Get-Date -UFormat "%d / %m / %Y"
$Excel = New-Object -ComObject Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.add()
$Sheet = $Excelok.Worksheets.Item(1)
$Sheet.Cells.Item(1,1) = "Date"
$Sheet.Cells.Item(1,2) = "Count of VM"
$intRow = 2
$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 19
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
$Sheet.Cells.Item($intRow, 1) = $date
$Sheet.Cells.Item($intRow, 2) = $TotalVMsCount
$WorkBook.EntireColumn.AutoFit()
$Sheet.SaveAs($xlsfile)