我正在尝试使用PowerCLI修补后删除旧快照。我现在使用的代码是:
Get-VM | Get-Snapshot | Remove-Snapshot -confirm$false
效果很好......但它一次只删除一个,我希望它一次做2-3个。这可能吗?
提前致谢!
答案 0 :(得分:0)
此代码将从所有虚拟机中删除多个快照:
Get-VM | Get-Snapshot | % { Remove-Snapshot $_ -Confirm:$false }
我建议先选择一个虚拟机并进行测试:
$VM = Get-VM -Name 'My Virtual Machine'
$VM | Get-Snapshot | % { Remove-Snapshot $_ -Confirm:$false }
经过测试可以使用PowerCLI 6.5。
答案 1 :(得分:0)
我建议你看一下' RunAsync'参数。这将创建任务,然后转到下一个任务,而无需等待先前的任务完成。
示例:
version: '3'
services:
minio1:
image: minio/minio
volumes:
- minio-data1:/export
ports:
- "9001:9000"
networks:
- minio_distributed
environment:
MINIO_ACCESS_KEY: <ACCESS>
MINIO_SECRET_KEY: <SECRET>
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export
minio2:
image: minio/minio
volumes:
- minio-data2:/export
ports:
- "9002:9000"
networks:
- minio_distributed
environment:
MINIO_ACCESS_KEY: <ACCESS>
MINIO_SECRET_KEY: <SECRET>
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export
minio3:
image: minio/minio
volumes:
- minio-data3:/export
ports:
- "9003:9000"
networks:
- minio_distributed
environment:
MINIO_ACCESS_KEY: <ACCESS>
MINIO_SECRET_KEY: <SECRET>
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export
minio4:
image: minio/minio
volumes:
- minio-data4:/export
ports:
- "9004:9000"
networks:
- minio_distributed
environment:
MINIO_ACCESS_KEY: <ACCESS>
MINIO_SECRET_KEY: <SECRET>
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export
volumes:
minio-data1:
minio-data2:
minio-data3:
minio-data4:
networks:
minio_distributed:
driver: overlay