Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 170134

Re: Script to export virtual disk information in a specific format

$
0
0

I will start by saying you guys rock

 

That being said is there away to suppress the errors I get during script running for FileName.Split and the | to get-scsicontroller?  When the script loops through a vm that does not have disks in any of the 2-7 slots, it shows an error to screen?

 

You cannot call a method on a null-valued expression.

 

+     $row | Add-Member -Name "HD$($i)Datastore" -Value $_.FileName.Split(']')[0]. ...

+                                  ~~

    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

 

 

Get-ScsiController : Cannot validate argument on parameter 'HardDisk'. The argument is null or empty. Supply an

argument that is not null or empty and then try the command again.

+     $row | Add-Member -Name "HD$($i)controller" -Value ($_ | Get-ScsiController) ...

+                                                              ~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidData: (:) [Get-ScsiController], ParameterBindingValidationException

    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDev

   ice.GetScsiController

 

Thanks!


Viewing all articles
Browse latest Browse all 170134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>