SCharchouf
Hot Shot
Hot Shot

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:

  1. the folder Reports it's created once I run the report but without any files
  2. 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?

Reply
0 Kudos