diff --git a/vSphere/BatchPatch/vm-create-snapshot.ps1 b/vSphere/BatchPatch/vm-create-snapshot.ps1 new file mode 100644 index 0000000..0c64424 --- /dev/null +++ b/vSphere/BatchPatch/vm-create-snapshot.ps1 @@ -0,0 +1,11 @@ +# Create Snapshot "BeforePatching" of vSphere Machine and Display all Snapshots for the Machine +# Script is called from BatchPatch, Output of Get-Snapshot is displayed there + +param ( + [Parameter(Mandatory=$true)][string]$Computer + ) + +connect-viserver -server SERVERNAME -user USERNAME -password PASSWORD | out-null +New-Snapshot -Server SERVERNAME -VM $Computer* -Name BeforePatching -Memory:$true | out-null +Get-Snapshot -Server SERVERNAME -VM $Computer* | ft Name -HideTableHeaders +Disconnect-VIServer -Server * -Force -Confirm:$false | out-null diff --git a/vSphere/BatchPatch/vm-delete-snapshot.ps1 b/vSphere/BatchPatch/vm-delete-snapshot.ps1 new file mode 100644 index 0000000..7532d49 --- /dev/null +++ b/vSphere/BatchPatch/vm-delete-snapshot.ps1 @@ -0,0 +1,12 @@ +# Delete Snapshot "BeforePatching" of vSphere Machine and display all remaining Snapshots for this machine +# Script is called from BatchPatch, Output from Get-Snapshot is displayed there + +param ( + [Parameter(Mandatory=$true)][string]$Computer + ) + +connect-viserver -server SERVERNAME -user USERNAME -password PASSWORD | out-null +$MySnap = Get-Snapshot -Server SERVERNAME -VM $Computer* -Name BeforePatching +Remove-Snapshot -Snapshot $MySnap -confirm:$false | out-null +Get-Snapshot -Server SERVERNAME -VM $Computer* | ft Name -HideTableHeaders +Disconnect-VIServer -Server * -Force -Confirm:$false | out-null diff --git a/vSphere/BatchPatch/vm-display-snapshot.ps1 b/vSphere/BatchPatch/vm-display-snapshot.ps1 new file mode 100644 index 0000000..36861d1 --- /dev/null +++ b/vSphere/BatchPatch/vm-display-snapshot.ps1 @@ -0,0 +1,10 @@ +# List Snapshots of vSphere Machine +# Script is called from BatchPatch + +param ( + [Parameter(Mandatory=$true)][string]$Computer + ) + +connect-viserver -server SERVERNAME -user USERNAME -password PASSWORD | out-null +Get-Snapshot -Server SERVERNAME -VM $Computer* | ft Name -HideTableHeaders +Disconnect-VIServer -Server * -Force -Confirm:$false | out-null diff --git a/vSphere/BatchPatch/vm-start-virtualmachine.ps1 b/vSphere/BatchPatch/vm-start-virtualmachine.ps1 new file mode 100644 index 0000000..703fb03 --- /dev/null +++ b/vSphere/BatchPatch/vm-start-virtualmachine.ps1 @@ -0,0 +1,10 @@ +# Start vSphere Machine +# Script is called from BatchPatch + +param ( + [Parameter(Mandatory=$true)][string]$Computer + ) + +connect-viserver -server SERVERNAME -user USERNAME -password PASSWORD | out-null +Start-VM -Server SERVERNAME -VM $Computer* -Confirm:$false +Disconnect-VIServer -Server * -Force -Confirm:$false | out-null diff --git a/vSphere/BatchPatch/vm-update-tools.ps1 b/vSphere/BatchPatch/vm-update-tools.ps1 new file mode 100644 index 0000000..f46cfeb --- /dev/null +++ b/vSphere/BatchPatch/vm-update-tools.ps1 @@ -0,0 +1,10 @@ +# Update VMware Tools on vSphere Machine +# Script is called from BatchPatch + +param ( + [Parameter(Mandatory=$true)][string]$Computer + ) + +connect-viserver -server SERVERNAME -user USERNAME -password PASSWORD | out-null +Update-Tools -Server SERVERNAME -VM $Computer* -NoReboot +Disconnect-VIServer -Server * -Force -Confirm:$false | out-null