- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
below the Script modified:
Connect-VIServer -Server vCenter.local
Foreach ($vm in Get-VM)
{
$date=Get-Date -format "ddMMyy_HHmm"
Get-AdvancedSetting -Entity$vm | Select Name, Value | Export-CSV $vm"_Before_$date.csv"
New-AdvancedSetting -Entity $vm -Name isolation.tools.copy.disable -Value TRUE -Confirm:$False -Force:$True | select @{N='VM';E={$_.Entity.Name}},Name,Value
New-AdvancedSetting -Entity $vm -Name isolation.tools.paste.disable -Value TRUE -Confirm:$False -Force:$True | select @{N='VM';E={$_.Entity.Name}},Name,Value
}
New-Item -ErrorAction Ignore -ItemType directory -Path Report
$path=$(get-location).Path+"\Reports\"
Move-Item *.csv $path -Force
Issue:
- the folder Reports it's created once I run the report but without any files
- got this message when I run the script:
Get-AdvancedSetting : A parameter cannot be found that matches parameter name 'Entity$vm'.
At .\AdvancedSettings_V1.ps1:9 char:25
+ Get-AdvancedSetting -Entity$vm | Select Name, Value | Export-CSV ...
+ ~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AdvancedSetting], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetAdvancedSetting
PS: it's possible to get the Report in the same CSV that show value before & after?