Collection for the PowerCLI scripting requirements

Someone at - it a good model that helps you organize information, gathering process when you go to the management or to a customer to get for scripts and automation requirements that they want to do?  Y at - it a Web page or a book that puts this kind of thing in a structured methodology or at least one practical how to guide?

For example, what kinds of questions should I go to make sure that I understand any of my script is supposed to do and help the management or the customer understand what THEY want to do, and get a consensus agreement on the functional requirements for my powerCLI script?

Your suggestions of entry, welcome masters strategies.

This question is not really unique for PowerCLI scripting, but all scripts/programs, to write (for yourself or for a customer |).

And of course, there are always the classic answer "it depends".

If it is a small task that you write yourself, the requirements are pretty obvious.

Most of the time, you have the requirements in your head, but it does not have to write in schematic form.

When you write for a customer, by definition be more formal (I guess).

An article I like, is the Introduction to gather our creative use cases and requirements published in the Code review.

Take a look.

Tags: VMware

Similar Questions

  • GUI for the PowerCLI scripting

    Someone knows a software or tool that generate the GUI for the PowerCLI scripting?

    There are a few, Sapien is free and it's called PrimalForms Community Edition.

  • Change the PowerCLI Script to use the DRS and DRS storage

    Hello

    I have a PowerCLI script that specifies a host and a data store to create a new virtual machine, which has served us well. Now we have activated the DRS and DRS storage and I wonder what to change in order to take advantage of these features. Are there commands to specify a cluster and the cluster data store and let the DRS to decide the initial investment for a new virtual machine? At the moment we put all hosts and the warehouses of data as variables and use them in the line below.

    Thank you.

    $newVM = New-VM-name $NewVMname - VM $TemplateName Datastore - $datastore - VMHost $vHost - confirm: $false - location $myName

    You set a Datastorecluster?

    If Yes, then you can replace the value of parameter data with the datastorecluster object store.

    Replacing a VMHost with a cluster is not taken in charge I'm afraid.

    But you can use something like this

    New-VM-name TestVM Datastore - DSC - ResourcePool (Get-Cluster-name mycluster |) Get - Resourcepool - name of resources)

    This will automatically select the VMHost.

    The virtual machine appears in the root of the cluster.

    DSC is the name of a datastorecluster in the cluster mycluster

  • copyright in the powercli script symbol

    I need to print the copyright symbol when a powercli script is run.

    but,

    write-host "Copyright ©" does not print a circle with a 'c' in there

    It prints just a 'c '.

    no idea how to get this printed on the screen

    Strange, who also works for me also, what happens if you use the below:

    Write-Host "Copyright $([Char]0169)"
    
  • Game for the ICM script step

    Hi all

    I'm new to company of the IPCC and I'm doing some scripts in ICM. I'm doing a step 'play' function in ICM sript. I just haven't found how correctly everything good (step by step, preference in ICM must correspond to what in IVR). For now I'm stuck with a bunch of 'quick read' IVR scripts and it's surely is not the way. :)

    Pointers where to look?

    Thank you! Sorry for the newbie question.

    Ervins

    You can pass the quick name in a variable of a generic IVR script that takes the variable playing the guest. I did it in the field, and I use this method to test the script and listen to the guests. The only downside is you must use a node SET in ICM to set the prompt name and then an EXTERNALLY RUN SCRIPT however acquire you the ability to actually play any of what IVR prompt and have only a manuscript of IVR to implement this. You can also implement a design to pass multiple variables if you had an IVR script that could interpret several variables and playing several guests.

  • Intervals of collection for the IC Agents

    Hi all

    Not sure how many of you are on 5,6 and use the cartridge of the Infrastructure. Does anyone know if it is possible to set different collection interval for different indicators? We are ok to collect measures of performance (CPU/memory/process, etc.) every 5 minutes, but we want to collect EventLog and Services every 1 min, we used to be able to do it with the old cartridge to OS, but with the new cartridge Infra, I couldn't quite understand how.

    Thank you

    Xiaoning

    It is not possible to do so today with a single agent. The HostAgent uses a calendar of unique collection for all the measures that it collects. You might approach creating two agents - a to collect metrics based on the frequency of 5 minutes by default and the other to collect only events and services according to a schedule of 1 minute. I filed an enhancement request to consider separate in a later collection times.

    Message edited by Stuart Hodgins to correct typos.

  • PLSQL Collection for the holding of the identifiers

    Hello experts,

    I ask for your help?

    I have tables like this: COMP_REL (PARENT NUMBER, NUMBER of CHILDREN) and COMP_INFO (NUMBER CHILD,...).

    In a procedure, I need to make several select statements of COMP_INFO for all children under a parent (grouping of different columns of COMP_INFO).

    The problem is that COMP_REL table is huge. How can I use PLSQL collection (or table) to store the children of COMP_REL I need and then join this collection with COMP_INFO to get different data?

    It is advisable to use collections PLSQL for this purpose at all?


    Thank you, Atanas.

    Hello

    I used analytical functions for the info that I need with only a query the comp_info table (didn't need to interrogate several times). So I didn't have to use TWG or a collection of temporary cache results.

    Thank you very much for your help!

  • Error in executing the PowerCLI script change IOPS / s

    M community you want to run the script below, however when run got the following error in the result.

    Please could you help me?

    # SCRIPT TO #.

    $hostesxi = get-Content - Path "C:\Users\vsilva\Desktop\hostsinfo.csv".

    $DiskID = get-Content - Path "C:\Users\vsilva\Desktop\diskiops.csv".

    SE connect-VIServer-Server $hostesxi - user "myuser" - password "MonMotpasse".

    # $esxcli.system.hostname.get () #.

    $esxcli = get-EsxCli - VMHost $hostesxi

    $esxcli.storage.nmp.device.list () | where {$_.} Device-match $DiskID} | $esxcli.storage.nmp.psp.roundrobin.deviceconfig.set % (0, $null, $_.) Device, 1, "OPS", 0)

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

    # OUT #BUG #.

    Could not find an overload for the 'set' and the number of arguments: "6".

    C:\Users\vsilva\Desktop\changeiops.ps1:9 char: 1

    + $esxcli.storage.nmp.device.list () | where {$_.} Device-match $DiskID} | % $esxcli. ...

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

    + CategoryInfo: NotSpecified: (:)) [], MethodException)

    + FullyQualifiedErrorId: MethodCountCouldNotFindBest

    Thank you all,.

    More could solve my problem in a way report, for me this exellent, must be attached to the completed manuscript shares with the community.

    Good bye.

  • XML and the PowerCLI Scripting Edition

    Good then I am using PowerCLI to do Automation more boring tasks that need to be repeated. But now I'm stuck because I do not understand how to enter commands in the window PowerCLI and creating XML scripts that are called by a manually scheduled task.

    Is there training there or good articles on how to go to the manual entry of orders from command line and in scripts development of really?

    Any information would be greatly appreciated.

    See you soon,.

    Paul

    I assume you are talking about PowerShell scripts and not the XML scripts?

    You can find a good intro to PowerShell scripts in Chapter 10 of free PowerShell ebookTobias.

  • Poweroff / poweron VM via the powerCLI script

    Hello

    Is it possible to script a poweroff OWN for all my VM on a cluster (RedHat and Windows). Ditto for the ignition.

    If YES, can you give me the lines in the batch

    THX

    Yes, this triggers a stop through the guest OS.

    For a cluster, you could do

    Get-Cluster -Name  | Get-VM | Shutdown-VMGuest -Confirm:$false
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Scoring and data collection for the Simple Flash game using Actionscript 2

    Hello all-

    First of all, let me say that I am not very well or well informed when it comes to actionscript...

    I could really use some help with a problem I encountered.

    My company has developed a very simple type "Whack-a-Mole" game for a social media campaign.

    See here: http://www.hereforyoueverystep.com/social/game.html

    Our customer request now that we add a rating system so that we can offer a price for the best 3 scores.

    What I need, is to link the number of "hits" on a partition and allow the user to enter their e-mail address at the end of the game connected to the score they achieve.

    It was developed in Actionscript 2, because of a tutorial that was followed.

    If anyone can give me some advice or offer to edit my files directly, I would be very grateful.

    Thank you!

    Create a variable (for example, note), initialize it (to zero) and increment when a Mole is stubborn.

    Then, you create a database on the server that stores the best scores.  You must use the flash LoadVars class to update and extract high scores and you will need to use the script to write in your database server-side.

  • Code action for the Update Script

    Can someone please. I just need the script necessary to force the cursor from one field to another when you press the tab key. A script here that I found in the model I bought. But it seems to be used to control the color, not the progress of the selection of text field by pressing the tab key. Moreover, it is the only place in the action script which appears the word 'Focus', but the tab works until you get in the 'State' field, how he goes directly to a menu drop-down.

    Can someone put me directly? Here's the script:

    Changes the colors of background on the development as well as remove the text currently in the text box.
    nameTxt.onSetFocus = function() {}
    nameTxt.text ="";
    nameTxt.backgroundColor = tbgColorOn;
    emailTxt.backgroundColor = addressTxt.backgroundColor is cityTxt.backgroundColor = stateTxt.backgroundColor = zipTxt.backgr oundColor = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgColo rOff;.
    };
    emailTxt.onSetFocus = function() {}
    emailTxt.text ="";
    emailTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = addressTxt.backgroundColor is cityTxt.backgroundColor = stateTxt.backgroundColor = zipTxt.backgr oundColor = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgColo rOff;.
    };
    addressTxt.onSetFocus = function() {}
    addressTxt.text ="";
    addressTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor = cityTxt.backgroundColor = stateTxt.backgroundColor = zipTxt.backgrou ndColor = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgColorO and ff.;
    };
    cityTxt.onSetFocus = function() {}
    cityTxt.text ="";
    cityTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is addressTxt.backgroundColor = stateTxt.backgroundColor = zipTxt.backg roundColor = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgCol orOff.;
    };
    stateTxt.onSetFocus = {zipTxt.onSetFocus = function ()}
    stateTxt.text ="";
    stateTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is addressTxt.backgroundColor = cityTxt.backgroundColor = zipTxt.backgr oundColor = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgColo rOff;.
    };
    zipTxt.onSetFocus = ageTxt.onSetFocus = function() {}
    zipTxt.text ="";
    zipTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is addressTxt.backgroundColor = cityTxt.backgroundColor = stateTxt.back = ageTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgCo Kosmetikstudio groundColor;.
    };
    ageTxt.onSetFocus = function() {}
    ageTxt.text ="";
    ageTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is addressTxt.backgroundColor = cityTxt.backgroundColor = stateTxt.back = zipTxt.backgroundColor = genderTxt.backgroundColor = descTxt.backgroundColor = tbgCo Kosmetikstudio groundColor;.
    };
    genderTxt.onSetFocus = function() {}
    genderTxt.text ="";
    genderTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is cityTxt.backgroundColor = addressTxt.backgroundColor = zipTxt.backgr = ageTxt.backgroundColor = descTxt.backgroundColor = tbgColorOff oundColor;.

    };
    descTxt.onSetFocus = function() {}
    descTxt.text ="";
    descTxt.backgroundColor = tbgColorOn;
    nameTxt.backgroundColor = emailTxt.backgroundColor is cityTxt.backgroundColor = stateTxt.backgroundColor = addressTxt.back = zipTxt.backgroundColor = ageTxt.backgroundColor = genderTxt.backgroundColor = tbgCol orOff groundColor;.
    };

    TOO BAD > I THOUGHT OF IT!

  • PowerCLI Script required to identify all clusters in a data center and all hosts within each cluster and calculate it using cpu and ram, avg, min, and max.

    Hi all

    I'm new to powercli and try to create a script to list all clusters in a data center and all hosts in a cluster and calculate min, max and avg cpu usage and ram by the host and cluster. So far, I have tried the below but I can't publish the results of my script.

    $Function = @)
    ForEach ($DataCenter Get-Data Center)
    {
    ForEach ($cluster in ($DataCenter |)) Get - Cluster)) - need help to post the information here and confirm if this is correct or not.
    {
    ForEach ($hosts in ($cluster |)) Get - VMHost))
    {
    ForEach ($vms to ($hosts |)) Get - VM)) - do not know if I called you here functions properly
    {
    $allvms = @)
    $allhosts = @)
    $hosts = get-VMHost
    $vms = get - Vm

    {foreach ($vms in $hosts)
    $hoststat = "" | Select the host name, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin
    $hoststat. Host name = $vmHost.name

    $statcpu = get-Stat-entity ($vmHost) - start (get-date). AddDays(-30)-Finish (Get-Date) - MaxSamples 10000 - stat cpu.usage.average
    $statmem = get-Stat-entity ($vmHost) - start (get-date). AddDays(-30)-Finish (Get-Date) - MaxSamples 10000 - stat mem.usage.average

    $cpu = $statcpu | Measure-object-property value - average - Maximum - Minimum
    $mem = $statmem | Measure-object-property value - average - Maximum - Minimum

    $hoststat. CPUMax = $cpu. Maximum
    $hoststat. CPUAvg = $cpu. Average
    $hoststat. CPUMin = $cpu. Minimum
    $hoststat. MemMax = $mem. Maximum
    $hoststat. MemAvg = $mem. Average
    $hoststat. MemMin = $mem. Minimum
    $allhosts += $hoststat
    }
    }
    }
    }
    }

    $Function | Select the host name, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin | Export-Csv "c:\Function.csv" - noTypeInformation

    Any help on this is much appreciated.

    [Ordered] casting was introduced in v3 PowerShell.

    For PowerShell v2, you can use

    $vms = get - VM

    $stat = 'cpu.usage.average ','mem.usage.average '.

    $start = (get-Date). AddDays(-31)

    $report = get-Stat-entity $vms - start $start - Stat $stat - ErrorAction SilentlyContinue |

    Group-object - property {$_.} @entity.name} | %{

    $cpu = $_. Group | where {$_.} MetricId - eq "cpu.usage.average"} | Measure-object-property value - average - Maximum - Minimum

    $mem = $_. Group | where {$_.} MetricId - eq "mem.usage.average"} | Measure-object-property value - average - Maximum - Minimum

    New-object PSObject-property @ {}

    Datacenter = Get-Datacenter - VM $_. Group [0]. Entity | Select the name of ExpandProperty-

    Cluster Cluster Get - VM = $_. Group [0]. Entity | Select the name of ExpandProperty-

    VMHost = $_. Group [0]. Entity.Host.Name

    Name = $_. Group [0]. @entity.name

    CpuMin = $cpu. Minimum

    CpuAvg = $cpu. Average

    CpuMax = $cpu. Maximum

    MemMin = $mem. Minimum

    MemAvg = $mem. Average

    MemMax = $mem. Maximum

    }

    }

    $report | Sort-Object-property Datacenter, Cluster, VMHost name |

    Export Csv report.csv - NoTypeInformation - UseCulture

  • Import Excel to use with the PowerCLI script file

    I would try to ingest the VMware Hardening guide Excel file and then use it to run a script on some columns as column "configuration setting.

    If I can get the "Configuration parameter'"desired value""Default value"and"ID of the guideline"a powershell script, it would be easy from there.

    Someone did he do something like that or it can crack in Powershell?

    If you save the HG as XLSX file, just open the XLS and save under a XLSX in Excel, you can use the function import - Excel of Finke.

    How to install and use is described on the Github page.

    So is boils down to

    Import-Excel vSphere_6_0_Hardening_Guide_GA_15_Jun_2015.xlsx |

    Select "Configuration parameter', 'Value', 'Default value',"Orientation Id"

  • by the way to bulk vm "s in a text to the powercli script

    Hello

    I want to increase the size of the vmdk. I have a script to increase the size of vmdk, but I want to move the file with the names of virtual machine as a parameter,

    I tried to use this

    $VMs = get-Content d:\vmslist.txt

    but it takes all the machines as the name 1vm names even if they are 1 per line.

    Now try the script like this

    foreach ($vm in (Get-VM-name (Get-Content:\vmslist.txt))) {}

    $guestUser = "xxxxx".

    $guestPass = "xxxxx".

    $newSizeGB = xxx

    Get-disk hard - vm $vm |? {$_.name - eq 'Disk 1'} |

    Together-hard drive - CapacityKB ($newSizeGB * 1 MB) - ResizeGuestPartition - $guestUser - GuestPassword $guestPass GuestUser - confirm: $false - ErrorAction: SilentlyContinue

    Invoke-VMScript - vm $vm - ScriptText ' select flight c echo > c:\diskpart.txt & extend echo > c:\diskpart.txt & diskpart.exe /s c:\diskpart.txt "- GuestUser $guestUser - GuestPassword $guestPass - ScriptType BEATS

    }

Maybe you are looking for