Code Monkey home page Code Monkey logo

esxibackup's Introduction

ESXi Host PowerCLI Backup Utility

A simple powershell script that backs up ESXi hosts.

I'm currently running this in production on Windows server, though it ran in PowerShell for MacOS with the PowerCLI installed through the Install-Module cmdlet. Realistically this should work on any OS that can run PowerShell and the PowerCLI. Feel free to test on Linux if you wish, and let me know how it works out.


Install

1: Get the code

git clone https://github.com/MelonSmasher/EsxiBackup.git;
cd EsxiBackup;
cp config.example.json config.json;

2: Open config.json with a text editor and configure the script

  • backup_repo - Leave backup_repo set to false to use the local folder in this repo called Backup. You can also change this to a UNC network path or explicit folder path.
  • hosts - Configure this JSON array with JSON objects with each hosts DNS or ip address, username, and password.
    • address - The host DNS name or IP address.
    • user - A user on the host. Usually root.
    • pass - The user password. Usually the root password.

3: Install the VMware PowerCLI

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted;
Install-Module -Name VMware.PowerCLI;
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore;

4: Either Enable or disable VMWare CEIP, this prevents a prompt each time the script is run

Enable:

Set-PowerCLIConfiguration -Scope AllUsers -ParticipateInCEIP $true;

Disable:

Set-PowerCLIConfiguration -Scope AllUsers -ParticipateInCEIP $false;

Usage

Backup

Method 1

From PowerShell:

./EsxiBackup.ps1;

Method 2

From the GUI:

Double click on run_backup.bat.

Restore

Connect-VIServer esxi-host-1.domain.tld -user root -password <password>;
Set-VMHost -VMHost esxi-host-1.domain.tld -State Maintenance;
Set-VMHostFirmware -vmhost esxi-host-1.domain.tld -Restore -Force -SourcePath C:\EsxiBackup\configBundle-esxi-host-1.domain.tld.tgz -HostUser root -HostPassword <password>;

Extra Stuff

You can import my scheduled task to Windows Task Scheduler by importing ESXi Backup Windows Task.xml into Windows Task Scheduler. Make sure you've enabled or disabled the CEIP for all users before doing this.

esxibackup's People

Contributors

melonsmasher avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.