Last active
December 19, 2015 01:08
-
-
Save lazywinadmin/5873388 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 3.0 | |
#requires -PSSnapin VMware.VimAutomation.Core | |
function Enable-VMCopyPaste | |
{ | |
[CmdletBinding()] | |
PARAM( | |
[string[]]$vm | |
) | |
BEGIN{ | |
Write-Verbose -Message "Checking if there is any VI Server Active Connection" | |
if(-not($global:DefaultVIServers.count -gt 0)){ | |
Write-Warning -Message "Wow You are not connected to any Vi Server. Use Connect-ViServer first" | |
break | |
} | |
Write-Verbose -Message "At least one VI Server Active Connection Found" | |
} | |
PROCESS{ | |
TRY{ | |
foreach ($item in $vm){ | |
Write-Verbose -Message "$item - Setting the isolation.tools.copy.disable AdvancedSetting to $false..." | |
New-AdvancedSetting ` | |
-Entity $item ` | |
-Name isolation.tools.copy.disable ` | |
-Value $false ` | |
-confirm:$false ` | |
-force:$true ` | |
-errorAction 'Continue' | |
Write-Verbose -Message "$item - Setting the isolation.tools.paste.disable AdvancedSetting to $false..." | |
New-AdvancedSetting ` | |
-Entity $item ` | |
-Name isolation.tools.paste.disable ` | |
-Value $false ` | |
-confirm:$false ` | |
-force:$true ` | |
-errorAction 'Continue' | |
} | |
} | |
CATCH{ | |
Write-Warning -Message "Wow Something went wrong with $item" | |
} | |
FINALLY{} | |
} | |
END{Write-Verbose -Message "Script completed"} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
let me try