The Get-VMResourceConfiguration script output

Hey guys im trying to a csv file with the output of each part of vms and and the number of shares they have. I'm a big Powershell basics, I am learning well so I thought to ask gurus here. I'll place a copy of the script here.

If I run the command Get-VMResourceConfiguration - VM xxx | Format-List-property CpuSharesLevel for example, I get the result OK but when I try the same thing in my script it doesn't work.

$start = get-Date

# Make an array with the result I want.
# Name, then the property I want in the output.
# A lot of sandfordit.com of the wiki code it thx much borrowed.

$table = New-Object system. Data.DataTable 'results '.

$col1 = New-Object system. Data.DataColumn ([string]) name
$col2 = New-Object system. Data.DataColumn NumCpuShares, ([string])
$col3 = New-Object system. Data.DataColumn CpuSharesLevel, ([string])

$table.columns.add ($col1)
$table.columns.add ($col2)
$table.columns.add ($col3)

$duration = (new-TimeSpan (Get-Date) $start). TotalSeconds
"Lagde tahon etter $duration sekunder.

# Me make a list of vmms in a folder of the virtual Center

$vms = get-file Boris_test | Get - VM | Sort - the property name

$duration = (new-TimeSpan (Get-Date) $start). TotalSeconds
"Inte antall vmer etter $duration sekunder.

foreach ($vm to $vms)
{
$row = $table. NewRow()

$row. Name = (Get-VM-name $vm). Name
$row. NumCpuShares = (Get-VMResourceConfiguration - VM $vm |) Property Format-List-NumCpuShares). NumCpuShares
$row. CpuSharesLevel = (Get-VMResourceConfiguration - VM $vm |) Property Format-List-CpuSharesLevel). CpuSharesLevel

$table. Rows.Add ($row)
"Til rad for $vm.
}

$duration = (new-TimeSpan (Get-Date) $start). TotalSeconds
"Tahon fyllt ut etter $duration dry.

$table | Format-Table
$table | Export-Csv-path test.csv

THX Boris

Hi Boris,.

If you change the two lines:

$row. NumCpuShares = (Get-VMResourceConfiguration - VM $vm |) Property Format-List-NumCpuShares). NumCpuShares
$row. CpuSharesLevel = (Get-VMResourceConfiguration - VM $vm |) Property Format-List-CpuSharesLevel). CpuSharesLevel

in:

$VMResourceConfiguration = get-VMResourceConfiguration - VM $vm

$row. NumCpuShares = $VMResourceConfiguration.NumCpuShares
$row. CpuSharesLevel = $VMResourceConfiguration.CpuSharesLevel

your script works.

In the new code, I inserted an additional line to call Get-VMResourceConfiguration only one time. This will make the script a bit faster.

Best regards, Robert

Tags: VMware

