Hello,
First of all im a complete powershell n00b.
Im trying to create a simple script which copy's certain advancedsettings from an esxi (5.5) host to another host.
#syslog = get-vmhost $name | get-advancedsettings -name syslog*
but how do i now get it on another host?
cause get-vmhost $name2 | set-advancedsettings $syslog doesnt work ![]()
thanks
The Value parameter on the Set-AdvancedSetting is required.
So you should do something like this
foreach($adv in (Get-VMHost $name | Get-AdvancedSetting -Name syslog*)){
Get-VMHost -Name $name2 | Get-AdvancedSetting -Name $adv.Name |
Set-AdvancedSetting -Value $adv.Value
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The Value parameter on the Set-AdvancedSetting is required.
So you should do something like this
foreach($adv in (Get-VMHost $name | Get-AdvancedSetting -Name syslog*)){
Get-VMHost -Name $name2 | Get-AdvancedSetting -Name $adv.Name |
Set-AdvancedSetting -Value $adv.Value
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You have to set each advanced setting separate. Something like this:
$VMHostFrom = Get-VMHost -Name "From"
$VMHostTo = Get-VMHost -Name "To"
$AdvancedSettings = $VMHostFrom | Get-AdvancedSetting -Name syslog*
foreach ($AdvancedSetting in $AdvancedSettings)
{
$VMHostTo | Get-AdvancedSetting -Name $AdvancedSetting.Name |
Set-AdvancedSetting -Value $AdvancedSetting.Value -Confirm:$false
}
