You are on page 1of 1

Encontrar Maquina por IP

get-view -viewtype VirtualMachine | ?{($_.Guest.Net | %{ $_.IpAddress}) -contains


"10.20.0.49"}

Consultar tareas de remover Snapshot en ejecucion.


Get-Task -Status "Running" | where {$_.Name -eq "RemoveSnapshot_Task"}

COnectar a Vcenter
Connect-VIServer -Server 172.30.30.29 -WarningAction SilentlyContinue

Consultar todos los snapshots


get-vm | get-snapshot | Select VM,Name,Powerstate, SizeMB | Export-Csv
c:\AllSnaps.csv -NoTypeInformation

$entity = Get-VM -Name SRV-EDURAS


Get-VIEvent -Entity $entity -MaxSamples 1000 | Select
CreatedTime,UserName,FullFormattedMessage

Get-VIEvent -Entity SRV-EDURAS -MaxSamples 1000 | Select


CreatedTime,UserName,FullFormattedMessage

Connect-VIServer -Server 10.23.113.41

$events = Get-VIEvent -MaxSamples 100


foreach ($event in $events) {if ($event.fullFormattedMessage -match "User
(.*)@\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b logged in") {Write-Host ("User " +
$matches[1] + " logged in at:" + $event.createdTime)} }

$start = (Get-Date).AddDays(-1)
Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start | where{$_ -is
[VMware.Vim.VmPoweredOffEvent] -or $_ -is [VMware.Vim.VMPoweredOnEvent]} | Select
CreatedTime,@{N='VM';E={$_.Vm.Name}},@{N='Type';E={$_.GetType().Name}}

$start = (Get-Date).AddDays(-1)
Get-VIEvent -Entity SRV-EDURAS -MaxSamples ([int]::MaxValue) -Start $start |
where{$_.FullFormattedMessage -like "*snapshot*"} | Select
CreatedTime,UserName,FullFormattedMessage

$start = (Get-Date).AddDays(-1)
Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start |
where{$_.FullFormattedMessage -like "*snapshot*"} | Select
CreatedTime,UserName,FullFormattedMessage

You might also like