https://github.com/cviorel/powerclicore-docker
https://github.com/cviorel/powerclicore-docker
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cviorel/powerclicore-docker
- Owner: cviorel
- License: mit
- Created: 2021-09-15T08:29:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-22T08:08:37.000Z (over 3 years ago)
- Last Synced: 2024-08-14T07:06:40.894Z (10 months ago)
- Language: PowerShell
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - cviorel/powerclicore-docker - (PowerShell)
README
# Manage VMs using PowerCLI
## Download the container from the docker hub
```sh
docker pull vmware/powerclicore
```## Open an interactive Terminal and run
```sh
docker run --rm -it vmware/powerclicore /bin/bash
```## Create snapshot
```sh
source .envdocker run --rm \
--entrypoint="/usr/bin/pwsh" \
-e VI_SERVER=${VI_SERVER} \
-e VI_USERNAME=${VI_USERNAME} \
-e VI_PASSWORD=${VI_PASSWORD} \
-v ${PWD}/vm_list:/tmp/vm_list \
-v ${PWD}/scripts:/tmp/scripts \
vmware/powerclicore \
/tmp/scripts/take-snapshot.ps1
```## Revert to last snapshot
```sh
source .envdocker run --rm \
--entrypoint="/usr/bin/pwsh" \
-e VI_SERVER=${VI_SERVER} \
-e VI_USERNAME=${VI_USERNAME} \
-e VI_PASSWORD=${VI_PASSWORD} \
-v ${PWD}/vm_list:/tmp/vm_list \
-v ${PWD}/scripts:/tmp/scripts \
vmware/powerclicore \
/tmp/scripts/revert-lastsnapshot.ps1
```## Remove snapshots
```sh
source .envdocker run --rm \
--entrypoint="/usr/bin/pwsh" \
-e VI_SERVER=${VI_SERVER} \
-e VI_USERNAME=${VI_USERNAME} \
-e VI_PASSWORD=${VI_PASSWORD} \
-v ${PWD}/vm_list:/tmp/vm_list \
-v ${PWD}/scripts:/tmp/scripts \
vmware/powerclicore \
/tmp/scripts/remove-snapshot.ps1
```