script to add vmk1 for vmotion using foreach

OK, so I am writing a script to add ecards to a host or multiple hosts.  The idea of the user will input one or several host names separated by a comma.  This part works fine, but the next variable I need filled is the ip address, which is also the registration of the user separated by a comma.  I can't find a way to get both of these channels in a single command.

$servers = (Read-Host "enter host names that you want to configure... FULL domain name (separate them with comma) ").split(',') |" % {$_.trim ()}

$lasttwooctets = (Read-host "which is the last two octets of your IP prod? (separate with comma) ").split(',') |" % {$_.trim ()}

#Add VMK1, vmotion, nas, and backup

foreach ($esxihost in $servers) {}

New-VMHostNetworkAdapter - VMHost $esxihost - PortGroup 'dvPortGroup_999 (vmotion)' - 'dvSwitch_vcenter' VirtualSwitch - IP 172.24. $lasttwooctets - subnet mask 255.255.0.0 - VMotionEnabled: $true - mtu 9000

}

If anyone has an idea on how to make an extra foreach for the $lasttwooctets variable that would be greate

Since you have 2 bays where the elements come together, it will be easier to do indexing yourself, instead of using the 2 nested ForEach loops.

Something like this for example

$servers = (Read-Host "enter host names that you want to configure... FULL domain name (separate them with comma) ").split(',') |" % {$_.trim ()}

$lasttwooctets = (Read-host "which is the last two octets of your IP prod? (separate with comma) ").split(',') |" % {$_.trim ()}

#Add VMK1, vmotion, nas, and backup

0. ($servers. Count - 1) | %{

"New-VMHostNetworkAdapter - VMHost $servers [$_] PortGroup-"dvPortGroup_999 (vmotion)"- VirtualSwitch 'dvSwitch_vcenter'"

-"172.24.$($lasttwooctets[$_])" - subnet mask 255.255.0.0 - VMotionEnabled IP: $true - mtu 9000

}

You could test whether the $servers table and the $lasttwooctets table have the same number of elements, to ensure that user input is correct.

Tags: VMware

