VM Created and Deleted events using PowerCLI

A quick one liner to find the the users who created or deleted the VM in the past 7 days. This can be fetched using the TaskEvent which has the description VmBeingDeployedEvent or VmBeingClonedEvent and VmRemovedEvent . If you want  to know the count for longer period then change the number AddDays to longer value Here is code for getting the VM creation […]

FacebookTwitterGoogle+LinkedInShare

Storage vMotion Events using PowerCLI

In the previous post I have showed how to get the count of the vMotion using PowerCLI. In this I will walkthrough the events which we can use the track the Storage vMotion using PowerCLI. The Storage vMotion events can be tracked using the description VirtualMachine.relocate and StorageResourceManager.applyRecommendation and here is the quick one line which you […]

FacebookTwitterGoogle+LinkedInShare

vMotion Count using PowerCLI

A quick one liner to find the count of vMotion which has happened in the past 24 hrs. This can be fetched using the TaskEvent which has the description  VirtualMachine.migrate. If you want  to know the count for longer period then change the number AddDays to longer value   Get-VIEvent -Entity (Get-VM -Location $_) -MaxSamples ([int]::MaxValue) -Start […]

FacebookTwitterGoogle+LinkedInShare

VM Advanced settings with PowerCLI

Applying VM advanced settings manually on each individual VM’s can be tedious task and need to Power down the VM to perform the activity. With the help of PowerCLI the task has been very much simplified with the help of cmdlet called New-AdvancedSetting I use the below script to to add the additional settings to […]

FacebookTwitterGoogle+LinkedInShare

Listing Memory Limits on VM’s using PowerCLI

A quick small post to list the memory limits on the VM and set it back to unlimited using a PowerCLI To list the VM’s which have memory limit configured Get-VM | Get-VMResourceConfiguration | where {$_.MemLimitMB -ne ‘-1’}  | Select VM,MemLimitMB And to set it to unlimited Get-VM | Get-VMResourceConfiguration | where {$_.MemLimitMB -ne ‘-1’}  | Set-VMResourceConfiguration […]

FacebookTwitterGoogle+LinkedInShare

Creating VM using PowerCLI

A quick post to build multiple VM’s using PowerCLI Import-Csv “D:Scriptsvm.csv” -UseCulture | %{ Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping |` Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_.”IP” ` -SubnetMask $_.SM -DefaultGateway $_.DG -Dns $_.DNS $vm=New-VM -Name $_.”VM” -Template $_.Template -Host $_.”ESX” ` -Datastore $_.Datastore -OSCustomizationSpec $_.Customization -Confirm $False-RunAsync:) } Input of the CSV file is as below Enjoy […]

FacebookTwitterGoogle+LinkedInShare

Creating Datacenter & Cluster using PowerCLI

A qucik one liner for creating datacenter and cluster using PowerCLI. We have good cmdlets in powerCLI which will help us to perform the task without need to open vSphere Client/webclient. To create a Datacenter we have cmdlet called New-Datacenter which will help us to create a datacenter in the vCenter. The parametes required are […]

FacebookTwitterGoogle+LinkedInShare

List Number of VM’s in a Datastore

Here is quick way to get number of VM’s running on each datastore using PowerCLI Get-Datastore | Select Name, @{N=”NumVM”;E={@($_ | Get-VM | where {$_.PowerState -eq “PoweredOn”}).Count}} | Sort Name| Out-Gridview Output If you wish to export the results to Excel you could use Export-CSV cmdlets

FacebookTwitterGoogle+LinkedInShare
Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com