Disable-CopyPasta-1.ps1 (modification of post by view diff)
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1475"></script>download | new post
Updated
- Begin {
- $disableCopy = "isolation.tools.copy.enable"
- $disableCopy_value = "false"
- $disablePaste = "isolation.tools.paste.enable"
- $disablePaste_value = "false"
- $disableGUI = "isolation.tools.setGUIOptions.enable"
- $disableGUI_value = "false"
- }
- Process {
- #Make Sure it's a VM
- if ( $_ -isnot [VMware.VimAutomation.Client20.VirtualMachineImpl] ) { co ntinue }
- #Setup our Object
- $vm = Get-View $_.Id
- $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
- $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue
- $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue
- $vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue
- $vmConfigSpec.extraconfig[0].Key=$disableCopy
- $vmConfigSpec.extraconfig[0].Value=$disableCopy_value
- $vmConfigSpec.extraconfig[1].Key=$disablePaste
- $vmConfigSpec.extraconfig[1].Value=$disablePaste_value
- $vmConfigSpec.extraconfig[2].Key=$disableGUI
- $vmConfigSpec.extraconfig[2].Value=$disableGUI_value
- #Run the change
- $vm.ReconfigVM($vmConfigSpec)
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository