Using PowerCLI for update vROps

Now that vROps API fully support REST and PowerShell supports the REST, how can I take a power shell script and do something like:

  • import a list of virtual machines from a CSV file
  • vROps by using components REMAINS powerShell
  • Create a custom group in vROps containing these virtual machines?

Thank you!

So, you can use Invoke-RESTMethod to call the REST API.  Of that, it returns a json object type that can be analyzed through ConvertFrom-JSON.  On the other hand, you should be able to use ConvertTo-JSON to create the text of the PUBLICATION using Invoke-RESTMethod command.

I personally have not tapped into this area yet and probably won't be able to, but I used a lot of PowerShell to make interaction REST API without difficulty, this should be no different.

Tags: VMware

Similar Questions

  • The IP addresses that can use firefox for updates?

    Hello

    Firefox by sending queries to a large number of third-party IP addresses. How do I know which of these addresses should be updated?

    Is it possible to disable requests to Akamai servers?

    P.S. I want to restrict the firewall network activity to small County of trust networks.

    It can search for updates of different things in addition to software updates of Firefox.

    A number of things is listed in http://kb.mozillazine.org/Connections_established_on_startup_-_Firefox

  • Using PowerCLI for VM disk Stats

    First of all - it's really a message to LucD (I know from previous aid tends to prowl this forum ), just thought I'd share, as is all the useful info and any idea LucD at will without doubt be useful for all.

    Hi LucD,
    First of all - thanks for a great selection of posts on Reporting for Powershell vSphere - well worth the time and a have read for anyone.
    I'm certainly not a good PowerShell - but I was able to understand and make changes to my profit - so I thought I would share my findings and ask a few questions.
    With your script as a basis - I was able to reach the following which SHOULD let me look at all VMs in VC one statistics collect virtual disk in time for VMS different discs, (IOPS / s, Throuput and latency) I use VC 4.1 and and NFS storage attached, I believe that these statistics are OK but would have your insight on this.
    I am very pleased with the script - but he needs more tests on a valid site, rather than my region little test, but I'm sure that from a point of view 'PS' there is more efficiency to win.
    First of all - is it possible to get all the statistics at a time-, rather than to make 6 calls per VM? (I'm also sure that the ' += ' a stat the following may not be ideal)
    Also - is there a way can control the output to the CSV file, it seems to put the columns in order any, he loves and layout does not appear to be linked to the order of a group object? Can it be controlled so I can have the entries 'value' and 'unit' next to each other
    ?
    Any insight and assistance would be appreciated, and I hope that others will give it a try and let me know if it works for them too.
    Thanks again for the inspiration and the vision that made me this far
    Tony.
    ESX 4.1, VC 4.1, 2.0 options, PowerCLI 4.1.1
    # Main Variables
    $sVCentre = "IP VC.
    $sVCUser = "administrator@domain".
    $sVCPwd = "password"
    $strVMWildCard = «*»
    $strCSVName = "Stats-AvgVMDiskWriteStatsWorkingday.
    $strCSVLocation = "c:\". »
    # define the start and end times for a day's work.
    $today9am = (get-Date-time Minute 9 - 0 - 0 second)
    $today5pm = (get-Date-time Minute 17 - 0 - 0 second)
    $intStartDay = - 1
    $intEndDay = - 1
    # Begin script
    #Connect to the CR
    Connect-VIServer $sVCentre - $sVCUser of the username-password $sVCPwd - ea silentlycontinue
    $arrVMs = get - VM | WHERE-object {$_.} Name - like $strVMWildCard}
    foreach ($strVM to $arrVMs)
    {
    Write-Host "get stats for:" $strVM.Name
    Write-Host "'-Assembly of latency of writing Stats" "
    $stats += get-Stat - $strVM - Stat virtualDisk.totalWriteLatency.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host "'-bringing together reading latency statistics '"
    $stats += get-Stat - $strVM - Stat virtualDisk.totalReadLatency.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host "'-Assembly Stats ARE Ops / s reading" "
    $stats += get-Stat - $strVM - Stat virtualDisk.numberReadAveraged.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host "'-writing ARE Ops / s Collator Stats" "
    $stats += get-Stat - $strVM - Stat virtualDisk.numberWriteAveraged.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host "'-Assembly Read Throughput Stats" "
    $stats += get-Stat - $strVM - Stat virtualDisk.read.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host "'-writing flow Stats of collation" "
    $stats += get-Stat - $strVM - Stat virtualDisk.write.average entity - start $today9am. AddDays ($intStartDay) - finish $today5pm. AddDays ($intEndDay)
    Write-Host $stats.length
    # include data and gather stats on average for the day.
    } $groups = $stats | Group-object - property {$_.} Entity, $_. MetricId, $_. Instance}
    $report = $groups | % {
    New-object PSObject-property @ {}
    Description = $_. Group [0]. Description
    Entity = $_. Group [0]. Entity
    EntityId = $_. Group [0]. EntityId
    Instance = $_. Group [0]. Instance
    MetricId = $_. Group [0]. MetricId
    Timestamp = $_. Group [0]. Timestamp.Date.AddHours ($_.) Group [0]. Timestamp.Hour)
    Unit = $_. Group [0]. Unit
    Value = [math]: Round (($_.)) Group | Measure-object-propriete value - average). On average, 2)
    }
    }
    #Exporting the report to a CSV file.
    $strCSVSuffix = (get-date) m:System.NET.SocketAddress.ToString ('yyyyMMddhhmm')
    $strCSVFile = $strCSVLocation + $strCSVName + $strCSVSuffix + "_", ".csv".
    $report | Export-Csv $strCSVfile - NoTypeInformation - UseCulture

    Thank you, Tony.

    (1) Yes, you can call Get-Stat with several characteristics, the downside is that the results will be mixed and you'll need to extract the correct metric/value objects. What's even better, you can also move all the virtual machines in a single call to Get-Stat.

    (2) the Export-Csv does not specify the order of the columns in the .csv file, I'm afraid.

    The alternative is to write or build the .csv file yourself.

    Capture each line as you like it in a string, and then write that string to a file.

    This is the update script

    # Main Variables $sVCentre = "VC IP" $sVCUser = "administrator@domain" $sVCPwd = "password" $strVMWildCard = "*" $strCSVName = "Stats-AvgVMDiskWriteStatsWorkingday" $strCSVLocation = "c:\"
    $metrics = "virtualDisk.totalWriteLatency.average","virtualDisk.totalReadLatency.average",
        "virtualDisk.numberReadAveraged.average","virtualDisk.numberWriteAveraged.average",
        "virtualDisk.read.average","virtualDisk.write.average" # define the start and finish times for a working day. $today9am = (Get-Date -Hour 9 -Minute 0 -Second 0)
    $today5pm = (Get-Date -Hour 17 -Minute 0 -Second 0)
    $intStartDay = -1$intEndDay = -1## Begin Script
    
    #Connect to VCConnect-VIServer $sVCentre -User $sVCUser -Password $sVCPwd -ea silentlycontinue$arrVMs = Get-VM | where-object {$_.Name -like $strVMWildCard}
    $stats = Get-Stat -Entity $arrVMs -Stat $metrics -Start $today9am.AddDays($intStartDay) -Finish $today5pm.AddDays($intEndDay)
    # group the data and collate the stats into averages for the day.$groups = $stats | Group-Object -Property {$_.Entity, $_.MetricId, $_.Instance}
    $report = $groups | % {
        New-Object PSObject -Property @{
            Description = $_.Group[0].Description
            Entity = $_.Group[0].Entity
            EntityId = $_.Group[0].EntityId
            Instance = $_.Group[0].Instance
            MetricId = $_.Group[0].MetricId
            Timestamp = $_.Group[0].Timestamp.Date.AddHours($_.Group[0].Timestamp.Hour)
            Unit = $_.Group[0].Unit
            Value = [math]::Round(($_.Group | Measure-Object -Property Value -Average).Average, 2)
        }
    }
    #Exporting the report to a CSV file.$strCSVSuffix = (get-date).toString('yyyyMMddhhmm')
    $strCSVFile = $strCSVLocation + $strCSVName + "_" + $strCSVSuffix + ".csv"$report | Export-Csv $strCSVfile -NoTypeInformation -UseCulture
    
  • Is it possible to use PowerCLI to update only the pilot VMCI?

    Hi all

    I run an antivirus without an agent to our environment solution soon & so I need to install the 'VMCI Driver-> NSX Introspection Driver file' as part of the process.

    I'm trying to find how to do this with Powershell/PowerCLI, but I see no option to do so without install everything.  Preferably, I install just the driver mentioned above (without the "Shared folders" option) and let it install it currently only components.

    I think that the code below would accomplish what I want, but I don't know it can be passed to the cmdlet update-Tools PowerCLI:

    /S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"
    

    No, I'm afraid that you cannot do with the cmdlet Update-Tools.

    But, as long as you have the installer somewhere, it is from PowerShell.

    Take a look at 3 Re: update tools & Vsield a vapp pilots  

  • Using PowerCLI for virtual disk latencies

    Hi all

    I'm trying to get the disk reading and latencies on some virtual machines

    I'm quite a beginner on PowerCLi apart from some ships a writing utility

    I checked this thread

    http://communities.VMware.com/thread/304827

    But these counters do not work for me

    Can someone please help?

    [vSphere PowerCLI] D:\Program Files\VMware\Infrastructure\vSphere PowerCLI > $stats += Get-Stat - entity "USB-SSAPP" - Stat virtualDisk.totalWriteLatency.average
    Start $today1am. AddDays ($intStartDay) - finish $today4am. AddDays ($intEndDay)
    [vSphere PowerCLI] D:\Program Files\VMware\Infrastructure\vSphere PowerCLI > $stats

    Returns nothing,

    I created all the variables that I'm providing in the command.

    Kind regards

    P

    You might start by checking what statistical level, the period you specified is defined in vCenter.

    "Latency" needs to at least level 2 metrics.

    I guess that "USB-SSAPP" is the name of a host ESX (i)?

  • Using PowerCLI update CMDB

    I need a guide on how to use PowerCLI to update my CMDB.  For example:

    -J' I create a Virtual Machine in vCenter

    CMDB - one yet knows about this

    -J' have the VMname, IP address, OS vCenter with powerCLI type (this part is easy)

    Then I go and use the same script to hit the API of a commonly used CMDB and update the CMDB.

    Is there a guide for general how to do this or a script example of someone who did it?

    Thank you!

    For example, I use a simple real method:

    Every night a script is on demand making it an export of the vCenters with relevant information, CPU, memory, StorageSpace, etc. VMname.

    It is exported to a CSV file to a shared location.

    Every night he runs a CMDB solution, importing the CSV file and editing the right values. I don't know the name of solutions. Try to understand how you can modify / add CMDB items in your first CMDB software, from there you can begin to build your script to get the relevant information in the right format so your CMDB can add it.

  • Way to the commands per second using PowerCLI

    You can use powerCLI for average orders per second of a virtual machine on a historical period in the same way, as you can with cpu.usagemhz.average?

    Just to clarify:

    Does

    datastore.numberreadaveraged.Average

    give me information on the entire data store connected to the virtual machine? Or is information specific to just the VM I comment on?

    (In this case, I'm eager to get all the IOPs for all all of the virtual disks connected to a specific virtual machine)

    It gives you the IOPS / s specific to entire virtual machine and not the data store.

    Also - I'm the zeros for my data when I launch the present.  I see in vSphere client commands per second only to the data in real time, not for the last day, week or year.  Is it because of my level settings statistics?

    Yes, vCenter 5.0 and place unfortunately don't collect statistics of e/s long term on a per-VM level more.

    However, you can still add these values to return to lower levels of statistics as described in this article:

    http://alpacapowered.WordPress.com/2012/12/17/control-vCenter-performance-counter-collection-and-get-back-VM-IOPS-statistics/

  • Inventory of VC using powercli

    Hi all

    I'm looking for a script using powercli for several stocks of VCenterservers something like Vcenter name, host name, name of vm, the VM OS. Notes VM, information data store and vm tools release in excel or csv format

    Note: for multiple Vcenters

    You can check the PowerCLI version you are running? You can do it with the Get-PowerCLIVersion cmdlet. The latest version is: "VMware vSphere PowerCLI 5.1 Release 2 build 1012425. If you are using an earlier version, then please install the latest version. You can download this version of http://www.vmware.com/go/powercli.

    The

    Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope User -Confirm:$false
    

    command should work in the latest version of PowerCLI.

    Certificate warnings can be removed with the following command:

    Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope User -Confirm:$false
    

    To make the script more quickly, I did a new version using the cmdlet Get-View . This new version is about three times faster than the former.

    & { foreach ($vCenterServer in $DefaultVIServers)
        {
          Get-View -Server $vCenterServer -ViewType VirtualMachine -Filter @{"Config.Template"="False"} -Property Name,
            Runtime.Host,
            Guest.GuestFullName,
            Config.Annotation,
            Datastore,
            Config.Tools.ToolsVersion |
          Select-Object -Property @{N="vCenter";E={$vCenterServer.Name}},
            @{N="VMHost";E={(Get-View -Id $_.Runtime.Host -Property Name).Name}},
            @{N="VM";E={$_.Name}},
            @{N="Guest OS";E={$_.Guest.GuestFullName}},
            @{N="Notes";E={$_.Config.Annotation}},
            @{N="Datastores";E={[string]::Join(',',(Get-View -Id $_.Datastore).Name)}},
            @{N="VMware Tools version";E={$_.Config.Tools.ToolsVersion}}
        }
      } |
    Export-Csv -Path VMsInfo.csv -NoTypeInformation -UseCulture
    
  • It is better to install vMA 5 if I already use PowerCli to do a lot of my script?

    I have been using PowerCLI for awhile now and love it.  I have the vMA 5 installed in my lab at home and I use it a little.  The main reason I used the vMA is to collect some syslogs.  I can also run some scripts perl at the VMAs as well.

    I can't do with PowerCLI from the administrative point of view I can do with the vMA 5?  Thanks for your comments!

    As everyone has already mentioned, if you are familiar and prefer PowerCLI and more importantly if your management platform is Windows, then you must continue using them. vMA is just a device for Linux with installed vCLI which includes vSphere SDK for Perl for convenience, vCLI can be installed on other Windows systems or taken Linux support. Out of vSphere 5, there is not a collector of syslog for Windows or you can use the syslog collector that is in the VCSA, it is no longer supported in vMA 5.

    If you want to run syslog (which the syslog collector is just syslog-ng), you may do so on vMA 5.0 but it would be unsupported. Here are the steps if you haven't seen this already - http://www.virtuallyghetto.com/2011/07/free-linux-windows-syslog-alternatives.html

    At the end of the day, all the features of vSphere are exposed through the vSphere API, this is true if it is consumed as a PowerCLI, vSphere SDK for Perl or any other vSphere SDK. So everything you can do a SDK development kit, you can do in the other. Depends on the platform of choice and what you are comfortable with

  • How to use PowerCLI to activate the function VM NPIV and config setting?

    Hi all:

    I'm having a problem on PowerCLI.

    Can I use PowerCLI for NPIV to the VM config?

    OK, I see. This is possible with the operator "set".

    Note that the script must convert the hexadecimal number WWN in a 64-bit decimal number.

    $vmName = "MyVM"
    $nodeWWN = "28:2b:00:0c:29:00:00:07"
    $portWWN = "28:2b:00:0c:29:00:00:08"
    
    # Convert WWN string to 64-bit number
    $nodeWWN64 = [int64]("0x" + $nodeWWN.Replace(":",""))
    $portWWN64 = [int64]("0x" + $portWWN.Replace(":",""))
    
    # Activate NPIV
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.NpivDesiredNodeWwns = 0
    $spec.NpivDesiredPortWwns = 0
    $spec.NpivTemporaryDisabled = $false
    $spec.NpivWorldWideNameOp = "set"
    $spec.NpivPortWorldWideName = @($portWWN64)
    $spec.NpivNodeWorldWideName = @($nodeWWN64)
    
    $vm = Get-VM -Name $vmName
    $vm.ExtensionData.ReconfigVM($spec)
    

    You can use the cmdlet New - hard drive to attach a disc RDM. Make sure to specify a type of "gross" on the parameter - DiskType.

    You ID LUN with the parameter - DeviceName.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Select cursor for update: multiple columns of different tables

    Hello

    I have two tables test1 and test2. I want to udpate the column (DEPT_DSCR) from the TEST1 and TEST2 using select for update and current tables of the... with the cursor.

    I have a code drafted as follows:
    DECLARE
    v_mydept1 TEST1. TYPE % DEPT_CD;
    v_mydept2 TEST2. TYPE % DEPT_CD;
    CURSOR C1 IS SELECT TEST1. DEPT_CD, TEST2. DEPT_CD OF TEST1, TEST2 WHERE TEST1. DEPT_CD = TEST2. DEPT_CD AND TEST1. DEPT_CD IS 'AA' FOR THE UPDATE OF TEST1. DEPT_DSCR, TEST2. DEPT_DSCR;
    BEGIN
    OPEN C1;
    LOOP
    FETCH C1 INTO v_mydept1, v_mydept2;
    WHEN EXIT C1% NOTFOUND;
    UPDATE TEST1 SET DEPT_DSCR IS "PLSQL1" WHERE CURRENT OF C1;.
    SETTING A DAY TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1.
    END LOOP;
    COMMIT;
    END;

    The code above when it is run, declares that it runs successfully. But it does not update the columns you want [DEPT_DSCR].

    It works only when we want to update one or more columns of the same table... i. e by providing these columns after ' to UPDATE THE.
    I don't know what exactly is the problem when you want to update several columns of different tables.

    Can someone help me on this?

    user12944938 wrote:
    But it's more the notion of compensation and understanding.

    See the link below:
    http://download.Oracle.com/docs/CD/B10501_01/AppDev.920/a97269/pc_06sql.htm

    See the section RESTRICTION in the link above.

    Twinkle

  • I bought the IPad Pro 128 GB on 3.29.2016. I used it for less than a week. It charged when I first opened it from 67% to 100%. 9.3.1 update.  After about 5-6 days, the battery is down to 1%, and now it will not load. I have reset on AEC

    I bought the IPad Pro 128 GB on 3.29.2016. I used it for less than a week. It charged when I first opened it from 67% to 100%. 9.3.1 update.  After about 5-6 days, the battery is down to 1%, and now it will not load. I have reset to factory settings and it still doesn't load. There's just 1%. Help, please.

    Thank you

    Katie

    It is under warranty. Suggests taking it for an Exchange.

  • Why "check for updates... "shows it that there is no update while I use Firefox 3.6.18 and latest version 5.0.1?

    First of all, I would like to state that I have hardly any technical knowledge. So forgive me if this seems like a silly question to professionals. Here are the details about this problem according to the best of my limited knowledge:

    I am currently using Mozilla Firefox 3.6.18; previously, 3.6.13. It was upgrade 3.6.9 3.6.13 after I click on Check for Updates... and he told me that this would be done when I reboot my system. When I restarted my PC, I was surprised to find that it has been downloaded version 3.6.18. I didn't know how she had progressed in the process, so I let him finish. After that, I disabled the option that allows it to download and upgrade to date on its own and turned it off. Next time when I started, it was 3.6.18, but has not been updated on its own.

    Now, I want to upgrade directly to version 5.0.1. But when I leave the option "download and install the update automatically" under Tools > Options > advanced > update, it downloads and updates the versions according to their order of liberation. So if I let it, then when I start it up the next time, he'll start download version 3.6.18 and update to it rather than to directly update 5.0.1. It will continue to do so until it reaches it. For reasons of my own, I don't like that. So I unchecked the option "Download and install the update automatically" and chose the "ask me what I want to do" option (so that it is not repeating the "download and update" process on its own whenever I start my PC). Then I went to the site of Firefox and the thought of downloading and updating to the latest version of my own. But then I was informed that if I do, I have the latest version, but I'll lose all my favorites registered unless I followed a procedure hectic in order to save and load them again after you have installed the latest version of Firefox. I won't let that happen either. So someone can get out of this situation suggests without losing my favorites?

    Almost forgot. I tried several times by going to help > Check For Updates..., but each time he returned to the same result: "there is no update. Firefox periodically checks the updates. "How is it no update is available, while the version I use is 3.6.18 and the latest version is 5.0.1? In short, Check for Updates... has not helped either. (Even though I have updated the last time, shouldn't it have updated to version 3.6.13 to 5.0.1 directly?)

    So, can anyone suggest a way in which I don't lose my favorites and would be able to upgrade to the latest version directly too? A response that would not involve the removal of the current version and install the most recent, but to update directly to it (it is fine if it needs to download) would be more welcome. I know that bookmarks can be saved in a file and everything, but I would like to know if it is possible, as has happened for my current version of the previous version. (He downloaded and updated itself on its own, disturb nothing, not even myself connected on some accounts where I stay connected.) The only problem there is that he wasn't directly updated to the latest version.)

    I hope that the above details of sense and are pretty useful for others to help me. Thank you.

    No need to transfer bookmarks and settings to the new version as a new version of Firefox will use the last profile you used unless you check otherwise. You can always save your profile in the case.

    The Firefox 5.0 would be the same.
    http://releases.Mozilla.org/pub/mozilla.org/Firefox/releases/5.0/Win32/ and you choose the language.

  • I used numbers for a long time, but only make spreadsheets base.  With the latest updates, I couldn't change my information.  What Miss me?

    I used numbers for a long time, but only make spreadsheets base.  For about a year and with the latest updates, I couldn't change my information.  What Miss me?

    Hi Deb,

    There not really enough information in your message to help you. How things don't work, exactly? Is there any alerts or messages?

    Quinn

  • I haven't used itunes for some time and now have a new PC.  I've updated my account (change password) but when I connect to my music went?

    I haven't used itunes for some time and now have a new PC.  I've updated my account (change password) but when I connect to my music went?  I am working on Win 8 and still have part of my collection on an ipod.

    Unless you subscribe to iTunes game (which is not a complete solution anyway) your iTunes Library is on your previous PC - solution the easiest is to copy from here or from a backup.  For more information, see How to move your iTunes library to a new computer - Apple Support .  Previous purchases from the iTunes Store may be available for re - download - see download your past - purchases of Apple Support.

    If none of these approaches allows to recover the contents of your library, see user turingtest2 on recover your iTunes from your iPod or an iOS device library for a list of tools and methods that can be used to copy the media etc from iPod to iTunes.

Maybe you are looking for

  • A few troubleshooting questions

    I have a MacBook Pro (retina, 13 inches, early 2015) that is running OS X El Capitan, Version 10.11.4. I really like to use it, but there are a few questions that I have dealt with recently that I would like help troubleshooting. 1. sometimes, I look

  • Adblock Plus does not load in firefox 11 and Vista user limit

    I am running Windows Vista, fully patched. I downloaded Adblock Plus as an administrator, but not as a limited user. The menu bar does not work as a limited user, but the Firefox button.

  • Satellite A300 - part number for the palmrest

    HI, I have a Satellite A300-1BZ which requires a new set of rest-hands/touchpad (upper part of the housing). I can find the second part of user A300/A305/A305D part no V000120350. However, the metal screen on V000120350 seems different than an A300-1

  • Windows experience index for two different laptops with the same configuration of maximum output power

    [I have two almost identical laptops Lenovo T61p and running W7 64 Ultimate b: has] has an Intel T7700 processor and 8 GB of RAM. [B] has a CPU of Intel T8300 with 4 GB of RAM. They are clocked at 2.6 GHz and have identical hard drives. When the syst

  • Slow printing of http for windows network ports 7

    Windows 7 professional 64-bit, 16 GB of ram, processor 3.4 mhz. I read many many posts on this subject.  HOWEVER, I print directly on printers.  HTTP via Cups.  I can load my old XP machine in a virtual machine on windows machine 7 and it prints imme