Recovery of vSphere PowerCLI with alarms

Hello

Can you please help me write a PowerCLI script that would recover the vSphere alarms?

I want the script to show only alarms last 24 hours only if not acknowledged or deleted.

Example:

Get-VIEvent - MaxSamples 10 | Select Fullformattedmessage # this command shows me the last 10 events

Win01 from green to Red alarm # the script "MyAlarm" should show me this alarm

win01 on esx1.company.pri in Lodz is turned off

win01 on esx1.company.pri in Lodz stops

Task: Stop virtual machine

win01 on esx1.company.pri in Lodz is turned on

Message on win01 on esx1.company.pri in Lodz: running VMware ESX in a virtua...

starts win01 on the host esx1.company.pri in Lodz

Task: Power on virtual machine

Task: Initialize turn

Alarm"monitor the health status"on changed from yellow to green data centers.

Help, please.

If the alarm was not recognized and authorized, it should still show.

You can see these alarms with

$dc = get - file - name of data centers

$dc. ExtensionData.TriggeredAlarmState |

Select @{N = 'Entity'; E = {Get-view-Id $_.} Entity | {{Select - ExpandProperty name}}.

OverallStatus,

@{N = "alarm"; E = {(Get-View-ID $_.)} Alarm). Info.Name}}

-What are you looking for?

Tags: VMware

