Template registration using powerCLI on multiple vcenter


1.
connect-viserver vcenter2-tsg1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
disconnect-viserver -confirm:$false

2. $cluster = Get-Content .\vcsa.txt

3. Disconnect-VIServer * -Confirm:$false

4. Connect-VIServer $cluster

5. Get-Template  rhel62-x86_64-vanilla-1.0.2 | ft Name,@{N="vCenter";E={$_.ExtensionData.CLient.ServiceUrl.Split('/')[2]}} -AutoSize


For All DC


connect-viserver vcenter-ams1.mhint       
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-ams1-esxi03.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-ams1-esxi03.mhint
disconnect-viserver -confirm:$false



connect-viserver vcenter-cal1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cal1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cal1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cal1-esxi01.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter-cse1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cse1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cse1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-cse1-esxi01.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter-fra4.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-fra4-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-fra4-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-fra4-esxi01.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter-ruh1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-ruh1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-ruh1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-ruh1-esxi01.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter-sin1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sin1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sin1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sin1-esxi01.mhint
disconnect-viserver -confirm:$false



connect-viserver vcenter-sv2.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sv2-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sv2-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-sv2-esxi01.mhint
disconnect-viserver -confirm:$false


connect-viserver vcenter-syd1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd1-esxi01.mhint
disconnect-viserver -confirm:$false


connect-viserver vcenter-syd2.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd2-esxi02.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd2-esxi02.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-syd2-esxi02.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter-va2.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-va2-esxi05.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-va2-esxi05.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-va2-esxi05.mhint
disconnect-viserver -confirm:$false



connect-viserver vcenter-va3.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-va3-esxi05.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-va3-esxi05.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter2-mdl1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-mdl1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-mdl1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-mdl1-esxi01.mhint
disconnect-viserver -confirm:$false




connect-viserver vcenter2-tsg1.mhint
New-Template -Name rhel62-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel62-x86_64-vanilla-1.0.2/rhel62-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
New-Template -Name rhel64-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel64-x86_64-vanilla-1.0.2/rhel64-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
New-Template -Name rhel65-x86_64-vanilla-1.0.2 -TemplateFilePath "[vmtemplates] rhel65-x86_64-vanilla-1.0.2/rhel65-x86_64-vanilla-1.0.2.vmtx" -Location ( Get-Folder -Name Templates ) -VMHost mgmt-tsg1-esxi01.mhint
disconnect-viserver -confirm:$false

Comments

Popular posts from this blog

Using Non-Maskable Interrupt (NMI) facilities to troubleshoot unresponsive VMware Virtual Machine.

Removing invalid linked clone entries automatically using the ViewDBChk tool

VMTool update steps on Horizon VDI Parent VM