Hello,
I have the following code:
$array3 = Get-VM | Get-View | ForEach-Object { $_.Guest.Net } | select Network
but it breaks here:
$Sheet.Cells.Item($intRow,$intColumn) = $array3[$i]
Exception setting "Item": "Exception from HRESULT: 0x800A03EC"
At C:\scripts\VMware\HealthCheck_vCenter2_xls.ps1:498 char:19
+ $Sheet.Cells.Item <<<< ($intRow,$intColumn) = $array3[$i]
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterParameterizedPropertySetValueTI
Thanks for your help.
I would need to see a bit more of your script to be sure, but the problem looks like the one in PowerShell to Excel Cell error
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD, thanks for the message. I think I figured it out. I did replace $Sheet.Cells.Item($intRow,$intColumn) = $array3[$i] with the following line $Sheet.Cells.Item($intRow,$intColumn) = $array3[$i].Network
I get the Network Names as expected in the respective cells
Network Name |
VM Network 126 |
VM Network - DMZ |
VM Network - DMZ |
VM Network - LAN |
VM Network 126 |