Let me start by saying that by no means im a scripting guy this is more for my own needs. copy all the below test in to notepad and save as a VBS.
Option explicit
Dim oShell
set oShell= Wscript.CreateObject("WScript.Shell")
oShell.Run "RunAs /noprofile /user:domain\administrator ""c:\path\to\prog.exe""",2 "use the ,2 to minimize the DOS box that will run your program"
WScript.Sleep 500
oShell.Sendkeys "PASSWORD~" "remember to keep the ~ as this sends an enter after your password"
Wscript.Quit
Friday, 28 October 2011
Tuesday, 25 October 2011
Find memory/CPU reservation on all VMs
To retrieve the settings for reservation of both memory and CPU run the following PS script
## retrieve the values for MemReservationMB for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,MemReservationMB
## retrieve the values for CPUReservationMhz for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,CPUReservationMhz
If you want to go through a set all VM memroyCPU reservations to "0" run the following
## set the MemReservationMB to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemReservationMB 0 -Confirm:$false
## set the CPUReservationMhz to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CPUReservationMhz 0 -Confirm:$false
## retrieve the values for MemReservationMB for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,MemReservationMB
## retrieve the values for CPUReservationMhz for the given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | select VM,CPUReservationMhz
If you want to go through a set all VM memroyCPU reservations to "0" run the following
## set the MemReservationMB to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -MemReservationMB 0 -Confirm:$false
## set the CPUReservationMhz to 0 for given VMs
Get-Cluster "myCluster" | Get-VM | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CPUReservationMhz 0 -Confirm:$false
Tuesday, 4 October 2011
VMware PS Script to export Datastores Information
Get-View -ViewType Datastore | %{
$_ | Select Name,
@{N="Location";E={$_.Summary.Url}},
@{N="Type";E={$_.Summary.Type}},
@{N="Hosts Connected";E={$_.Host.Count}},
@{N="VMs Connected";E={$_.Vm.Count}},
@{N="Capacity";E={"{0:n2} GB"-f ($_.Summary.Capacity/1GB)}},
@{N="Provisioned";E={"{0:n2} GB"-f (($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB)}},
@{N="Free";E={"{0:n2} GB"-f ($_.Summary.FreeSpace/1GB)}}
} | Export-csv ("c:\VMreports\Datastore-"+$a+".csv")
$_ | Select Name,
@{N="Location";E={$_.Summary.Url}},
@{N="Type";E={$_.Summary.Type}},
@{N="Hosts Connected";E={$_.Host.Count}},
@{N="VMs Connected";E={$_.Vm.Count}},
@{N="Capacity";E={"{0:n2} GB"-f ($_.Summary.Capacity/1GB)}},
@{N="Provisioned";E={"{0:n2} GB"-f (($_.Summary.Capacity - $_.Summary.FreeSpace + $_.Summary.Uncommitted)/1GB)}},
@{N="Free";E={"{0:n2} GB"-f ($_.Summary.FreeSpace/1GB)}}
} | Export-csv ("c:\VMreports\Datastore-"+$a+".csv")
Subscribe to:
Posts (Atom)