diff --git a/PowerCLIPublicRepoPrinciplesofOperations.md b/README.md similarity index 98% rename from PowerCLIPublicRepoPrinciplesofOperations.md rename to README.md index e918dc5..3e9c612 100644 --- a/PowerCLIPublicRepoPrinciplesofOperations.md +++ b/README.md @@ -1,4 +1,4 @@ -# PowerCLI Public Repo +# PowerCLI Community Repository ## Principles of Operations ## Table of Contents * Abstract @@ -28,7 +28,7 @@ * VMWARE TECHNOLOGY PREVIEW LICENSE AGREEMENT ## Abstract -This document will serve for collaboration to identify the operating principles of a centralized PowerCLI resource repo on GitHub. +This document will serve for collaboration to identify the operating principles of a centralized PowerCLI Community Repository on GitHub. The central PowerCLI repo will be located at: ## Content Restrictions @@ -158,4 +158,4 @@ The VMware Technnology Preview License Agreement: + +# ---------------------------------------- +# USER CONFIGURATION - EDIT AS NEEDED +# ---------------------------------------- +$DefaultVIServer = "vcsa.lab.local" +$vCUser = "root" +$vCPass = "VMware1!" +$target_vcenter = "VCSA" +$target_vcenter_user = "root" +$target_vcenter_password = "VMware1!" +$Location = "C:\temp" +$vC_Partition = "C:" +# ---------------------------------------- +# END USER CONFIGURATION +# ---------------------------------------- + +# Sysprep Folders on vCenter +$folders = @("2k","svr2003-64","svr2003","xp","1.1","xp-64") + +# Add PowerCLI Snapin +Add-PSSnapin vmware.vimautomation.core + +# Connect to vCenter +connect-viserver $DefaultVIServer -user $vCUser -password $vCPass + +# Get view of the vCenter data +$myVC= get-vm $target_vcenter | get-view + +# $OS captures the Operating System Name +$OS = $myVC.config.GuestFullName + +# Switch of Operating System +switch -wildcard ($OS) +{ +# As per the compatibility guide, all OS's from the compatibility guide have been added +"*SUSE*" {Write-Host "This is a SUSE Machine" -ForegroundColor Green; $OS = "VCSA"} +"* XP *" {Write-Host "This is a Windows XP Machine" -ForegroundColor Green} +"* 2003 *" {Write-Host "This is a Windows Server 2003 Machine" -ForegroundColor Green} +"* 2008 *" {Write-Host "This is a Windows Server 2008 Machine" -ForegroundColor Green} +"* 2012 *" {Write-Host "This is a Windows Server 2012 Machine" -ForegroundColor Green} +Default {Write-Host "This is the default" -ForegroundColor Green} +} +Write-Host "" + +# If Location is not set, ask user to input location +if ($Location -eq ""){ +$Location = Read-Host "Where is the sysprep file located? (ex. c:\temp) " +} + +# Cycle through Sysprep Folders on local machine +foreach($folder in $folders){ +if ($OS -eq "VCSA"){$Destination = "/etc/vmware-vpx/sysprep/$folder"} else {$Destination = "$vC_Partition\ProgramData\VMware\VMware VirtualCenter\Sysprep\$folder"} + +# Get files from each folder +Get-ChildItem "$($Location)\$($folder)" -ErrorAction SilentlyContinue | ForEach-Object { +$source = "$($Location)\$($folder)\$_" + +Write-Host "Transferring File `"$_`" " -ForegroundColor Green #Source = $source" -ForegroundColor Green +Write-Host "Destination = $Destination" -ForegroundColor Green + +# Copy Files to vCenter Sysprep folders +Copy-vmguestfile -source "$source" -Destination "$Destination" -VM "$target_vcenter" -LocalToGuest -GuestUser "$target_vcenter_user" -GuestPassword "$target_vcenter_password" + +} +} +Disconnect-viServer -confirm:$false diff --git a/Scripts/Sysprep_Automation_Script_v1a.ps1 b/Scripts/Sysprep_Automation_Script_v1a.ps1 deleted file mode 100644 index 64a5c92..0000000 Binary files a/Scripts/Sysprep_Automation_Script_v1a.ps1 and /dev/null differ