I found the below script and it’s good, it Modify VM Advanced settings on an multiple VM, capture the VM Advanced setting details before and after VM setting changes for future comparison with the timestamp in .csv format.
I need assistance in order to modify the script and just to connect only via vCenter without preparing the ServerList file as the ENV is very huge and it’s changing
Add-PSSnapin VMware.VimAutomation.Core
Connect–VIServer –Server vcenter.local –User username –Password Password
$ServerListFile = “ServerList.txt”
$ServerList = Get-Content $ServerListFile
Foreach ($vm in $ServerList)
{
$date=get-Date –format “ddMMyy_HHmm”
Get–VM $vm| Get–AdvancedSetting | Select Name, Value | Export-CSV $vm“_Before_$date.csv”
New–AdvancedSetting –Entity $vm –Name vmci0.unrestricted –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name RemoteDisplay.maxConnections –Value ‘1’ –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name tools.setInfo.sizeLimit –Value ‘1048576’ –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name floppyX.present –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name serialX.present –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name parallelX.present –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name ideX:Y.present –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.device.connectable.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.device.edit.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.tools.unity.push.update.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.tools.ghi.autologon.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.bios.bbs.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name vmsafe.enable –Value FALSE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.tools.copy.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.tools.paste.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name isolation.tools.autoInstall.disable –Value TRUE –Confirm:$False –Force:$True
New–AdvancedSetting –Entity $vm –Name tools.guestlib.enableHostInfo –Value FALSE –Confirm:$False –Force:$True
$date=get-Date –format “ddMMyy_HHmm”
Get–VM $vm| Get–AdvancedSetting | Select Name, Value | Export-CSV $vm“_After_$date.csv”
Start–VM –VM $vm
}
New-Item –ErrorAction Ignore –ItemType directory –Path Report
$path=$(get-location).Path+“report”
Move–Item *.csv $path –Force