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
Yes, something along these lines.
ForEach-Object -Process {
Get-AdvancedSetting -Entity $_ -Name SettingName |
Set-AdvancedSetting -Value NewValue -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you get an error?
Which specific setting were you trying to change?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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"
These are advanced settings for VMs, not for clusters afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
apologies, my bad, mean that I need to update advanced settings for VMs in a specific cluster sorry
Yes, something along these lines.
ForEach-Object -Process {
Get-AdvancedSetting -Entity $_ -Name SettingName |
Set-AdvancedSetting -Value NewValue -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Or something like this (if you want to do the settings you listed earlier).
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
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
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
Best option is to get a LOG regarding what was implemented in case of any issue we can trace
Something like this?
$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
you are the BOSS
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
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