Similar Questions

  • Get and Set of dynamic Type via the Script output

    I am running vRO 6.0.1. I built a dynamic type to Veeam. I can see the items in the inventory and can select them as attributes in workflows. I'm looking to get the dynamic Type via a script object and set it as a variable in the script output, but its does not work. I created the dynamic type using the type dynamic plug-in generator v2.

    I have 'Veeam' namespace with types:

    VeeamHost

    jobFolder

    job

    I put an output with the 'DynamicTypes:Veeam.job' type attribute and the name jobOut

    My script is just:

    jobOut = Server.findForType ('DynamicTypes:Veeam.job' '29714267-f517-4f76-a621-902b3e789772/urn:veeam:Job:26eddcda-ea52-469b-b4c9-0b80fec098ae');

    System.log ("Job found:" + jobOut "'); 

    After the execution of the jobOut variable is empty. In the newspapers, I see:

    Found job: DynamicWrapper (Instance): [DynamicTypesDynamicObject]-[class com.vmware.o11n.plugin.dynamictypes.model.DynamicObject] - VALUE: dynobj: [__ns:Veeam __id:29714267-f517-4f76-a621-902b3e789772/urn:veeam:Job:26eddcda-ea52-469b-b4c9-0b80fec098ae __tp:DynamicTypes:Veeam.job]

    Does anyone have an idea of how complete the release of DynamicTypes:Veeam.job with the actual work of veeam I got via the script?

    Could check you what happens if you replace the line

    jobOut = Server.findForType("DynamicTypes:Veeam.job","29714267-f517-4f76-a621-902b3e789772/urn:veeam:Job:26eddcda-ea52-469b-b4c9-0b80fec098ae");

    with

    jobOut is DynamicTypesManager.getObject ("Veeam", "task", "29714267-f517-4f76-a621-902b3e789772/urn:veeam:Job:26eddcda-ea52-469b-b4c9-0b80fec098ae");.

  • Need help to do the job of script Get-FolderPath

    Hello world

    I have do this script work can someone help me on this. I was able to produce the csv file unfortunately there is no value/output on the path column. I think that I was not able to call the function get-folderpath correctly. Thank you.

    ------

    $date = get-Date-format-M - d - yyyy

    . 'c:\Users\Get-FolderPath.ps1 '.

    $folders = get-file-type vm | Get-FolderPath | Sort-Object Id

    {Set-Path function

    Param ($Object)

    foreach ($folder IN $folders) {}

    If ($folder. ID - eq $Object.Id) {}

    $result = $folder. Path

    breaking

    }

    }

    $result

    }

    Get - VM | Sort-Object FolderID | Select name, Uid, NumCpu, MemoryGB, ProvisionedSpaceGB, @{N = "Path"; E = {Set-path - object $_.} Folder}}, ResourcePoolId, ResourcePool, @{N = "ToolsStatus"; E={$_. ExtensionData.Summary.Guest.ToolsVersionStatus}} | `

    Export-Csv "C:\test\vm-vServer-$date.csv" - NoTypeInformation - UseCulture

    -----------

    Also when I try to run it directly on powercli I get this error

    --------

    scripts\Get - FolderPath.ps1:45 tank: 25

    + $fld = get-view $fld. Parent

    +                         ~~~~~~~~~~~

    + CategoryInfo: InvalidData: (:)) [Get-view], ParameterBindingVal)

    idationException

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutom

    ation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-view: could not validate the argument on the parameter "VIObject". The argument is

    NULL, empty or an element of the collection argument contains a null value.

    Provide a collection that does not contain any null values and then try him

    command again.

    ------

    I would like to get output something like that. The most important thing is for me to get the path of the folder location.

    The virtual computer name. Data Center | Cluster | NumCPU | MemoryGB | Implemented SpaceGB. Path of the folder.

    Thanks in advance.

    See you soon,.

    The following PowerCLI script will give you the information you want:

    Get - VM | Select-Object - property Name,@{N='Datacenter'; E={$_| Get-Datacenter}},@{N='Cluster'; E={$_. VMHost.Parent}},

    NumCPU,MemoryGB,ProvisionedSpaceGB,@{N='Path'; E={($_. Folder | Get - FolderPath). Path}}

  • EXC in ev handl: TypeError: this.oRoot.enable is not a function that is popping up when I befor I open my browser in a box pop up under the heading JAVA SCRIPT EXE. That is - what, how can I get rid of him?

    TypeError: this.oRoot.enable is not a function

    This is popping up when I befor I open my browser,in a pop up box under the heading JAVA SCRIPT EXE. What is it, how do I get rid of it?
    

    For me, this happened from disabling, but do not uninstall McAfee site Advisor. Recommend site completely uninstalled and the problem disappeared completely. I had turned off before site Advisor, but it seems after a update to McAfee, he was back and then turn it off again caused this problem.

    Go to "uninstall a program" or "add/remove programs" in control panel. Find McAfee in your list (McAfee total protection for me). Click it and then click "Uninstall/Change" (right there in XP, up above in Vista or 7). I don't remember exactly what you see after that, but at one screen I was given the choice to uninstall the McAfee total protection and/or the Site Adviser. You can just check the Site Adviser and just uninstall the Site Adviser while retaining the rest of the McAfee protection.
    

    Good luck!

  • Get a script error when you try to print, and when I print the black ink is very light on the page. I replaced the ink already, it's a hp officejet 6500wireless.

    Get a script error when you try to print, and when I print the black ink is very light on the page.  I replaced the ink already, it's a hp officejet 6500wireless.

    See if this helps:

    http://support.Microsoft.com/kb/308260

    Tom Ferguson

  • SELECT statement in the script output window

    Hello

    SQL Dev 4.0.3

    is it possible to include select statements from the command run the Script in the Script Output window?

    Is the result in the window:

    Select 1... ;

    results

    Select 2... ;

    results

    Joop

    try to put "set echo on" (without the quotes) as the first line and make sure that you use F5 to run the script... like sqlplus.

  • Can any body help to get a script that can generate the sequence (length 3) with a combination of numbers and characters example: T11... TA1... TZ9... then on

    Can any body help to get a script that can generate the sequence (length 3) with a combination of numbers and characters example: T11... TA1... TZ9... then on

    With the help of the clause type

    Select sqnc

    from (select sqnc

    from (select 'T00"sqnc, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ordr

    of the double

    )

    model

    size of (0 I)

    measures (sqnc, ordr, length (ordr) len)

    rules iterate (1300) until (instr(sqnc[iteration_number],'~')! = 0)

    (sqnc [iteration_number] = case when sqnc [cv (i) - 1] is null

    then sqnc [0]

    of another substr (sqnc [iteration_number - 1], 1, 1) |

    -case when substr (sqnc [iteration_number - 1], 2, 1)<=>

    so when business substr (sqnc [iteration_number - 1], 3, 1)<>

    then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)), 1)

    of another nvl (substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 2, 1)) + 1.1),'~ ')

    end

    end |

    -case when substr (sqnc [iteration_number - 1], 3, 1)<>

    then substr (ordr [0], instr (ordr [0], substr (sqnc [iteration_number - 1], 3, 1)) + 1.1)

    else ' 0'

    end

    end

    )

    )

    where instr(sqnc,'~') = 0

    Concerning

    Etbin

  • After you install the 11.0.14 update, anyone can use the function "Save as" to save documents in SharePoint 2013. We get a script error.

    11.0.13 does not have this problem, but we can not feasible to push Adobe to the entire organization. If I remove the site in areas of trust in Internet Explorer, it works. This is not an option since our users would be invited for the username and password continuously. Someone at - it a fix for this problem? Adobe is going to release another update as soon as POSSIBLE the resolution it?

    Hi chem20006,

    It is a known issue and a bug report is already placed for this.

    For more details, please see this thread: I think the Adobe Pro XI 11.0.14 update is the reason I'm now getting a script error when I try to save PDFs for SharePoint, anyone else having this problem?

    Kind regards

    Meenakshi

  • I think the Adobe Pro XI 11.0.14 update is the reason that I now get a script error when I try to save PDFs for SharePoint, anyone else having this problem?

    Adobe XI Pro has been updated to 11.0.14 last week.  I think the Adobe Pro XI 11.0.14 update is the reason that I now get a script error when I try to save PDFs for SharePoint, anyone else having this problem?  It was working fine before.  I can drag / drop files PDF to other folders to SharePoint, but I can't "save under" SharePoint I get the can't read the script error.  I went to see if I could uninstall the update and it won't let me uninstall it.

    Hi Sierra,

    Bug # 4117305 for the number of script with SharePoint error has been fixed in our next quarterly update.

    Kind regards
    Rave

  • PHP form script is missing from the web server or PHP is not properly configured on your web hosting provider. Help - I get this message on my site when the form is filled out and you press send... Check if the form PHP script has been downloaded correctl

    PHP form script is missing from the web server or PHP is not properly configured on your web hosting provider. Help - I get this message on my site when the form is filled out and you press send... Check if the form PHP script has been downloaded correctly, contact your host about the configuration of PHP.

    Hi Graham,

    If you, please add your site to this link ( http://my-site.com/scripts/form_check.php ) and make sure that all green checkmarks are appearing. If they don't, let us know what errors you seem to receive and include the link to your site.

    In addition, check out this guide on the forums of Muse troubleshooting: Troubleshooting Muse form used on the servers of third party Widgets

    I hope this helps!

    Emily

  • I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    I get a Script Error failed. I think it is because the domain name is on page 1 and the field with the calculation is on page 2.

    The formula is just + Cash.  I don't know how to tell him to look on Page 1.  If I use the same domain on Page 1, the formula works so I know that this is not something in the name of the field.

    It received NO response

    Page1.cash should do it. If not, you can use CTRL + click to enter its name in your script.

    1. Select the field that you add the script.
    2. Scroll the design view until you can see the object whose name you need. (Is not necessary if the object is already in mode)
    3. Click inside the script window to place the cursor where you want the name of the other object.
    4. Hold down the CTRL key while clicking the object whose name you need.
  • VM combining the Get - And Get-VMGuest CSV output

    Hello

    I am trying to generate a CSV file that combines different properties between the cmdlets Get - VM and Get-VMGuest but struggled.

    I am aware that the cmdlet Get - VM will give me an output like the number of processors, amount of memory per VM, vm name etc., but also want to retrieve properties such as its IP address, running OS, hostname, etc in the same CSV report.

    I tried to mix the taste.

    Get-vmguest - vm (get - vm). Select-object vmname, osfullname | Export-csv c:\vm_osreport.csv

    and a previous post by LucD-

    --------------

    Get - vm | %{
    $_ | Select name. Out-Default
    $_ | Get-VMGuest | Select the State, IPAddress, OSFullName | Out-Default
    }

    Now if you want the result in 1 object (or an array of objects) you could make

    Get - vm | %{
    $vm = "" | SELECT name, State, IPAddress, OSFullname
    $vm. Name = $_. Name
    $guest = $_. Get-VMGuest
    $vm. State = $guest. State
    $vm. IPAddress = $guest. IPAddress
    $vm. OSFullName = $guest. OSFullName
    $vm
    }

    --------------

    but can't seem to get what I want. Basically, I'm looking for is the output to a CSV file - next

    • vmhostname
    • IP address
    • numCPU
    • memoryMB
    • Allocated size of HD
    • GuestOS (as reported by VMTools)
    • Datacenter + file (if possible)

    Can anyone help please?

    Thank you!

    Given that the ownership of comments is present inside the VirtualMachine object returned by Get - VM, you can get these values without running the Get-VMGuest cmdlet.

    Something like that

    Get-VM  | Select Name, @{N="Hostname";E={$_.Host.Name}}, @{N="IP addr";E={[string]::Join(',',$_.Guest.IpAddress)}}, NumCPU,MemoryMB, @{N="HD size allocated (KB)";E={[string]::Join(',',($_.HardDisks | Select -ExpandProperty CapacityKB))}}, @{N="GuestOS";E={$_.Guest.OSFullName}}, @{N="Datacenter";E={Get-Datacenter -VM $_ | Select -ExpandProperty Name}}, @{N="Folder";E={$_.Folder.Name}} | Export-Csv C:\report.csv -NoTypeInformation -UseCulture
    
  • Get the error during the execution of the IOM in script integrated purge OIM_ReconArch.sh

    Get the error during the execution of the IOM in script integrated purge OIM_ReconArch.sh


    bash-3. $00 cat Err_Arch_Recon_2012_11_01_15_36_06.log
    ****
    -The execution state of archives reconciliation
    ****
    BEGIN OIM_SP_ReconArchival ("n", "n", 200000, 'ARCHIVE_SELECT_WITH_CONS_DROP_REC', 'both, '20110101',' 20111231'); END;

    *
    ERROR on line 1:
    ORA-00942: table or view does not exist
    ORA-06512: at "PREPRD. OIM_SP_RECONARCHIVAL', line 722
    ORA-00942: table or view does not exist
    ORA-01031: insufficient privileges
    ORA-06512: at line 1


    Help, please

    ORA-06512: at "PREPRD. OIM_SP_RECONARCHIVAL', line 722
    ORA-00942: table or view does not exist
    ORA-01031: insufficient privileges

    (1) check if the OIM_SP_RECONARCHIVAL table or the view exists or not...
    (2) if it exists, check if the DEV_OIM user has enough privilege to view this table...
    Otherwise, give it all privileges to open as a sys as sysdba

    GRANT ALL PRIVILEGES ON DEV_OIM;

    COMMIT;

  • Progress bar in the VM deployment Script

    I'm doing my most effective deployment script.  Currently I use the wait-job cmdlet to display the progress of the task cloneing.  I prefer to be able to execute the loop, get all the machines both cloning and they have implemented a progress bar of tasks using the write-progress perhaps cmdlet using the output of the get task.  Any help would be appreciated.

    $vms = import-CSV D:\PSScripts\vmware\deploy.csv

    {foreach ($vm to $vms)

    $Template = get-model $vm.template
    $VMHost = get-VMHost $vm.host
    $Datastore = get-data store $vm.datastore

    $OSCustomization = get-OSCustomizationSpec $vm.customization

    $Task = new-VM-name $vm.name - OSCustomizationSpec $OSCustomization - $Template - VMHost $VMHost Datastore - $Datastore - RunAsync model - thin DiskStorageFormat
    Waiting-task-task $Task
    }

    foreach ($vm to $vms)
    {
    Together-NetworkAdapter NetworkName - $vm.networkName - StartConnected: $true
    Start-VM $vm.name
    }

    the get task output

    [vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI > get -.
    task

    Name status % complete, restart time of arrival
    ----                           -----      ---------- ----------   -----------
    CloneVM_Task success 100 10:01:42 10:10:25
    CloneVM_Task running 19 10:10:29

    You can collect all the tasks in a table, and then run the Wait-job cmdlet in this table.

    Something like that

    $vms = Import-CSV D:\PSScripts\vmware\deploy.csv $Tasks = @()foreach ($vm in $vms){       $Template = Get-Template $vm.template       $VMHost = Get-VMHost $vm.host       $Datastore = Get-Datastore $vm.datastore
    
           $OSCustomization = Get-OSCustomizationSpec $vm.customization
    
          $Tasks += (New-VM -Name $vm.name -OSCustomizationSpec  $OSCustomization -Template $Template -VMHost $VMHost -Datastore  $Datastore -RunAsync  -DiskStorageFormat Thin)}Wait-Task -Task $Tasks
    
    foreach ($vm in $vms)     {         Set-NetworkAdapter -NetworkName $vm.networkName -StartConnected:$true         Start-VM $vm.name     }
    
  • The problem of Script root.sh - ora.asm and ASM and Clusterware battery failed

    People,

    Hello. I want to install Oracle 11 g RAC 2 using 2 VMs (rac1 and rac2) whose BONES are Oracle Linux 5.6 in VMPlayer according to the website http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html

    I'm installing network infrastructure. On step 9/10 - run script /u01/app/grid/root.sh for 2 virtual rac1 and rac2 machines.

    After running root.sh rac1 successfully. I run root.sh in rac2 and get an error like below:



    [grid root@rac2] #./root.sh
    Run the script root.sh from Oracle 11 g...

    The following environment variables are defined as:
    ORACLE_OWNER = ora11g
    ORACLE_HOME = / u01/app/grid

    Enter the full path of the local bin directory: [usr/local/bin]: usr
    Copying dbhome to usr...
    Copying oraenv to usr...
    Copying coraenv to usr...


    Creating/etc/oratab file...
    Entries will be added to the/etc/oratab file according to the needs of
    Assistant configuration database when a database is created
    Finished to turn the generic part of the root.sh script.
    Now root product-specific actions will be performed.
    2012-03-05 16:32:52: analyzing the host name
    2012-03-05 16:32:52: verification of superuser privileges
    2012-03-05 16:32:52: user has superuser privileges
    Using the configuration settings file: / u01/app/grid/src/install/crsconfig_params
    Create the trace directory
    ADD LOCAL MODE
    Creating OCR keys for the user "root", "root"... privgrp
    Successful operation.
    Adding to inittab demon
    CRS-4123: Oracle high availability Services started.
    starts ohasd
    CRS-4402: the CSS daemon has been started in mode exclusive, but found a CSS daemon that is active on node rac1, number 1 and ends
    An active cluster was found at the exclusive start, start to join the cluster
    CRS-2672: attempt to start 'ora.mdnsd' on 'rac2.
    CRS-2676: beginning of "ora.mdnsd", the successful "rac2"
    CRS-2672: attempt to start 'ora.gipcd' on 'rac2.
    CRS-2676: beginning of "ora.gipcd", the successful "rac2"
    CRS-2672: attempt to start 'ora.gpnpd' on 'rac2.
    CRS-2676: beginning of "ora.gpnpd", the successful "rac2"
    CRS-2672: attempt to start 'ora.cssdmonitor' on 'rac2.
    CRS-2676: beginning of "ora.cssdmonitor", the successful "rac2"
    CRS-2672: attempt to start 'ora.cssd' on 'rac2.
    CRS-2672: attempt to start 'ora.diskmon' on 'rac2.
    CRS-2676: beginning of "ora.diskmon", the successful "rac2"
    CRS-2676: beginning of "ora.cssd", the successful "rac2"
    CRS-2672: attempt to start 'ora.ctssd' on 'rac2.
    Start action for octssd abandoned
    CRS-2676: beginning of "ora.ctssd", the successful "rac2"
    CRS-2672: attempt to start 'ora.drivers.acfs' on 'rac2.
    CRS-2672: attempt to start 'ora.asm' on 'rac2.
    CRS-2676: beginning of the 'ora.drivers.acfs' on 'rac2' succeeded
    CRS-2676: beginning of "ora.asm", the successful "rac2"
    CRS-2664: resource 'ora.ctssd' is already running on "rac2.
    CRS-4000: Start command has failed, or completed with errors.
    Return code of 1 (256) of control: / u01/app/grid/bin/crsctl start resource ora.asm - init
    Beginning of the resource ' ora.asm - init ' failed
    Could not start ASM
    The Oracle Clusterware boot failure battery
    [grid root@rac2] #.



    As seen above, the output at the end of the exit
    (1) beginning of resource ora.asm - init failed
    (2) could start ASM
    (3) could start Oracle Clusterware battery

    The runInstaller is in the first VM rac1. My question is:

    Any folk that understand how to solve the root.sh script in problem rac2 (3 fails to ora.asm, ASM and Clusterware battery as stated above)?


    Thank you.

    Please check there is no firewall don't exist:

    Try this as:
    root.sh fails on the second node

    Note MOS:

    Grid 11 GR 2: root.sh fails to start the Clusterware on the second node due to the firewall on the private network [981357.1 ID]

    Infrastructure 11.2.0.2 grid or upgrade installation may fail because of the requirement of multicast [1212703.1 ID] (most probabily this problem)

Maybe you are looking for

  • Slow downloads

    Everyone has noticed that FF is very slow, downloading videos. IE will do in the neighborhood at the time. Any suggestion to speed up appreciated.Thank you

  • Qosmio G20-139 of freezing

    Hello I was wondering if anyone has had this problem. I have a Qosmio G20-139, which was purchased from Jan. 2006, in the last two weeks, it seems to freeze. I have to power it down, when I re turn on it does nothing. If I leave it for about 1/2 hour

  • HP laptop - 15-g206ax: HP - 15-g206ax windows 7 driver wifi laptop

    I had windows 8 pre-instatlled. I was in windows 7-32 bit. After all the drivers work correctly except wifi driver. Please help with the wifi driver. laptop model HP for laptop - 15-g206ax

  • can I access my history of windows live

    Hi can you help me I need to access my life story windows and especially the conversations with a person I had in December. I need this information to help identify a person who has been accused of! *

  • Help to install Encarta 2000 on the Windows 7 computer.

    I bought a whole new, retractable Encarta 2000, assuming it works on Windows 7. After being told several times that it was installed when it wasn't, that I came across a "compatibility" option Now it is installed and it works - except for the help fi