VMware Cloud Community
SCharchouf
Hot Shot
Hot Shot
Jump to solution

Set Advanced Setting for specific Cluster

PowerCLI Version

----------------

   VMware vSphere PowerCLI 6.3 Release 1 build 3737840

---------------

Component Versions

---------------

   VMware Cloud Infrastructure Suite PowerCLI Component 6.3 build 3709081

   VMWare AutoDeploy PowerCLI Component 6.0 build 3736841

   VMWare ImageBuilder PowerCLI Component 6.0 build 3736841

   VMware vSphere PowerCLI Component 6.3 build 3709081

   VMware VDS PowerCLI Component 6.3 build 3709081

   VMware vCloud Director PowerCLI Component 6.3 build 3615264

   VMware HA PowerCLI Component 6.0 build 3625284

   VMware License PowerCLI Component 6.0 build 3615733

   VMware vCloud Air PowerCLI Component 6.3 build 3615264

   VMware PowerCLI Component for Storage Management 6.0 build 3617867

   VMware vROps PowerCLI Component 6.3 build 3615304

   VMware vSphere Update Manager PowerCLI 6.1 build 3607502

I'm trying to change advanced settings for a specific Cluster using the below command, unfortunately nothing changed:

Get-AdvancedSetting -Entity (Get-Cluster -Name Cluster) -Name SettingName | Set-AdvancedSetting -Value NewValue

Could you please assist on this

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, something along these lines.

Get-Cluster -Name cluster | Get-Vm |

ForEach-Object -Process {

    Get-AdvancedSetting -Entity $_ -Name SettingName |

    Set-AdvancedSetting -Value NewValue -Confirm:$false

}


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

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Did you get an error?
Which specific setting were you trying to change?


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

0 Kudos
SCharchouf
Hot Shot
Hot Shot
Jump to solution

No error received and I have about 10 settings to implement for specif clusters on the first step:

"isolation.device.connectable.disable" -value $true

"isolation.device.edit.disable" -value $true

"isolation.tools.copy.disable" -value $true

"isolation.tools.diskShrink.disable" -value $true

"isolation.tools.diskWiper.disable" -value $true

"isolation.tools.dnd.disable" -value $true

"isolation.tools.paste.disable" -value $true

"isolation.tools.setGUIOptions.enable" -value $false

"log.keepOld" -value "10"

"log.rotateSize" -value "1024000"

0 Kudos
LucD
Leadership
Leadership
Jump to solution

These are advanced settings for VMs, not for clusters afaik.


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

0 Kudos
SCharchouf
Hot Shot
Hot Shot
Jump to solution

apologies, my bad,  mean that I need to update advanced settings for VMs in a specific cluster sorry

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, something along these lines.

Get-Cluster -Name cluster | Get-Vm |

ForEach-Object -Process {

    Get-AdvancedSetting -Entity $_ -Name SettingName |

    Set-AdvancedSetting -Value NewValue -Confirm:$false

}


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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Or something like this (if you want to do the settings you listed earlier).

$data = @'

name,value

"isolation.device.connectable.disable",$true

"isolation.device.edit.disable",$true

"isolation.tools.copy.disable",$true

"isolation.tools.diskShrink.disable",$true

"isolation.tools.diskWiper.disable",$true

"isolation.tools.dnd.disable",$true

"isolation.tools.paste.disable",$true

"isolation.tools.setGUIOptions.enable",$false

"log.keepOld","10"

"log.rotateSize","1024000"

'@

$settings = ConvertFrom-Csv -InputObject $data


Get-Cluster -Name cluster | Get-VM -PipelineVariable vm |

ForEach-Object -Process {

    foreach ($row in $settings) {

        Get-AdvancedSetting -Entity $vm -Name $row.Name |

        Set-AdvancedSetting -Value $row.Value -Confirm:$false

    }

}


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

0 Kudos
SCharchouf
Hot Shot
Hot Shot
Jump to solution

Thank you LucD

I was inspired by your idea, I just have a problem I can't create a LOG file

Below the Script :

Connect-VIServer -Server X.X.X.X

$VMS = Get-Content C:PATH\List_VMs.txt

foreach ($vm in $VMS){

    New-advancedsetting -Entity $vm -Name isolation.device.connectable.disable -value $true -force -Confirm:$false

    New-advancedsetting -Entity $vm -Name isolation.device.edit.disable -value $true -force -Confirm:$false

    New-advancedsetting -Entity $vm -Name isolation.tools.copy.disable -value $true -force -Confirm:$false

}

Disconnect-VIserver -Confirm:$false

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The New-AdvancedSetting cmdlet produces an object.
Do you want to capture specific properties of that object in a LOG file?


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

0 Kudos
SCharchouf
Hot Shot
Hot Shot
Jump to solution

Best option is to get a LOG regarding what was implemented in case of any issue we can trace

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Something like this?

Connect-VIServer -Server X.X.X.X

$VMS = Get-Content C:PATH\List_VMs.txt

$report = foreach ($vm in $VMS){

    New-advancedsetting -Entity $vm -Name isolation.device.connectable.disable -value $true -force -Confirm:$false |

    select @{N='VM';E={$_.Entity.Name}},Name,Value

    New-advancedsetting -Entity $vm -Name isolation.device.edit.disable -value $true -force -Confirm:$false |

    select @{N='VM';E={$_.Entity.Name}},Name,Value

    New-advancedsetting -Entity $vm -Name isolation.tools.copy.disable -value $true -force -Confirm:$false |

    select @{N='VM';E={$_.Entity.Name}},Name,Value

}

Disconnect-VIserver -Confirm:$false


$report | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture


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

0 Kudos
SCharchouf
Hot Shot
Hot Shot
Jump to solution

you are the BOSS Smiley Happy Smiley Happy

it's working fine, just for information I get this message when I run the Script

          WARNING: Parameter 'Entity' is obsolete. This parameter no longer accepts multiple values.

PowerCLI version 6.3

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is a warning, you can ignore it.

You should consider upgrading your PowerCLI version, that is a rather old version.


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