VMware Cloud Community
lElOUCHE_79
Enthusiast
Enthusiast

get and export a specif adanced settings for VM

I know that we can show the advanced setting for a VM by using the below command

 

Get-VM "VM_Name | Get-AdvancedSetting -Name isolation.tools.autoInstall.disable

My question is that I'm not able to export the output 😞 

 

0 Kudos
3 Replies
LucD
Leadership
Leadership

To what do you want to export, and how did you try to do it?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
lElOUCHE_79
Enthusiast
Enthusiast

Get-VM |Get-AdvancedSetting -Name isolation.tools.dnd.disable | Export-Csv -Path .\Advanced_Settings.csv -NoTypeInformation

and I would like to export the vcenter name, vm name the parameter isolation.tools.dnd.disable if it's set to true or false 

0 Kudos
LucD
Leadership
Leadership

When that advanced setting is not set for a VM, the Get-AdvancedSetting cmdlet returns nothing.
So the snippet has to capture that, and return for example 'na' in that case.

Get-VM  |
Select-Object -Property @{N = 'vCenter'; E = { ([uri]$_.ExtensionData.Client.ServiceUrl).Host}},
  @{N='VM';E={$_.Name}},
  @{N='isolation.tools.autoInstall.disable';E={
    $adv = Get-AdvancedSetting -Entity $_ -Name 'isolation.tools.autoInstall.disable'
    if($adv){$adv.Value}else{'na'}
  }} |
Export-Csv -Path .\Advanced_Setting.csv -NoTypeInformation -UseCulture


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos