PowerCLI

 View Only
  • 1.  Editting multiple VMX settings for multiple VMs

    Posted Nov 17, 2014 09:02 PM

    I have over 300 VMs that need some VMX settings added and this would take forever to do by hand.  I've searched and have not found a script or one-liner to do the job.  Everything I find is either a script to change multiple VMX settings for a VM or to change one VMX setting for multiple VMs.  I'm still relatively new at PowerCLI but need some help getting this to work.  These are the VMX settings I need to add:

    Key,Value

    isolation.tools.ghi.autologon.disable,True

    isolation.bios.bbs.disable,True

    isolation.tools.getCreds.disable,True

    isolation.tools.ghi.launchmenu.change,True

    isolation.tools.memSchedFakeSampleStats.disable,True

    isolation.tools.ghi.protocolhandler.info.disable,True

    isolation.ghi.host.shellAction.disable,True

    isolation.tools.dispTopoRequest.disable,True

    isolation.tools.trashFolderState.disable,True

    isolation.tools.ghi.trayicon.disable,True

    isolation.tools.unity.disable,True

    isolation.tools.unityInterlockOperation.disable,True

    isolation.tools.unity.push.update.disable,True

    isolation.tools.unity.taskbar.disable,True

    isolation.tools.unityActive.disable,True

    isolation.tools.unity.windowContents.disable,True

    isolation.tools.vmxDnDVersionGet.disable,True

    isolation.tools.guestDnDVersionSet.disable,True

    Thanks for your help!



  • 2.  RE: Editting multiple VMX settings for multiple VMs

    Posted Nov 21, 2014 12:56 AM

    Try this and let me know, tested on my test virtual machine and it works:

    Get-VM -Name steven_test | New-AdvancedSetting -Name isolation.tools.ghi.autologon.disable -Value True -Type VM (You can use -Confirm:$false to disable the following Y/N)

    Perform operation?                                                                                                                                                                                                                                                                                                           

    Creating advanced setting 'isolation.tools.ghi.autologon.disable' on entity 'steven_test'.                                                                                                                                                                                                                                   

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

                                                                                                                                                                                                                                                                                                                                 

    Name                 Value                Type                 Description                                                                                                                                                                                                                                   

    isolation.tools.g... True                 VM                                           

    Then I ran the following to check:

    Get-VM -Name steven_test | Get-AdvancedSetting | where {$_.Name -eq "isolation.tools.ghi.autologon.disable"}

    Name                 Value                Type                 Description                                                                                                                                                                                                                                   

    isolation.tools.g... True                 VM                             

    Hope this helps.

    Steven.



  • 3.  RE: Editting multiple VMX settings for multiple VMs

    Posted Nov 21, 2014 01:02 PM

    Steven,

    Thanks for the input.  This will be perfect when I edit my Horizon View master images.  The bigger problem I'm having is editing the VMX files for 379 pre-existing VDI with the entries I've listed above.  Thanks!



  • 4.  RE: Editting multiple VMX settings for multiple VMs

    Posted Nov 25, 2014 10:45 AM

    Take a look here for example

    Powercli for VM hardening 5.5

    Just put the settings you want to make in a text or CSV file and apply them to the VM's with a simple loop.

    AFAIK there are certain settings which can be set this way but only should work properly as soon as the VM is re-registered to vCenter. i'm not sure if it's still applicable and which settings this will be.

    And be sure to test the setting before applying them to your production environment!



  • 5.  RE: Editting multiple VMX settings for multiple VMs

    Posted Mar 28, 2017 04:50 PM

    You can "reload" settings from modified vmx, even if VM is powered on.

    @("vmname") | % {(get-vm $_ | get-view).reload()}



  • 6.  RE: Editting multiple VMX settings for multiple VMs

    Posted Mar 28, 2017 06:07 PM

    I'm not sure the Reload works for all settings.

    Some settings can only be implemented on a power on afaik.