Similar Questions

  • Errors in PowerCLI with vSphere Autodeploy

    During the execution of certain tasks, I get the following error. Run the latest versions of vsphere powercli.

    Exception: System.Web.Services.Protocols.SoapException: method not found: CheckP
    xeProfileForProblems
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse (SoapClie
    ntMessage message, WebResponse, Stream responseStream, Boolean asyncCal reply
    (l)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (String methodN
    SOUL, Object [] parameters)
    at RbdApi.RbdService.CheckPxeProfileForProblems (ManagedObjectReference _this)

    at VMware.DeployAutomation.RbdHelper.ConvertToPxeProfile (RbdClient rbdClient,
    RemoteImageProfile profileWrapper)

    IM also from problems with the autodeploy host suspended after that the first hidden and I believe that this can contain it upward.

    Looks like you are using a newer version of PowerCLI with a pre - GA autodeploy version.

  • Using Windows Powershell ISE with vSphere PowerCLI

    Hey everybody,

    I'm completely newbieand have just started on the track "managing vSphere with powershell. First problem:

    Is it possible to use Windows Powershell ISE with vSphere cmdlets or can I only use the vSphere PowerCLI?

    I wish I could type my commands directly in the window of the ISE and manage my scripts etc because of this (I find myself n always cut and paste from Notepad when you use the PowerCLI).

    If so, how should I do this?

    I guess its something simple, but when I run the ISE seems not to have registered vSphere cmdlets. I guess I missed something?

    Thank you

    Marc

    In the ISE if you run the following cmdlet, you will get the registered PowerCLI cmdlets:

    Add-PSSnapin "Vmware.VimAutomation.Core".

  • Using PowerCLI with Flexclone rapidclone re - deploy multiple servers daily

    Hello

    We currently use vSphere4.1 with SAN NetApp Flexclone Rapidclone installed We have deployed multiple servers with success of a model of Flexclone using rapidclone.

    The servers in question are Windows 2008 RDS servers, which we would like to destroy and recreate on a daily basis.

    We want to make use of the feature to "Redeploy" Flexclone, which will equip the servers and redploy image, but we want to do this on a planning automated nightly.

    There are not many examples on the web on how to do it and with which application.

    I suppose the obvious choice to be PowerCLI, but don't have any idea how to write the script.

    Can anyone provide information on how to go about starting this script, or if there is a record of the tool that will convert mouse movements in vSphere PowerCLI commands. I tried to use Onyx 2.0 but for some reason it produces no output when cloning using "NetApp - implemented service & cloning" in the context menu in vShpere.

    Any help would be much appreciated.

    Kind regards

    New year's Eve.

    I think that this rapidclone does not use methods public vSphere API.

    This probably explains why you don't see nothing in Onyx.

    This rapidclone comes with API and/or the cmdlets?

  • Addition of VMDK to VM in new vSphere PowerCLI

    Hi all

    This message goes hand in hand with may last post and involve the transfer of uncomfortable the new vSphere PowerCLI from the VItoolkit on VMware 3.5.

    One of my scripts uses some functions to add existing VMDK files on an existing virtual machine. The big problem is - this code is a reason any invalid in the CLI of new power.

    As you can see - functions have simple command line with VM, VMDK file and the number of SCSI controller. Can someone hazard a guess then that this process is no longer valid for PowerCLI?

    Thank you in advance: o)

    1. Functions

    # #Examples

        1. Add HD "PC4" "vmfs2" "PC4/PC4.vmdk" "controller SCSI 0".

        2. VM-delete-HD 'name' "disk hard 3" $TRUE ".

    function add-HD {}

    Param ($VMname, $SCSIcntrl, $DSname, $Filename)

    #write - host "adding disc $Filename data $DSname $VMname-VM store."

    $vm = get - View (Get - VM $VMname) USER.USER

    $ds = get - View (Get-Datastore-name $DSname) USER.USER

    {foreach ($dev to $vm.config.hardware.device)}

    If ($dev.deviceInfo.label - eq $SCSIcntrl) {}

    $CntrlKey = $dev.key

    }

    }

    $Unitnumber = 0

    $DevKey = 0

    {foreach ($dev to $vm.config.hardware.device)}

    If ($dev.controllerKey - eq $CntrlKey) {}

    If ($dev. Unitnumber - gt $Unitnumber) {$Unitnumber = $dev. Unitnumber}

    If ($dev.key - gt $DevKey) {$DevKey = $dev.key}

    }

    }

    LogEntry $sLogFile 'DeviceKey is $DEVKEY, UnitNUm is $UnitNUmber, ContrlKey is $CntrlKey.

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.deviceChange = @)

    $spec.deviceChange += new-Object VMware.Vim.VirtualDeviceConfigSpec

    $spec.deviceChange [0] = new-Object VMware.Vim.VirtualDisk .device

    $spec.deviceChange [0].device.backing = new-Object VMware.Vim.VirtualDiskFlatVer2BackingInfo

    $spec.deviceChange [0].device.backing.datastore = $ds. MoRef

    $spec.deviceChange [0].device.backing.fileName = "" + $Filename

    $spec.deviceChange [0].device.backing.diskMode = "independent_persistent".

    $spec.deviceChange [0].device.key = $DevKey + 1

      1. UnitNUmber SCSIID 7 is reserved for the controller - so ignore it and move on to 8.

    If ($Unitnumber - eq 6) {$Unitnumber = $Unitnumber + 1}

    $spec.deviceChange [0].device.unitnumber = $Unitnumber + 1

    $spec.deviceChange [0].device.controllerKey = $CntrlKey

    $spec.deviceChange [0] .operation = 'Add '.

    $vm. ReconfigVM_Task ($spec)

    }

    delete-HD {} feature

    Param ($VMname, $HDname, $Delflag)

    #write-host "' disassembly disk for VM $HDname: $VMname" "

    $vm = get - View (Get - VM $VMname) USER.USER

    foreach ($dev in $vm. Config.Hardware.Device) {}

    If ($dev. DeviceInfo.Label - eq $HDname) {}

    $key = $dev. Key

    $name = $dev. Backing.FileName

    }

    }

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.deviceChange = @)

    $spec.deviceChange += new-Object VMware.Vim.VirtualDeviceConfigSpec

    $spec.deviceChange [0] = new-Object VMware.Vim.VirtualDevice .device

    $spec.deviceChange [0].device.key = $key

    $spec.deviceChange [0] .operation = 'delete '.

    $vm. ReconfigVM_Task ($spec)

    If {($Delflag)

    $svcRef = new-object VMware.Vim.ManagedObjectReference

    $svcRef.Type = 'ServiceInstance.

    $svcRef.Value = 'ServiceInstance.

    $serviceInstance = get-views $svcRef

    $fileMgr = get-view $serviceInstance.Content.fileManager

    $datacenter = (get-View (Get - VM $VMname |)) Get-Datacenter) USER.USER) .get_MoRef)

    $fileMgr.DeleteDatastoreFile_Task ($name, $datacenter)

    }

    }

    Below the new versions of my HD - Add and Remove-HD functions.

    The functions Add - HD had an error in this line

         $spec.deviceChange[0].device.backing.fileName =" " + $Filename
    

    The function Remove-HD can be optimized in vSPhere.

    With the help of the LayoutEx.Disk property, you can now find all the files that are located behind a virtual disk.

    The new versions are attached because there are some hooks in the code.

  • Want J010dx m7: windows will not start until after full recovery of the system with new HARD drive

    Hello world

    I need help here.

    My HP envy m7 J010dx works perfectly with my original hard drive (1 TB).

    I am preparing a second HDD (NEW 320) as backup.

    I took off the Moose HDD (1 TB) and replace it with the NEW HARD drive (320GB) and try to do a full recovery of the system with the HP recovery DVD.

    After full system recovery and laptop computer needs to be restarted in order to continue, the laptop keeps restarting on the logo of windows 8.

    I think it says device not found Boot. Also a test using the UEFI tool material HP and all pass.

    Replacing the NEW HARD drive with the original of the old HARD drive and it start normally.

    What can go wrong here in this case? Thank you very much for the help.

    Concerning

    John

    OK, I read through the thread and this is my point of view on this based on works including restore process with the user created a recovery (UCRDs) media which the user indicated that they used.

    If you just want to jump to the conclusion at the bottom, you can see my opinion. If you want to know 'why' Please read the entire post.

    Model No.: m7-j010dx

    Product #: E0K83UA #ABA

    Ships OS: Windows 8 (64-bit)

    Recovery HP part No. Kit: 730336-002 (3 DVDs + extra)

    User replaced the HARD drive with a 1 TB hard drive 5400 RPM with HP ProtectSmart hard drive Protection a new hard drive is a Seagate Momentus 7200.4 ST9320423AS 320 GB 7200 RPM 16 MB Cache SATA 3.0 GB / s 2.5 "Notebook internal hard drive.

    With the help of UCRDs sent media recovery media (SSRDs):

    When the UCRDs are created, only the drivers for the HW operation (this is a critical point, that I will look later) are burned to the user created a recovery media.  Consider this a snapshot of the current HW, the base drivers and software applications.   If you change the HW on your laptop or desktop where the additional device requires a different driver for these features, a few questions you might - recovery process could stop because he can't find the right driver, a blue screen, a lack of start-up or other unstable system.

    A few years ago, I had a PC that would not recover because the Blu - ray (ODD) optical disk drive did not work.  I replaced the WEIRD Blu - ray with a generic DVD/CD burner into the new part of Blu - ray is presented.   I got the PC using SSRDs thinking I would put some time and just install the Blu - ray after the PC has been recovered.   The PC recovered and when the new Blu - ray showed I installed the unit and guess what?  All PCs have shown in Device Manager and applications was a generic ODD - no Blu - ray capability and ability to read Blu - ray content in the default HP provided for multimedia applications delivered with the PC.  Applications were there but no Blu - ray capability.

    Huh?  It looks that I did not put any time at all.

    I inserted the new Blu - ray ODD and distributed recovery with the HP SSRDs.

    After recovery, I had all the Blu - ray drivers and applications supported Blu - ray.

    The difference between UCRDs and SSRDs:

    UCRDs provide a glimpse of what is installed and functional both disks are created.

    Version Digest of the player on what is happening with SSRDs to retrieve a PC (before Windows 10):

    SSRDs have all the drivers for all the HW and SW qualified for the unit.  There may be several drivers for hard drives, different types/screen resolutions, sides, etc.  Based on the characteristics of the specific laptop / desktop a process is run called "Do / don't.   After entering the recovery SDRD, the Notebook media boots to Recovery Manager.  The first step is a raw copy of all the contents of the disc on a temporary partition.  Following the Do / do not process looks at the characteristics of this specific unit and remove all other drivers and applications not used by this device.  Drivers and the only successful applications are the features supported.   And then, the new operating system and recovery partition is created.   The PC end recovery of cleaning process and restart the laptop / desktop. And, Yes, you guessed it, if you create the user created a recovery media, you only have the drivers for HW devices and applications of HP on the PC at the time.

    So, that being said, what could be the cause/solution?

    Hard drives can be different enough so that a different driver (not the UCRDs) is necessary for the newly installed HW.

    The SSRDs are supported on the new HARD drive installed?

    I don't know, I have an office boy, and I have not tried on this model of laptop.

    If you have / acquire SSRDs, I recover the laptop with the new installed HARD drive and see if it works.  It may or may not.  I don't know what drives were qualified for this laptop.

    If this does not work, the last option is cloning via USB connection (old HARD drive in the PC, new HARD drive connected to a USB 3 via the SATA Adapter (dongle) USB port, install or download software cloning and cloning the old HDD to the new.)   I just did this on the two older Windows 7 computers laptops using a SanDisk Ultra kit.  He has worked on both units.

    Conclusion:

    I don't think that the problem is caused from a HARD drive of 1 to a 320 GB HARD drive, as it meets the minimum specs for a complete installation.  I think the problem is related to the use of UCRDs to retrieve and the UCRDs do not have the HARD driver/firmware/application disc.

    But then again, I know.

    I am an employee of HP...

  • Re: Recovery DVD tool starts with error message

    Hello.

    Can someone tell me why when I run "create a dvd recovery tool" message appear with "cannot find the partition recovery...". » ???
    It's a whole new Satellite A660 - 1 c 3 bought and opened today.

    This happen if the recovery image is removed or deleted.
    When you buy the new model of notebook and start for the first time preinstalled image must be installed first.

    So if you are capable of operating system pre-installed usage it means you had a notebook with the recovery image on it. I put t know what you did but fact is this structure partitions or the backed up data are changed.
    Have you changed anything in the tool of management of disk (develop partitions, change the ability of the partitions)?

  • Power with alarm mode

    Hello

    Apple developer enhance the mode of power iwatch with alarm function.  It's will will be very useful for many of those who have just need time, alarm, and autonomy.

    Thank you

    Toan

    Hi Toan

    It is a community of support based on the user - Apple does not formally provide technical support here.

    If you want to suggest that Apple consider adding new features, you can do it here:

    https://www.Apple.com/feedback/watch.html

    All submissions are read (even if you do not expect to receive a response).

  • Partition problem after the recovery of the system with a single key 6.0

    I need your help!

    My Lenova Ideapad Y430 not more start and I had to restore the system with the recovery CD I burned with a recovery key 6.0. The restore process showed no defects and no error has occurred.

    Now, after restaring the system I only 0 with a C: partition (all program files, vista, drivers etc.) 104 GB and the 'part of recovery for a key' 14.75 working. D: partition where all my documents, pictures etc. are stored are listed, but idle and not accessible nor editable with the tool Vista Diskmanagement.

    No idea what I can do?

    You can download EASEUS partition manager. It will help you to reformat the D drive.

  • I have a frozen screen of Active recovery of white desk with a mouse. I think that the computer is frozen upward with a problem of recovery? Right?

    I have a frozen screen of Active recovery of white desk with a mouse.  I think that the computer is frozen upward with a problem of recovery? Right?

    How can I fix?

    Hello
    • What were the changes made before the problem occurred?

    You can try to restart the computer and check if it helps.

    If above does not help, you can read the following steps to disable the active desktop on the computer and check:

    a. to disable Active Desktop.
    b. right click on an area empty office, point to Active Desktop, and then click view as Web Page to clear the check box.
  • [iOS] Thick VMDK watch with alarm

    Hello

    Virtual machines with thick VMDK are displayed with alarm of disk space, it's a false positive error. If the disc is thin, it works fine.

    Best regards

    Jose Luis Gomez

    Oh, I'm sorry, you were referring to the Red not bar a real triggered alarm.  When a disc is thick, it would always be full disk size so it would be always full.  I think you are totally right.  We need to reassess how show us the bar for storage.

  • Cannot download - VMware vSphere PowerCLI for tenants

    Hi people,

    I'm not able to download VMware vSphere PowerCLI for the R2 version of tenants i.e. 5.1. Go to the page cannot be displayed.

    Please check.

    Kind regards

    Rajesh

    VMware vSphere PowerCLI for tenants

    Seems to work for me from this link.

    Perhaps a local cache in your browser problem, or a problem of Akamai in your area?

  • Can I use VMware vSphere Hypervisor™ with vSphere Client?

    It's the question next poped upward.

    -Can I freely use for my business need VMware vSphere Hypervisor™, and what will be the difference with VMware vSphere Starter Kit?

    and

    -Can I use VMware vSphere Hypervisor™ with vSphere Client software for free?

    Yes - it is freely permitted, but he he has limits and lack of features compared to the vSphere Essentials kits. Another thing to note is the absence of vCenter Server to manage multiple ESXi hypervisors with the free version. The backup API are, in my opinion, one of the main obstacles to the use of this.

  • Auto open when you click on VMware vSphere PowerCLI icon.

    Hello

    Quick question is there a configuration file or a way for me to have powershell cli automaticly "connect-viserver" when I open the icon "VMware vSphere PowerCLI.

    Thank you

    There are several ways to achieve this.

    The best way, in my humble opinion, is to add the Connect-VIServer cmdlet to a PowerShell profile files.

    Just add a line to the file. If you use an authorized account, you can do

    SE connect-VIServer-Server MyServer

    I suggest you use the profile of the current user, in this way that the Connect-VIServer will run only when you start PowerCLI

  • Need help PowerCLI with recovery ESXi host Asset Tag Info

    In the hope that someone, anyone, will be able to help me understand what I can do wrong and how to use PowerCLI to retrieve valid ESXi host Asset Tag information that appears in the tab material status vCenter. I have absolutely no problem of recovery of the serial numbers of host (sometimes referred to as Service Tags), manufacture, model, part, build, etc., but don't can't seem to be able to interrogate the current numbers of inventory number .

    None of the following attributes or property values currently returned the information required and which exists (see image below):

    Hardware.SystemInfo.OtherIdentifyingInfo [0]. IdentifierValue

    Hardware.SystemInfo.OtherIdentifyingInfo [1]. IdentifierValue

    Hardware.SystemInfo.OtherIdentifyingInfo [2]. IdentifierValue

    Hardware.SystemInfo.OtherIdentifyingInfo | where {$_.} IdentifierType.Key - eq "assettag" IdentifierValue})

    vCenter Server Hardware Status Tab - Asset Tag Info.png

    This is the script that I am running. I used PowerCLI Version 5.1:

    $VIServer = 'enter vCenter Server Name'


    # Add component snap kernel PowerCLI
    If (!) () Get-pssnapin-name VMware.VimAutomation.Core - erroraction silentlycontinue)) {}
    Add-pssnapin VMware.VimAutomation.Core
    }

    SE connect-VIServer $VIServer

    $HostReport = @)

    $VMH = get-VMHost | Get-View | % {}

    $Report = "" | Select the host name, Version, build, manufacture, model, series, Asset Tag

    $Report.Hostname = $_. Name

    $Report.version = $_. Config.Product.Version

    $Report.Build = $_. Config.Product.Build

    $Report.manufacture = $_. Hardware.SystemInfo.Vendor

    $Report.Model = $_. Hardware.SystemInfo.Model

    $Report.Serial = $_. Hardware.SystemInfo.OtherIdentifyingInfo [0]. IdentifierValue

    $ Tag = Report.Asset?

    $HostReport += $Report

    }

    $HostReport | Export-Csv «.\HostReport.csv"- NoTypeInformation

    Disconnect-VIServer-confirm: $false

    Ron thx.

    As far as I know, has nothing to do with PowerCLI, this is how vCenter gets this information, and how and where some HW providers make this information available.

    With the interface of the CIM, you can dump all the available information and then find exactly the tag died murdered.

    See what this returns

    import-module CimCmdlets$esxiHostname = "MyESXiServer"$HostUsername = "root"$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl$Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $esxiHostname -port 443 -SessionOption $CIOptGet-CimInstance -CimSession $Session -ClassName CIM_Chassis
    

    You will be asked the password root ESXi.

    On some of our older IBM HW, I get the following where we expect the identification sticker.

    But the information is there, just to another property.

    As we have already mentioned our VMworld session, exploring the CIM API.

    There is a lot of information in there

Maybe you are looking for

  • The BIOS administrator password recovery

    I have a Compaq Mini CQ10-400 s/n CNC02648QX. My son has put both a boot password, we've been able to guess AND a second password necessary to access the settings of the BIOS itself that is lost. After 3 attempts, we get the error "system disabled 75

  • How to reset to factory default settings, as if it was brand new?

    I have a laptop Toshiba L300. I want to reset the laptop to factory default settings. The reason is that whenever I use the browser firefox internet and explore when I do a search using the search engine, and when all the search results are listed an

  • How to block the bootloader on RAZR HD (xt925)

    Is it possible to block the bootstrapper on this unit? Trying to get rid of the warning at startup message. The usual 'fastboot oem lock' command does not work.

  • 32-bit version of vista compared to the 64-bit version

    Hi just want to know if how and there I should install vista 64 bit on my PC and what are the requirements should my pc be for vista 64 currently, I use vista 32 bit os on my pc, but it doesn't seem to work properly, I have an intel core duo cpu E840

  • Priority of management style?

    I want to use VerticalFieldManager to be center aligned horizontally, use the full available width. Therefore, I tried the following code: middleMgr = new VerticalFieldManager(Manager.FIELD_HCENTER | Manager.USE_ALL_WIDTH); However, the above code do