-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVMstartup.ps1
38 lines (31 loc) · 1.07 KB
/
VMstartup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#
.SYNOPSIS
This will set the VM startup order
.DESCRIPTION
Sets the startup delay for one VM at a time
.NOTES
File Name : VMstartup.ps1
Author : gajendra d ambi
Date : Auguest 2015
Prerequisite : PowerShell V3, powercli 5+ over Vista and upper.
Copyright - None
.LINK
Script posted over: ambitech.blogspot.in
#>
#Start of Script
#plugin vmware commands to powershell if running in powershell
Add-PSSnapin VMware.VimAutomation.Core -ea "SilentlyContinue"
#connect to the esxi host
#Write-Host connect to the esxi host with the VMs
#Connect-VIServer
Write-Host please make sure you are connected only to the esxi host with the VMs in it -ForegroundColor Green
#variables
#name of the vm below
$vm = ""
#order at which the vm should start. mention a number/integer ex:- 3
$order = ""
#mention a number/integer. this value is in seconds. ex:- 60
$startdelay = ""
Set-VMStartPolicy -StartPolicy (Get-VMStartPolicy -VM $vm) `
-StartAction PowerOn -StartOrder $order -StartDelay $startdelay
#End of Script