PowerCLi right size

I've been modifing a script to do automated resizing right for me based on an imported csv file.

I think I have the Script sorted, but it won't work, I get this error.

Any help would be appreciated.

Get-VM : Cannot validate argument on parameter 'Name'. The argument is null or
empty. Supply an argument that is not null or empty and then try the command ag
ain.
At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\RightSize.ps1:
66 char:28
+ foreach($vm in Get-VM -Name <<<<  ($vms."Virtual Machine")){
    + CategoryInfo          : InvalidData: (:) [Get-VM], ParameterBindingValid
   ationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
   ation.ViCore.Cmdlets.Commands.GetVM

This is the code.

function PowerOff-VM{
    param([string] $vm)
    
    Shutdown-VMGuest -VM (Get-VM $vm) -Confirm:$false | Out-Null
    Write-Host "Shutdown $vm"
    do {
        $status = (get-VM $vm).PowerState
    }until($status -eq "PoweredOff")
    return "OK"
}

function PowerOn-VM{
    param( [string] $vm)
    
    if($vm -eq ""){    Write-Host "Please enter a valild VM name"}
    
    if((Get-VM $vm).powerstate -eq "PoweredOn"){
        Write-Host "$vm is already powered on"}
    
    else{
        Start-VM -VM (Get-VM $vm) -Confirm:$false | Out-Null
        Write-Host "Starting $vm"
        do {
            $status = (Get-vm $vm | Get-View).Guest.ToolsRunningStatus
        }until($status -eq "guestToolsRunning")
        return "OK"
    }
}


    
 $VIServer = Connect-VIServer "vcenter" 
If ($VIServer.IsConnected -ne $true){
  Write-Host "error connecting to $vCenter" -ForegroundColor Red
  exit
}
$vms = Import-CSV .\vcopsreport.csv
foreach($vm in Get-VM -Name ($vms."Virtual Machine")){

  if($vms."Recommended Memory" -or $vms."Recommended vCPU" -ne "0"){
    $poweroff = PowerOff-VM $vm.Name
    if($poweroff -eq "Ok"){
      Write-Host "PowerOff OK"
      if($vms."Recommended Memory" -ne "0"){
        
       
          
          $vm.Name | Set-VM -MemoryGB $vms."Recommended Memory" -Confirm:$False
          Write-Host "The new configured amount of memory is"(Get-VM $VM).MemoryGB
        
      }

      if($CPUCount -ne "0"){
        $vm.Name | Set-VM -NumCPU $vms."Recommended vCPU" -Confirm:$False
        Write-Host "The new configured number of vCPU's is"(Get-VM $VM).NumCPU
      }

      $poweron = PowerOn-VM $vm.Name
      if($poweron -eq "Ok"){
        Write-Host "PowerOn OK"}
    }
  }
}

Disconnect-VIServer -Confirm:$false

Try to put in place the following foreach loop

foreach($vm in Get-VM -Name ($vms | Select -ExpandProperty "Virtual Machine")){

In this way, you will pass a table with the names for the Name parameter

Tags: VMware

Similar Questions

  • Export of goods for the screen, not the right size.

    I have a simple rectangle asset of 30pix X 30pix, with no line.

    When I try to export in iOS format x 1, x 2 and x 3, in png, the size of 1x.png is 31 x 31. However, the 2 x and 3 x png have the right size to scale.

    How make the exported 1x.png image the correct size (30 x 30)?

    In order to have the forms to match the pixel grid, you must first make: object > shape > convert to path (or Expand... I'm not sure, have a German version)

    In the transform Panel, you can align the to the pixel grid (you may need to "Show options")

  • video makes the right size

    My video makes it the right size. I export quicktime with adjustment of the model of something random like 15364 9832 x, but when I open the video in VLC media player or quicktime size was changed in 2000 x 2000. I lock the proportions on and set the desired model. Why is my output a square video then?

    Ahhh, this helps.  Do not use H.264.  Instead, use ProRes 422 (as applicable), Photo JPEG or PNG codec.  You can then do the GIF animated in Photoshop.  As you probably know, AE will not make them.

  • Import graphics Illustrator in the right size

    Hello

    Anyone who is familiar with the import of Illustrator graphs at the right size?

    East - the right approach? In InDesign, my Options of text block told me that my block of text is 35p7.276. My graphic Illustrator must therefore the two 35p7.276 high and wide. Then I put the character of my graphic style to reflect those of my InDesign document and now, she's ready for the import?

    Thank you!

    You mean like the refresh from scratch?

    No, I don't have the figures for the chart. Most of the time I start with something that has been stuck in a Word from Excel file. If I can get the numbers, then it is usually easier to just remake the chart in Illustrator using graphical tool Illustrator. But without the numbers I usually end up copying and pasting from Word to Illustrator and then manipulate (drawing a) graphic of what I want to (change the fonts, character, STROKE, color, size etc. and then resize it to final print size and then resize the type even once).

    I don't know what you mean by "dealing with the actual graphics in Indesign. InDesign is not a graphical tool. Similarly, I don't know what you mean by vectorize. Create outlines is a way to convert the type of vector art. A graph is already (or should be) vector art (with a small cast type).

    Ken

  • HP7510: When you print photos they come out the right size.

    Today you have the printer and it works well with the output of good quality.  However if I try to print a MS Word document that contains a picture the photo comes out to about 120% of full size and overflows out of the page.  Any ideas?  I am an experienced user and have tried all the usual remedies.  OS is Windows 10 MS Word 2003 (yes I know it's old :-))

    @Bernard_S

    Odd.

    Rats.

    Office Word 2003 is no longer supported.  File Windows 10 libraries system files and the links that connect dependencies (programs needed by desktop software and printer) changed - 'something' may be missing or damaged.

    Regardless of the new file system Windows 10 and how he 'sees' a Word 2003 document, the question could be attributed to the program from the printer itself - a tiny missing statement which translates not correctly size the image, position, limits.

    One or more of the following could reverberate - results, of course, depend on the cause of the problem (still unknown).  If one of the changes to trigger a file change internal - or how the document and the image are translated by the printing software - while change can help solve the problem.

    Ideas - I hope that these apply to your Word Vintage:

    • If you have not done so, check the spacing of lines on each side of the image - Dragon document mention this (if I remember) provides an example.
    • Copy the image to a new name .jpg file > open the image in Paint (paint real, not 'fresh') > set up as if you are going to print and check the size, boundaries, the parameters.  Why use Paint instead of Picasso?  The painting is Windows.  Picasso is not.  If you want, print the image (although I doubt it will be necessary).  Place (insert) of the 'new' file in your document in place of the original image.
    • Try to temporarily remove the image > save close the document > open and insert the image in place.  If the image is small enough (fits left margins / right), left click on the image and use the arrows "decrease / increase indent ' to drag the image a little to one side or the other.
    • Turn on all the markings of the document - search for oddities.  Anchors in images could provide a clue about why the image is printing 'off limits '.
    • The value of the tight margins - print any of the pages on which is located the wandering image.
    • Copy the contents of the document in a WordPad document > save content > print a page that provides one of the problem images.  Check the result.
    • If you use fonts "bizarre" and maybe even if you don't do so, be sure that embed you the fonts in the document.
    • Setting word for Printing Options:

    Control Panel > display icon > devices and printers >

    Right-click Printer > Printing Preferences > tab Layout > advanced >

    On the printer side tab > preserve the page layout (select) Yes > OK

    • If all else fails, the document to a PDF output and printing that - or print the PDF file as an image.

    I've probably missed something - if I have 'find', I'll post back.

    When you see a post that will help you,

    Who inspires you, gives a cool idea,

    Or you learn something new.

    Click the 'Thumbs Up' on this post.

    Fixed / responded? Click this post accept as Solution to help others find answers.

  • Type on a path which increases progressively from left to right size

    I need to create type on a path where the characters gradually increase in size from left to right. I know I can manually change the size of each character, but anyone know of an easier way to do it-possibly with a script?

    This previous discussion may be useful:

    http://forums.Adobe.com/message/1275493#1275493

    The link to the script mentioned in the thread above is broken, but it should work:

    http://forums.Adobe.com/message/1258988#1258988

  • Can someone tell me why a site in particular is HUGE on my screen? All other sites are the right size. I can't work on how to make it back to normal size... Any suggestion would be appreciated...

    I don't remember clicking on anything to change the size...

    Press Ctrl + 0 (zero), which will provide the zoom. Firefox remembers the setting of zoom for each site, and you may have accidentally set using + or Ctrl-.

    In addition, update your Firefox. Your're a worms. outside. I hope this helps.

  • my screen resolution is too large for the screen on my monitor. I can't get it back to the right size.

    I can't my screen where I can see it properly. Everything is too big and I don't know what to do.

    is today

    Only the web pages or the UI as well?

    Reset the page zoom on pages that cause problems: view > Zoom > reset (Ctrl + 0 (zero); Cmd + 0 on Mac)
    See the font size and zoom - increase the size of web pages and the font size and zoom - increase the size of web pages and http://kb.mozillazine.org/Zoom_text_of_web_pages

  • Keynote opens the window to the right size

    Keynote 6.6.1.   When I open an existing file, or create a new blank presentation, the window is the wrong size (generally, about 300 x 100 pixels in size, located at the bottom left of my main screen).

    The console log shows this:

    09/02/16 8:29:24.732 AM Keynote [1170]: without at the same time meet the constraints:

    (

    «= 126)] > »,

    "<=-226)]>"

    )

    Will try to recover by the breaking stress

    <=-226)]>

    The NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints set to YES for-[NSWindow visualizeConstraints:] automatically called when this happens.  And/or break on objc_exception_throw to make up for it in the debugger.

    It started when I updated from 10.10 to 10.11.

    More information:

    • If I only use one monitor (built-in monitor of the work of the retina) the problem occurs
    • If I run two monitors (built-in monitor + monitor thunderbolt external apple) but I'm set to mirror mode, the problem does not occur
    • If I run two monitors (built-in monitor + monitor thunderbolt external apple) but I'm not mirrored, then the problem DOES not occur.

    If this seems to be a bug with Keynote or 10.11 himself.

    Note: In system preferences / Mission Control / I "Screens have a separate space" decommissioned.

  • IMAQ text overlay, then Writfile in the right size

    Hello

    I use IMAQ to display an image, and then I want to draw lines by using the KING and text overlay, before exporting it as a jpg or bitmap.

    Please take a look at the façade attached jpg.  It shows a part of my image of front panel and I drew a KING of the line next to the line, I added text.  It looks great.  But when I use IMAQ write file 2 or IMAQ Write queue, then the KING and the cache are not correct.  Please look at the OverlayLV - you can see the line type (only now it is green), and the text is really tiny.

    Thanks for any help!

    Steve

    Hi all

    I thought about it.  Before adding the KING and overlays, I had to re - sample the image to the size of my IMAQ indicator.

    Steve

  • dx4860-ub33p need to fix p03.a3 bios rom says this isn't the right size trying to flash

    Hi Im running on P02. A2 bios trying to upgrade to P03. A3 USB 3.0 supports DX4860-UB33P. Everytime I try to upgrade the bios says itt rom size is not the same as bios current and leaves the program... The size my 2097 KB file support rom bios cureent gateway is 2.5 MB idk what to do can not find the correct file anywhere

    mp3master69,

    The reason why there are other versions of BIOS offered is for the newer models of this series which require different BIOS versions. What you are currently using is the most recent and the most recent BIOS we have for your device.

  • Window seems to be the right size

    My windows XP was recentlly, hard hit by a virus and I took it to a shop that has reinstalled XP. Since then, with Internet Explorer and Firefox, windows ' do not seem to fits correctly "it's climax with Sky poker where I can't play without playing in mini mode screen like the bottom is cut off. Is there something I can do?

    Hi fivesandthrees,
     
    More flash-based browser games do not seem to resize correctly when the user resize the window of their browser (Ctrl + mousewheel).
     
    Method 1: To start Internet Explorer in the same size of Windows, follow these steps:
    a. launch Internet Explorer. Click on one of the window corners and make it to completely fill your screen. Do not use the maximize button.
    b. Press [Alt] to display the menu bar.
    c. press and hold or [Ctrl] or [SHIFT] while selecting Exit on the file menu. Do not use the close button.
    d. now, when you start Internet Explorer, it should open in a full window. If it opens in the same window, repeat the steps but press and hold the button opposite to step 4, it is either [Ctrl] or [Shift].
     
    Method 2: See if the configuration of security settings Internet Explorer to allow windows initiated by scripts without size or position constraints will help in this case (to play).
     
    a. open Internet Explorer.
    b. click on tools. Click on Internet Options.
    c. click on security. Click on custom level.
    d. scroll down until you find this setting:
    Allow windows initiated by scripts without size or position constraints.
    e. , click Activate. Click OK to exit the security settings, and then click OK to close Internet Options.
    f. restart your computer.
  • C5180 tells me that paper is the right size or type is incorrect.

    I have a photosmart c5180 all in one. I started having an error message, the incompatibility of paper. size of paper or type is incorrect. I used the same paper in the same place for years. I did everything I know how to fix.

    Any suggestions?

    Normally, it is thanks to sensors of paper in the paper from the printer tray. If the paper sensors are dirty, damaged or blocked, then the printer will display a paper or paper Mismatch message.

    There is a document in paper Mismatch questions located here.

    Let me know how it goes.

  • Extended virtual disk - Windows 7 has the right size - a former size VMWare

    I extended a 100-150 GB virtual drive using the slider under VMWare disk/SCSI settings.  I then started Windows 7 and the size of the disk is correct, 150 GB with 49 GB free.

    Under VMWare Fusion settings, 'Get info', it still shows it as 100 GB with free to talk about anything.

    Tried to remove and replace the drive, but he returned as 100 GB.

    Also tried, as suggested in the forum the following.

    DiskPart > list volume

    DiskPart > select volume 3 (select the number according to your requirement)

    DiskPart > extend filesystem

    I see now what they say, it must not contain the volume of pages, but Windows 7 is fine after that, so I don't know that's the problem.

    Hi Fishing2Day,

    Thank you for using the merger.

    If you do not check "Pre-allocate disk space", the size of the disk will not occupy the ability at the same time, so as you describe it "under VMWare Fusion settings, 'Get info', it still shows it as 100 GB with free to talk about anything."

    But if you check "pre-allocate disk space", Fusion will be the ability at the same time, no matter when you write the data.

    Hope this is a help to you.

  • My pdfs are too big to convert - how to make them down to the right size?

    My pdfs are 150 MB and larger, then the converter will not take them. How to make them up to a size of convert?

    You will need Acrobat to reduce the size of the file, but if you have Acrobat, you can convert as well with Acrobat.

Maybe you are looking for