DungKHoang / Import-Export-OneView-Resources

5 stars 2 forks source link

Performance improvement #5

Closed aricbernard closed 3 years ago

aricbernard commented 3 years ago

When using the generated PowerShell scripts to import objects client side filtering is being used within the script. For example: Get-OVNetwork | where name -eq 'Network-1'

For a very small environment or where the host executing the script is 'close' to the OV appliance, this may be acceptable. However if the environment is large or the host is far away (e.g. over VPN or across the WAN), this will result in painfully poor performance (e.g. the ethernetNetworks.ps1 script could take HOURS to complete).

I suggest changing all similar commands in all generated scripts from '| where name -eq' to '-ErrorAction SilentlyContinue -Name'. In the context being used, this should result in the same outcome with far superior performance. For example: Get-OVNetwork -ErrorAction SilentlyContinue -Name 'Network-1'

DungKHoang commented 3 years ago

Please review and test