I am running latest vmware/powercli via docker image:
REPOSITORY TAG IMAGE ID CREATED SIZE
vmware/powerclicore latest a0fceeaed43e 2 months ago 372MB
If I run the following code locally on my Mac:
myscript.ps1
param (
[string] $vcenter,
[string] $username,
[string] $password
)
Connect-Viserver -Server $vcenter -Force -WarningAction SilentlyContinue -username $username -password $password | Out-Null
New-Snapshot -VM myvm -Name "testsnapshot" -Description "This is a test"
Disconnect-VIServer * -Confirm:$false
I works with no error.
When I run the same code within the docker container
docker run --rm -i --entrypoint="/usr/bin/pwsh" -v /Users/cknudtso:/tmp/scripts vmware/powerclicore:latest /tmp/scripts/myscript.ps1
I get the following error
New-Snapshot: /tmp/scripts/myscript.ps1:11
Line |
11 | New-Snapshot -VM myvm -Name "testsnapshot" -Description "This is a …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 07/31/2020 19:25:07 New-Snapshot Length cannot be less than zero. (Parameter 'length')
The snapshot is created but why am I receiving the error????