Automation

 View Only
Expand all | Collapse all

How can add configuration parameter for more than 100 VMS easier

Scott Vessey

Scott VesseyApr 08, 2020 02:20 PM

  • 1.  How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 01:46 PM

    Hi

    I need add some parameters in configuration parameters of each vm  "for about 100 vm"

    such as follow parametes ;

    tools.setInfo.sizeLimit     false

    isolation.tools.unity.disable     false

    isolation.tools.ghi.protocolhandler.info.disable    false

    It is not easy to add on each vm and need more time now want to know can I add all of these to custom vm via powershell command or ......?

    BR



  • 2.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 01:55 PM

    its possible via powercli :

    get-vm | New-AdvancedSetting -Entity $vm -Name isolation.tools.unity.disable -Value TRUE -Confirm:$false -Force:$true

    get-vm | New-AdvancedSetting -Entity $vm -Name isolation.tools.ghi.protocolhandler.info.disable -Value TRUE -Confirm:$false -Force:$true

    get-vm | New-AdvancedSetting -Entity $vm -Name tools.setInfo.sizeLimit -Value "<number>" -Confirm:$false -Force:$true



  • 3.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 02:20 PM

    Moderator: Moved to PowerCLI



  • 4.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 02:38 PM

    I'm afraid that sending the entity through the pipeline and using the Entity parameter together will not work.

    You could do something like this.

    Note1: the value assigned to tools.setInfo.sizeLimit is not TRUE or FALSE, but the maximum size in bytes of the VMX file (the default is 1MB)

    Note2: you can adapt the Get-VM in the foreach statement to pick a selected set of VM

    foreach($vm in Get-VM){

        New-AdvancedSetting -Entity $vm -Name isolation.tools.unity.disable -Value 'FALSE' -Confirm:$false -Force

        New-AdvancedSetting -Entity $vm -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'FALSE' -Confirm:$false -Force

        New-AdvancedSetting -Entity $vm -Name tools.setInfo.sizeLimit -Value '1048576' -Confirm:$false -Force

    }



  • 5.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 02:47 PM

    Would you please say where can get the latest version of powercli to connect vcsa 6.7 and what is the initiate command to connect to vcsa via powercli ?



  • 6.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 02:59 PM

    the latest poeercli version is 11.5 and is installed from powershell gallery :

    https://digitalthoughtdisruption.com/2020/03/25/how-to-install-powercli-11-5-in-powershell-and-powershell-ise/

    to connect to the vcsa:

    connect-viserver <vcsa-name or ip>

    if your vcsa-account is the same as your client account your login is automatic, otherwise youre asked for credentials or can provide credentials per commandline

    p.s. the first connect will always fail due invalid certificate errors, so exceute :

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false



  • 7.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 03:17 PM

    Thanks but my system not access to the internet and get follow error . Can install that offline ?

    PS C:\Users\Administrator> install-Module VMware.PowerCLI -Scope CurrentUser

    NuGet provider is required to continue

    PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or

    'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet

    to install and import the NuGet provider now?

    [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

    WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.

    WARNING: Unable to download the list of available providers. Check your internet connection.

    PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified



  • 8.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 03:28 PM


  • 9.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 08, 2020 03:43 PM

    The latest PowerCLI version is 12.0.
    On the VMware{code} page there is a ZIP file available for environments that need to install in an environment that doesn't have Internet.

    An alternative is to work with Save-Module.

    That procedure is described in Updating PowerCLI through the PowerShell Gallery



  • 10.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 04:01 AM

    thanks

    Actually one of my vm name is testn now i used such as follow

    I want set isolation.tools.unity.disable = true

    1- If I want this add just for one of my vm with name testn do I have to use follow this :

    New-AdvancedSetting -Entity $testn -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'TRUE' -Confirm:$true -Force

    2 - If I want add this value via vcenter gui  had to power off he vm and add this , Is that necessary power off machine and run command or this command will be apply on the vm while it is power.on ?

    3- If I want apply above configuration parameter for all vm in my cluster how can write that in powershell ?

    BR



  • 11.  RE: How can add configuration parameter for more than 100 VMS easier
    Best Answer

    Posted Apr 09, 2020 06:26 AM

    It depends what you have in variable $testn.

    This should work

    $testn = Get-VM -Name testn

    New-AdvancedSetting -Entity $testn -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'TRUE' -Confirm:$true -Force

    To activate the setting you have to power off/power on the VM.

    For all VMs in a cluster, you could do

    Get-Cluster -Name MyCluster | Get- VM |

    ForEach-Object -Process {

        New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'TRUE' -Confirm:$true -Force

    }



  • 12.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 06:52 AM

    So thanks

    Is that necessary to power off / power on the vm or can restart the os ?

    On the other hand if I add these setting due the vm is power on will these change apply automatically after the vm reboot for example today I adding  these parameters and will be restart VM about 2 weeks later will it appy ?



  • 13.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 06:54 AM

    A VM reads in the VMX when it is powered on, so you need a power off/power on of the VM.

    A restart of the Guest OS will not work since the VM itself stays powered on.



  • 14.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 06:59 AM

    On the other hand if I add these setting due the vm is power on will these change apply automatically after the vm power off / power on. For example today I adding  these parameters and will be restart VM about 2 weeks later will it appy ?



  • 15.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 07:02 AM

    It should.

    These settings are saved to the VMX file when the VM is powered off.

    You can do a quick test to make sure.
    Do the changes, power off the VM and read what is in the VMX file.

    Your changes should be in there.



  • 16.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 07:19 AM

    As I understood this will apply configuration for all vms

    Get-Cluster -Name MyCluster | Get- VM |

    ForEach-Object -Process {

        New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'TRUE' -Confirm:$true -Force

    }

    instead of MyCluster will be write my cluster name but do I had to write anything  instead of "$_ -Name" ?   what is $?  and what is -Name ?  will it automatically fill that ?



  • 17.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 07:28 AM

    This will apply the setting to all VMs in that cluster.
    And yes, you will have to replace my text MyCluster with the name of your cluster.

    The $_ variable is a predefined variable that contains the object in the pipeline.

    Besides the name of the cluster, you do not have to change anything.



  • 18.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 08:05 AM

    Another appreciate from your help .

    If i want this configuration parameter apply on all of vms with specific guest os such as  Windows,  is that possible ?

    or can I apply this configuration parameters on the vms withe a range Of ip address 10.10.50.50 - 10.10.50.100 ?

    BR



  • 19.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 08:25 AM

    You can use a Where-clause to select VMs based on one or more properties.

    In both cases replace the line

    Get-Cluster -Name MyCluster | Get- VM |

    with (for WIndows Guest OS)

    Get-VM | where{$_.Guest.OSFullName -match "Windows"} |

    or with (for IP range)

    $ipRange = 50..100 | %{"10.10.50.$_"}

    Get-VM | where{$_.Guest.IPAddress | where{$ipRange -contains $_}} |



  • 20.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 08:35 PM

    I am using follow

    Get-VM | where{$_.Name -match "ENV"} |

    ForEach-Object -Process {

    New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.protocolhandler.info.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.guestDnDVersionSet.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.memSchedFakeSampleStats.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.device.connectable.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unityInterlockOperation.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.hgfsServerSet.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.autologon.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.vmxDnDVersionGet.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unity.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.diskShrink.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unity.windowContents.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unityActive.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.ghi.host.shellAction.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.launchmenu.change -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.diskWiper.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unity.taskbar.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.unity.push.update.disable -Value 'TRUE' -Confirm:$true -Force

    New-AdvancedSetting -Entity $_ -Name isolation.tools.ghi.trayicon.disable -Value 'TRUE' -Confirm:$true -Force

    }

    but for each vm as question :

    Perform operation?

    Creating advanced setting 'isolation.tools.ghi.protocolhandler.info.disable' on entity 'Env-A'.

    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):

    how can set Y option in the command that apply for all vms and questions



  • 21.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 08:38 PM

    If you don't want the question, change the -Confirm:$true to -Confirm:$false.



  • 22.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 08:57 PM

    so thanks

    Also , Is this corect ?

    New-AdvancedSetting -Entity $testn -Name tools.setInfo.sizeLimit -Value '2.147483647E9 > Threshold 1048576.0' -Force



  • 23.  RE: How can add configuration parameter for more than 100 VMS easier

    Posted Apr 09, 2020 09:12 PM

    No, that should be something like this.

    This example sets the value to 1MB, which is also the default when this setting is not present.

    New-AdvancedSetting -Entity $testn -Name 'tools.setInfo.sizeLimit' -Value '1048576' -Force -Confirm:$false

    See STIG-V-64109 for more info on the setting.