Similar Questions

  • Script for the use of rich text change

    I use the script below to add instructions for the use of Textfields. I would like to do the same thing with textfields in the rich text format, but this script no longer works when I put in the field to accept rich text. Can you tell me how to change the script, so it does not work in a ttext field that allows the user to enter rich text?

    MeetingMinutes. #subform [2]. Attendees::Initialize - (JavaScript, client)

    this.execEvent ("exit");
    This.format.Picture.Value = "null {'}" + this.assist.toolTip.value + ""} "";


    MeetingMinutes. #subform [2]. Attendees::Enter - (JavaScript, client)

    this.fontColor = "0,0,0";
    This.font.posture = "normal";


    MeetingMinutes. #subform [2]. Attendees::exit - (JavaScript, client)

    If (this.isNull)
    {
    this.fontColor = "153,153,153";
    This.font.posture = "italic";
    }


    MeetingMinutes. #subform [2]. Attendees::prePrint - (JavaScript, client)

    This.format.Picture.Value = "";


    MeetingMinutes. #subform [2]. Attendees::postPrint - (JavaScript, client)

    This.format.Picture.Value = "null {'}" + this.assist.toolTip.value + ""} "";

    Thank you

    -Don

    Hi Don,

    Similar to your script above, but try this in the event enter:

    if (this.rawValue === this.assist.toolTip.value) {
              this.rawValue = "";
    }
    

    and then exit on the event:

    if (this.rawValue === null) {
              this.rawValue = this.assist.toolTip.value;
    }
    

    ALTER depending on the initialize event and formatting, etc.

    Niall

  • Cluster of VSA: can I use vmnic separated for vMotion and HA

    Update: I should have clarified. I posted this under VSA so I assumed it was clear that the issue was linked to VSA. VSA 1.0 _automatically_ creates a network of cluster and vMotion. I don't want this configuration as I have 8 vmnic, not 4. So instead of sharing the vSwitch, I hope that I can devote the vmnic.

    If I have 8 network cards, can I use my network cards and dedicate for vMotion? For example I create an another vSwitch, then devote 2 vmnic to it.

    The manual indicates that HA will use a network other than the ESXi management network. I thought HA always use the ESXi management network?

    Thanks for Singapore

    E1

    Hi Iwan

    I found your answer on page 22

    Software requirements for ESXi in a Cluster VSA

     

    vSphere standard switch and the configuration of the port group

    Each ESXi host must only have the default vSphere standard

    switches or groups of ports that are created during the installation.

    You don't need to configure any port or additional switches

    groups.

    So, in summary, you should have at least 4 cards network

    If you have 8 NIC you can only add network cards to existing switches for additional flow/redundancy

    So changing the vSwitches/Exchange is not supported

    I would like to see what happens if you do it well

    Please allow points to useful/correct answers

  • Looking for an add-on for FF button that launches TB (or any application). The add-on GetMailPlus I used is now broken

    There are several add-ons for FF to launch specific applications. A generic "Push the button, launch any application" would be more useful. Surely, this already exists?

    Hi, take a look at the buttons of toolbar - if it is not what you want, you can create one!

    If your question is resolved by this or another answer, please take a minute to let us know. Thank you.

  • I can't use gestures on Firefox, but I can On Explorer is there an add on for this

    I have a Dell Inspiron One 2305 as computer has a touch screen that you can use gestures to Zoom In and Out with two fingers or pinch the Surface of the screen (as an I Phone)... He works on the Explorer browser, but not on Firefox... Y has an Add On for this problem I do not know if it would work on 3.6 since I was 4 now... I prefer not to use the two BrowsersOne for some another for other stuff

    Some actions have been removed in Firefox 4.

    You can restore the zoom feature by changing the related values of downtown on the topic: config page.

    browser.gesture.pinch.in -> cmd_fullZoomReduce
    browser.gesture.pinch.in.shift -> cmd_fullZoomReset
    browser.gesture.pinch.out -> cmd_fullZoomEnlarge
    browser.gesture.pinch.out.shift -> cmd_fullZoomReset
    browser.gesture.pinch.latched -> false
    

    To open the topic: config page, type Subject: config in the address bar (address) and press the 'Enter' key, as you type the url of a Web site to open a Web site.

    If you see a warning then you can confirm that you want to access this page.

  • As part of the SAR cert is to have a NW separated between ESXi host required for VMotion or is it OK to use IP for VMotion management, in the execution of Certification tests.

    As part of the SAR cert is "have a NW/dedicated separate between hosts ESXi (on which we GOS) mandatory for VMotion or is - OK to use IP for VMotion management in the execution of Certification tests.»

    Note that the verification passed Test when you use management IP for Vmotion and without a dedicated connection to NW between ESXi hosts.

    Separate dedicated network interface cards preferred. No problem with the test after this change case.

  • I use a Mac.  I "upgraded" to of LR4 LR5.  I don't want to be a member of the "creative cloud."  I just want to use the software that I bought, more precisely to load on my SmugMug account.  Is it possible to use an add-on for this?  Opening and L

    I use a Mac.  I "upgraded" to of LR4 LR5.  I don't want to be a member of the "creative cloud."  I just want to use the software that I bought, more precisely to load on my SmugMug account.  Is it possible to use an add-on for this?  Opening and LR4 were easy, but I think it's impossible without subscribing to CC.

    do you mean that you get a page Adobe Adobe ID, wondering like that? If you have followed my second just method?

    If this is the case, this isn't an obligation to subscribe to the CC, but just a completely - a free Adobe ID, email and a password which can identify you.

    In fact, it is the same name of username/password used to log-in on this forum.

  • How should be written the script for the use of the maximum memory of the guest operating system ever?

    How should be written the script for the use of the maximum memory of the guest operating system ever?

    Please teach the name of the object and the type and order, etc.

    You should be able to do it with the cmdlet Get-Stat .

    Something like that

    Get-Stat -Entity (Get-VM $vmName) -Stat mem.usage.maximum -Start (Get-Date).AddDays(-7) | Measure-Object -Property value -Maximum | Select Maximum
    

    This will return the maximum percentage in the last 7 days for the guests, whose name is stored in the variable $vmName.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Search for files using scripts?

    Is it is possible to search for files using Photoshop scripts?

    I'm looking for "cat_picture.jpg" but I don't know exactly which folder it is in.  Are there commands that will search for and return the path of this file for me?

    Thank you

    I had copied the functions of xtools/xlib/stdlib.js and munged some of the changes. This is a test version that works:

    function getFolders(folder) {
      if (folder.alias) {
        folder = folder.resolve();
      }
      return folder.getFiles(function(f) { return f instanceof Folder; });
    };
    
    function findFiles(folder, mask) {
      if (folder.alias) {
        folder = folder.resolve();
      }
      var files = folder.getFiles(mask);
      var folders = getFolders(folder);
    
      for (var i = 0; i < folders.length; i++) {
        var f = folders[i];
        var ffs = findFiles(f, mask);
        // files.concat(ffs); This occasionally fails for some unknown reason (aka
        // interpreter Bug) so we do it manually instead
        while (ffs.length > 0) {
          files.push(ffs.shift());
        }
      }
      return files;
    };
    

    Use:

    var f = findFiles(Folder('~/Desktop/PSE9_CIB'), '*.psd');
    $.writeln(f);
    
  • Script to add several vPortGroups on a vSvitch on the mulpitple hosts

    Hello

    I have a small script to add several vPortGroups on a vSvitch on mulpitple of the hosts.

    The Script looks like:

    $ObjHosts = get-VMHost host12 * | Sort-Object-property name

    Import-Csv "C:\vPortGroups.csv" - UseCulture | %{
    {foreach ($objHost to $ObjHosts)
    $strVSwitch = get-Virtualswitch - VMHost (Get-VMHost $objHost) | WHERE-object {$_.} {Name - match "$_.strVSwitch"}
    Write-Host "Adding virtual port group" $_.strNewVPG "with VLAN Tag' $_.strNewVlanTag 'to' $_.strVSwitch 'on' $objHost
    New-VirtualPortGroup-name "$_.strNewVPG"-VirtualSwitch "$_.strVSwitch"-VLanId ' $_.strNewVlanTag '.
    }
    }

    The input file looks like:

    strNewVPG; strVSwitch; strNewVlanTag
    "4.244.151.0 - 24"; «vSwitch1 «;» 120

    If we use only the line "Write-Host"Adding Virtual Port Group"$_.strNewVPG" with VLAN Tag ' $_.strNewVlanTag 'to' $_.strVSwitch 'on' $objHost' "

    the output is "add the port group virtual 4.244.151.0 - 24 with VLAN Tag 120 to vSwitch1 on d100spwesxc3101.d100.intern.

    Thus, the input file is correct and legible for the script.

    If I use the full script, the output message is:

    New-VirtualPortGroup: cannot bind parameter 'VLanId '. Cannot convert value ' @{strNewVPG = 4.244.151.0 - 24;} '. strVSwitch = vSwitch1; "strNewVlanTag = 120} .strNewVlanTag" to type "System.Int32". Error: "I."
    nput string was not in a correct format. »
    C:\Dokumente und Einstellungen\user1\Eigene Dateien\VMWare PowerShell Scripte\add_VirtualPortGroup_by_inputfile.ps1:7 tank: 83
    + New-VirtualPortGroup-name "$_.strNewVPG"-VirtualSwitch ' $_.strVSwitch ' VLanId - < < < < "$_.strNewVlanTag."
    + CategoryInfo: InvalidArgument: (:)) [new VirtualPortGroup], ParameterBindingException)
    + FullyQualifiedErrorId: CannotConvertArgumentNoMessage, VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.NewVirtualPortGroup

    What's not here?

    I made a few changes to your script. You can try the new version?

    $ObjHosts = Get-VMHost host12* |Sort-Object -Property Name
    
    Import-Csv "C:\vPortGroups.csv" -UseCulture | %{
        $vPortGroup = $_
        foreach($objHost in $ObjHosts){
            $strVSwitch = Get-Virtualswitch -VMHost (Get-VMHost $objHost) | where-object { $_.Name -match $vPortGroup.strVSwitch }
            Write-Host "Adding Virtual Port Group" $vPortGroup.strNewVPG "with VLAN Tag" $vPortGroup.strNewVlanTag "to" $vPortGroup.strVSwitch "on" $objHost.Name
            New-VirtualPortGroup -Name $vPortGroup.strNewVPG -VirtualSwitch $strVSwitch -VLanId $vPortGroup.strNewVlanTag
        }
    }
    

    One of the main problems was that $_ represents only the object from the pipeline last. So I added the line $vPortGroup = $_ to keep the line from the file entry in the variable $vPortGroup.

    Best regards, Robert

  • PowerShell Script to add users and permissions to the ESX host

    Here is a script to add the user accounts...

    You have a script to add the permissions?

    1. Original by c_shanklin @ http://communities.VMware.com/message/1013362

    Function New-VMHostShellAccount {param ($Name, $Password = $null, $Description = $null, $PosixId = $null) $SvcInstance = Get-view serviceinstance $AcctMgr = Get-View $SvcInstance.Content.AccountManager $AcctSpec = new-object VMware.Vim.HostPosixAccountSpec $AcctSpec.id = $ $Name = AcctSpec.password $AcctSpec.description $Password = $Description $AcctSpec.shellAccess = $false # Enable shell access $AcctSpec.posixId = $PosixId $AcctMgr.CreateUser ($AcctSpec) # Create user Get-VMHostAccount |} Where-Object {$_.} {ID - eq $Name} # Write new user in the output stream just as New-VMHostAccount would be}

    1. Added by Timothy cutting

    $vcs = @ ($vcs) += connect-viserver "VCSERVER01" $vcs += connect-viserver "VCSERVER02" $vcs += connect-viserver "VCSERVER03" $vcs += connect-viserver "VCSERVER04" $vcs += connect-viserver 'VCSERVER05' $vcs += connect-viserver 'VCSERVER06 '.

    $user = Read-Host "authenticate - USER NAME" $pass = Read-Host "Authenticate - PASSWORD" $newuser = Read-Host "Create new user account" $newpass = Read-Host "Create New Password" $description = Read-Host "Create Description" $Id = Read-Host "to create identification number.

    $vmhosts = get-VMHost-Server $vcs | Sort-Object Name

    foreach ($vmhost in $vmhosts) {Write-Host $vmhost Connect-VIServer $vmhost - user $user-password $pass New-VMHostShellAccount-name $newuser - $newpass - $Description - $Id PosixId Description password}

    Take a look at create roles of directors by script.

    Here, I show you how to create a new 'role' and then how to assign this role, as well as accounts or shareholders as they are called in the API, entity.

    An ESX Server has 3 built in roles ('No Access', 'Read only' and 'Administrator'), but you can create your own roles with just the privileges that you need.

    Note that the VI Toolkit for Windows Community Extensions contain functions to manage roles and permissions.

    Extensions require to use PowerShell v2 CTP3!

  • Script to add keywords in Bridge based on the name of the file

    I'm working on a script that adds keywords based on the name of the image file. So, if the name of the file is AG123456 (08_16) .tif, this script would add "Agriculture", "123456" and "8/16" as keywords in bridge. "" I have a small sample of the part that retrieves the name of the file written in AppleScript below of each keyword. I know that I need to write the part that actually adds the keywords in Bridge in JavaScript, because the bridge is not capable of AppleScript. I have trouble finding the JavaScript code, I need to add the keyword. If someone could help me with this, I would really appreciate it.

    I would like to call the JavaScript code to in AppleScript instead of writing all the code in JavaScript. (The full version of it's longer, it would be a lot of code to change in JavaScript).

    on Open of droppedfiles

    with timeout of 900 seconds -> Changing timeout to 15 minutes. Default value is 2 minutes.

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

    -GET THE CHARACTERS OF THE FILE name

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

    Repeat with aFile in droppedfiles

    say application 'Finder '.

    the value file name to name of aFile

    end say

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

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

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

    -ADDED a KEYWORD FOR EACH PREFIX

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

    -Find the prefix in the name of the file

    if text 1 thru 2 of file name contains "AG" then

    the value prefixKeyword to 'Agriculture '.

    else if text 1 thru 2 of file name contains "To THE" then

    the value prefixKeyword to "Automobile".

    on the other

    the value prefixKeyword to "Need to prefix".

    end if

    -Adding the prefix as a keyword

    display dialog prefixKeyword string

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

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

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

    -ADDED a KEYWORD FOR EACH SKU NUMBER

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

    -Creating a list of all single digit numbers

    the value numberList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

    -Looking FOR THE SKU NUMBER

    -Looking for a six-digit number that starts on the third character of the file name

    if numberList contains (text 3 of file name) et numberList contains (text 4 of the file name) et numberList contains (text 5 of filename) et numberList contains (text 6 of file name) et numberList contains (text 7 of file name) then

    if numberList does not work contain the text 9 of file name and then

    if numberList contains (text 8 of the file name) then

    the value skuNumber to of 3 to 8 text filename

    the value skuNumberOffset to 8

    end if

    end if

    -Searching for a six-digit number that begins on the fourth character of the file name

    else if numberList contains (text 4 of the file name) et numberList contains (text 5 of filename) et numberList contains (text 6 of file name) et numberList contains (text 7 of file name) et numberList contains (text 8 of the file name) then

    if numberList does not work contain the 10 text of file name and then

    if numberList contains (text 9 of file name) then

    the value skuNumber to text 4 to 9 of file name

    the value skuNumberOffset to 9

    end if

    end if

    -Defining the SKU number to alert keyword keyword the user can search the

    on the other

    the value skuNumber to "Need SKU number.

    set skuNumberOffset to 0

    end if

    -ADDING THE SKU AS NUMBER one keyword

    display dialog skuNumber string

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

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

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

    -DATE ADDITION OF FILE name

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

    if file name contains "(" et nom de fichier contient ")" then "

    set leftParen to "("

    set rightParen to ")"

    -Obtain the month of the file name

    set monthOffset of (offset of leftParen in fileName) + 1 -> character returns immediately after)

    set fileNameMonth to character of filename monthOffset

    -Get all the numbers of the year of the file name

    set fileNameYearOffset1 to (offset of leftParen in file name) + 3

    set fileNameYearOffset2 to (offset of rightParen in file name)-1

    set fileNameYear1 to character of filename fileNameYearOffset1

    set fileNameYear2 to character of filename fileNameYearOffset2

    set of characters fileNameYear fileNameYearOffset1 to fileNameYearOffset2 of file name

    set dateKeyword to fileNameMonth & "/" & fileNameYear

    -ADDING THE SKU AS NUMBER one keyword

    display dialog dateKeyword string

    end if

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

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

    fin Repeat

    end timeout

    end open

    Here's an example of adding of keywords in a file, the code can be used in Bridge or Photoshop.

    var Keys = ["keyword1","keyword2","keyword3"];
    var file = File (Folder.desktop + "/zz.jpg");
    if(file.exists) setKeyword( file,Keys);
    
    function setKeyword( file,Keys){
    if ( !ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
            var xmpf = new XMPFile( File(file).fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE );
            var xmp = xmpf.getXMP();
            for(var s in Keys){
            xmp.appendArrayItem(XMPConst.NS_DC, "subject", Keys[s], 0,XMPConst.PROP_IS_ARRAY);
        }
          if (xmpf.canPutXMP( xmp )) {
             xmpf.putXMP( xmp );
          }
          xmpf.closeFile( XMPConst.CLOSE_UPDATE_SAFELY );
    };
    
  • PowerCLI Script to add disk fails after upgrade to vSphere 5.5 U1 and PowerCLI 5.5 R2

    Hi all

    I created the following script to add a disk to a virtual machine mode multi-writer for Oracle RAC. This script used to work on vSphere 5.5 GA and GA 5.5 PowerCLI, but now no longer works with vSphere 5.5 U1 and PowerCLI 5.5 R2. I don't know exactly, what has changed, but I think it has something to do with SCSI controller specification objects, more specifically the controller key.

    SE connect-VIServer VC

    $vmname = Read-Host "VM name to add disks to.

    $vmdk = Read-Host 'drive to add (full path) '.

    $busnumber = Read-host "SCSI Bus number".

    $unitnumber = Read-Host "drive number '.

    [int64] $capacity = Read-Host "disk capacity (GB).

    $vm = get - VM $vmname

    [int64] $capcitykb = ($capacity * 1 GB) / 1 KB

    Write-Host "create new album"$vmdk"of size"$capacity"GB"$vm"SCSI ID"$busnumber":" $unitnumber

    Write-Host 'capacitΘ in Ko' $capcitykb

    $ctrll = get-controller SCSI - VM $vm |? {$_.extensiondata.busNumber - eq $busnumber}

    Write-Host 'Controller key' $ctrll.extensiondata.controllerkey

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.deviceChange = new-Object VMware.Vim.VirtualDeviceConfigSpec [] (1)

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

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

    $spec.deviceChange [0] .fileOperation = "crΘer".

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

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

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

    $spec.deviceChange [0].device.backing.fileName = $vmdk

    $spec.deviceChange [0].device.backing.thinProvisioned = $false

    $spec.deviceChange [0].device.backing.split = $false

    $spec.deviceChange [0].device.backing.writeThrough = $false

    $spec.deviceChange [0].device.backing.eagerlyScrub = $true

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

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

    $spec.deviceChange [0].device.connectable.startConnected = $true

    $spec.deviceChange [0].device.connectable.allowGuestControl = $false

    $spec.deviceChange [0].device.connectable.connected = $true

    $spec.deviceChange [0].device.controllerKey = $ctrll.extensiondata.controllerkey

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

    $spec.deviceChange [0].device.capacityInKB = $capacitykb

    $spec.extraConfig = new-Object VMware.Vim.OptionValue [] (1)

    $spec.extraConfig [0] = new-Object VMware.Vim.OptionValue

    $spec.extraConfig [0] .key = 'scsi' + $busnumber + ': ' + $unitnumber + '.sharing.

    $spec.extraConfig [0] .value = 'multi-writer'

    $vm. ExtensionData.ReconfigVM ($spec)

    For some reason any $ctrll.key no longer returns any value and is completely absent, if I do a $ctrll | Get-Member to view the properties of the object.

    Any advice on how to get this script working would be greatly appreciated.

    Kind regards

    Michael

    Hi Luke,.

    Took a bit of debugging, but I finally got the script to work. Looks like that the values for $ctrll.key that I expected to be in the object disappeared definitively. In order to find the correct value, I now have to check $ctrll.extensiondata.key. Also, I needed to cast variables very carefully to the device specification. For the controllerKey it must be cast to int, like the unitNumber. Also found that the calculation for capacitykb should be cast to int64 and the 1 GB and 1 KB should be lowercase for a reason, otherwise the value is returned as a zero. So some weird things in 5.5 U1 which may seem spoiled API. Here is the final script as i've got working. It is not enough, there is no validation, police checks or anything either, but it works.

    SE connect-VIServer VC

    $vmname = Read-Host "VM name to add disks to.

    $vmdk = Read-Host 'drive to add (full path) '.

    [int] $busnumber = Read-host "SCSI Bus number number"

    [int] $unitnumber = Read-Host "drive number '.

    $capacity = Read-Host "(GB) disc.

    $vm = get - VM $vmname

    [int64] $capcitykb = ($capacity * 1 GB) / 1 KB

    Write-Host "create new album"$vmdk"of size"$capacity"GB"$vm"SCSI ID"$busnumber":" $unitnumber

    Write-Host 'Disk in KB capacity' $capcitykb

    $ctrll = get-controller SCSI - VM $vm |? {$_.extensiondata.busNumber - eq $busnumber}

    Write-Host "controller key" $ctrll.extensiondata.key "

    $spec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.deviceChange = new-Object VMware.Vim.VirtualDeviceConfigSpec [] (1)

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

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

    $spec.deviceChange [0] .fileOperation = "crΘer".

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

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

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

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

    $spec.deviceChange [0].device.backing.thinProvisioned = $false

    $spec.deviceChange [0].device.backing.split = $false

    $spec.deviceChange [0].device.backing.writeThrough = $false

    $spec.deviceChange [0].device.backing.eagerlyScrub = $true

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

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

    $spec.deviceChange [0].device.connectable.startConnected = $true

    $spec.deviceChange [0].device.connectable.allowGuestControl = $false

    $spec.deviceChange [0].device.connectable.connected = $true

    $spec.deviceChange [0].device.controllerKey = [int] $ctrll.extensiondata.key

    $spec.deviceChange [0].device.unitNumber = [int] $unitNumber

    $spec.deviceChange [0].device.capacityInKB = $capacitykb

    $spec.extraConfig = new-Object VMware.Vim.OptionValue [] (1)

    $spec.extraConfig [0] = new-Object VMware.Vim.OptionValue

    $spec.extraConfig [0] .key = 'scsi' + $busnumber + ': ' + $unitnumber + '.sharing.

    $spec.extraConfig [0] .value = 'multi-writer'

    $vm. ExtensionData.ReconfigVM ($spec)

    Now I just need to check if the script that I have which attaches to this disc to the other nodes works Oracle RAC.

  • Storage for Vmotion issues

    Currently, I have two hosts running ESX 5.1 and is looking to add a third. I have VCenter Server is also installed. I don't have a VMotion configuration but want to plan for it. My two hosts currently have a SATA 2x1To in them running raid 1 + 0.

    Research on the forums I think I know that I would need a separate storage with iSCSI or FC eith server for VMotion to work. Is this correct? I would not be able to use my storage on my hosts to store my VM?

    I read on a few software solutions as the VSA unit, but I did not understand if it would allow me to use my SATA drives on my host. Any clarification would be appreciated. Thank you.

    Hello

    You can also store your VM on NFS (we use only).

    -one of the main requirements prior to 5.1 with VMotion was a shared storage (whether indeed iSCSI, NFS, or SAN) - it is now possible to local storage on a host vmotion to another storage room hosts - http://www.vmware.com/products/datacenter-virtualization/vsphere/vmotion.html

    Instructions

    http://www.yellow-bricks.com/2012/09/05/VMotion-enhancement-vSphere-5-1/

    You can store your VM alternately on a local storage as well with no problems.

  • Create the Script to add a file in an Action name


    I have a picture, and I have a practical action that records, it cultures, he saves, cultures it differently and recorded once more. Currently, I have two options for these stops - I can save each crop in a separate folder and batch rename, or I have the break from the action he saves so I can customize the file name. What I would do is create a script (or, if there is an easier way), add this file name if it will save all simply in the same folder that I have to do it manually.

    Basically, I start with the name of the file: 'TEST '.

    for the first part, it I save as 'TEST '.

    for the second record, I want to save it as "TEST_P1".

    for the third record, I want to save it as "TEST_P2".

    I am brand new to scripting, and is my programming experience with Java and medium in my past, everything feels a little familiar. If someone could help me with this, I would really appreciate it!

    Another option is to use the Image Processor Pro script. You must create several actions to different cultures, you want to make to the original document size not a crop of harvest of a crop until the final harvest.  Don't have any records in these actions. Then just use meny file > Automate > Image Processor Pro.  Implement its dialog box to save the file names you want where you want to save them create.  You can also save that in action. The image pro script processor is a Photoshop plug-in.  In the dialog box, it will record the setting you used in the action stage.    Alternatively, you can save the configuration dialog for later use in the IPP dialog before running the process put in place.

    You can store as many files as you need with IPP and run your actions simple cultures for each size of harvest. IPP opens you simply file a copy to each of your operations and after the action is performed to save the modified copy of doctment under the name of file you set up. You can configure as many tabs as you want you can even have you resized using IPP option re-size crops.   If the script is easy to use his 10 + lines of script Photoshop...

Maybe you are looking for