PoshCode Archive  Artifact Content

Artifact 8d113ed4188124d2a80f523403978b7643a21cdbd141e7c268648eaa0fbe4a51:

  • File Step02b-Import-VM-to-Fol.ps1 — part of check-in [343ee9b5df] at 2018-06-10 13:58:49 on branch trunk — Import vCenter Folder structure incl VM relations (user: Leon Scheltema size: 868)

# encoding: ascii
# api: powershell
# title: Step02b-Import-VM-to-Fol
# description: Import vCenter Folder structure incl VM relations
# version: 0.1
# type: function
# author: Leon Scheltema
# license: CC0
# x-poshcode-id: 5665
# x-archived: 2015-01-15T20:03:25
# x-published: 2015-01-07T12:16:00
#
#
# Import vCenter Folder structure incl VM relations
# By Leon Scheltema AVANCE ICT Groep Nederland
# Functions used by Grzegorz Kulikowski / Robert van den Nieuwendijk

# Begin variables
$NewVC = "New vCenter"
# End variables

# Connect to vCenter server
Connect-VIServer "$NewVC"

$vmlist = Import-Csv "migratedvms.csv"
move-vm -vm $vmlist[0].name -Location (get-view -id $vmlist[0].folder -Server $newVC|get-viobjectbyviview) -Server $NewVC

# Disconnect from vCenter server
Disconnect-VIServer -server "$NewVC" -Force -Confirm:$false