CanonicalName SCSI and new-harddisk

When I introduce a logic unit number to an ESX host, seen on 2 different SCSI targets, because of the dual controller ports in our SAN. AFAIK, ESX assigns one as main and it sets as the canonicalname. If I try to map unit number logic to a guest, using the cmdlet new-disk hard, I need to know this name canonical. Problem is that I can't work on how to find what is the canonical name for a particular logical unit number.

The only possible solution I came up with this day is to check the existence of the LUN using all two possible canonical names and which then maps to the right pair. Anyone know if it is possible to find the canonical name correct just the Lun?

Thank you

If you are certain that the Monday even does not appear for the various LUNS on different targets in HBA that the preceding script can be adapted.

$esxName = 
$vmName = 
$hbaName =              # Can be any of the HBAs that connect to the LUN
$lunId = 

$esx = Get-VMHost $esxName | Get-View
foreach($hba in $esx.Config.StorageDevice.HostBusAdapter){
     if($hba.Device -eq $hbaName){
          $hbaKey = $hba.Key
          continue
     }
}
foreach($adapter in $esx.Config.StorageDevice.ScsiTopology.Adapter){
     if($adapter.Adapter -eq $hbaKey){
          foreach($tgt in $adapter.Target){
               foreach($lun in $tgt.Lun){
                    if($lun.Lun -eq $lunId){
                         $lunKey = $lun.Key
                         continue
                    }
               }
               continue
          }
          continue
     }
}
foreach($lun in $esx.Config.StorageDevice.ScsiLun){
     if($lun.Uuid -eq $lunKey){
          $path = $lun.DevicePath
          continue
     }
}

# Create raw disk
Get-VM $vmName | New-HardDisk -DiskType RawVirtual -DeviceName $path

FYI LUN different with the same Monday, albeit under different targets, is possible.

Tags: VMware

Similar Questions

  • Add the new SCSI controller and new drive - powershell SDK

    Hi all

    I'm trying to add the new disc of paravirtual to my VMs. There are two types of virtual machines in the environment; a Paravirtual controller attached and others are without controller; so my task is to set the new drive of paravitual using powershell SDK.

    So far I am successful with my code if the controller is already present but the script fails when I try to attach the controller. with the error.

    RecommendDatastores: The method call failed because [System.Object []] contains a method named "RecommendDatastores".

    C:\NodeDeployment\Inprogress\Add_newPVScsiDisk.ps1:111 tank: 44

    + $generatedkey = $SRM. RecommendDatastores < < < < ($storageSpec)

    + CategoryInfo: InvalidOperation: (RecommendDatastores:String)], RuntimeException

    + FullyQualifiedErrorId: MethodNotFound


    I know that this script is not good enough to post here because it is an initial draft, but in the script attached please help me with the present part-

    The Script requires a csv with VMname entry; Disksize to be attached and store cluster data

    else {
                Write-Host "Paravirtualized SCSI Controller Not Found in $vmname.. Trying to add new scsi controller and additional Hard-disk..."
                $NewSCSIDevice = New-Object VMware.Vim.VirtualDeviceConfigSpec
                $NewSCSIDevice.operation = "add"
                $NewSCSIDevice.device = New-Object VMware.Vim.ParaVirtualSCSIController
                $NewSCSIDevice.device.key = -222
                $NewSCSIDevice.device.busNumber = ($allScSiController.BusNumber.Count)
                $NewSCSIDevice.device.sharedBus = "noSharing"
                $NewDiskDevice.device.controllerKey = -222
                $NewDiskDevice.device.unitNumber = 0
                $NewDiskDevice.device.capacityInKB = ($diskSize * (1024 * 1024))
                $storageSpec.configSpec.deviceChange += $NewDiskDevice
                $storageSpec.configSpec.deviceChange += $NewSCSIDevice
                $generatedkey = $SRM.RecommendDatastores($storageSpec)
                $key = $generatedkey.Recommendations[0].Key
                $SRM.ApplyStorageDrsRecommendation_Task($key)
    }
    
    

    OK I have it myself; I guess busnumber was the problem. He converted to INT working like charm...

    Now, I have to work with storage Drs IE. with the ReconfigureVM_task method. hoping that will work also...

    else {}

    [int] $busnumber = $allScSiController.Count

    Write-Host "paravirtualized SCSI Controller not found in $vmname... Try to add the new controller scsi and extra hard drives... »

    $NewSCSIDevice = new-Object VMware.Vim.VirtualDeviceConfigSpec

    $NewSCSIDevice.operation = 'Add '.

    $NewSCSIDevice.device = new-Object VMware.Vim.ParaVirtualSCSIController

    $NewSCSIDevice.device.key = - 222

    $NewSCSIDevice.device.busNumber = $busnumber

    $NewSCSIDevice.device.sharedBus = "noSharing".

    $NewDiskDevice.device.controllerKey = - 222

    $NewDiskDevice.device.unitNumber = 0

    $NewDiskDevice.device.capacityInKB = ($diskSize * (1024 * 1024))

    $storageSpec.configSpec.deviceChange += $NewDiskDevice

    $storageSpec.configSpec.deviceChange += $NewSCSIDevice

    $generatedkey = $SRM. RecommendDatastores ($storageSpec)

    $key = $generatedkey. Recommendations [0]. Key

    $SRM. ApplyStorageDrsRecommendation_Task ($key)

    }

    ---

    Concerning
    Sanshis

  • Recommend bridge SCSI and iSCSI

    Hi guys,.

    Currently I have an ADIC FastStor 2 tape auto-chargeur connected to a physical machine, Backup Exec 12.5, which backs up our running VMS with internal agents. Our ESX host running ESX 4.1, running on servers of 4 HP DL380G5.

    We are looking into converting to a more focused VM disk backup over the next 9 months, but we have a short-term obligation to upgrade our current solution quickly so that we can remove the material (it has long been out of support and our backups start to fail). To this, looking at a quick upgrade to BE2010 R2 (since we have already supported) and put us the media server on a virtual machine. Remains to be seen how to connect to the tape library. A SCSI and iSCSI Bridge seems to be the best option to do it quickly and with headache less.

    Someone at - it experience with these devices? Recommendations for an individual? The current tape drive uses a connection of Ultra2 SCSI wide 68 pins.

    Thank you

    .. .After research forums and seeing the difficulty that people have, I wasn't convinced.

    The positions of 'problem' I see the most are those who use cards non - of Adaptec SCSI and / or not parallel SCSI drives.  The most recent posts I've seen are for tape drives, SATA or SAS drives.  Basically trying to use 'new' band players, rather than reuse the 'old' band of readers.

    Quick is the main concern here. The money is available, it cannot simply be a ridiculous amount since it is monstly going to be throwing next year (otherwise I'd just go straight for an iSCSI tape library).

    Then I recommend the SCSI card because it would be cheaper than a bridge.  Or if you have an existing workstation you can re-tasks to host your tape drive for awhile so that get you the rest of your new backup equipment.  Used & refurb workstations can be made for well under $ 500 and often as low as $200 and would be more powerful enough to accommodate a tape drive.  Because you can reuse the workstation after obtaining new equipment, you could get something more than the bare minimum for this project.  Maybe it's a better use of $$$ instead of a bridge iSCSI that you go to "throw".

  • I can't get mail and news groups to appear only a specific folder

    When I registered Thunderbird tonight I usually see the folder mail and news groups. Unfortunately, only a specific folder opens and I'm unable to click the windows tab and select this option. I restarted. Close Thunderbird and it does not work. Strange thing is that it works fine on my old old PC home computer. It's my Mac laptop which is problematic. Can you please help? I have important files that I need access ASAP.

    Hello

    To better help you with your question, please provide us with a screenshot. If you need help to create a screenshot, please see How to make a screenshot of my problem?

    Once you have done so, attach the file to screen shot saved to your post on the forum by clicking on the button Browse... under the box to post your reply . This will help us to visualize the problem.

    Thank you!

  • iTunes does not support Windows 10 modern watches over tablets and newer laptops

    Hello.

    Since Windows 8, there is a new mode called available standby connected standby (Windows 8), InstantGo (Windows 8.1) or modern (Windows 10) from the previous day.

    Tablets with Windows and newer laptops use modern sleep every time instead of old standby mode when firstly, it turns off the screen and after a while CPU turnes off (S3 mode AFAIK).

    Computer works now similar to a phone in a Pocket, you can listen to music or get a call (Skype).

    Here is the description for developers on Miscrosoft MSDN: https://msdn.microsoft.com/en-us/library/windows/hardware/mt282515.aspx

    Developers need to make their applications compatible with a modern Eve, otherwise application does not work while the unit is in standby modern.

    There is a Microsoft Groove app installed music on my book of Surface with 10 Windows, he can play DRM iTunes media, and continues to play when the screen turns off.

    12.4.1.6 iTunes seems to be incompatible legacy applications because it stops to play my music if I let laptop intact for 5 minutes.

    I tried to explain this to a phone Apple support, but they told me that this isn't a problem with iTunes but Windows and I need to get in touch with Microsoft instead of Apple.

    I can't use my subscription Apple same music in music Groove as a solution because it is unable to read the DRM from iTunes m4p files, of course it can not directly access cloud Apple music too.

    Is it possible to transmit this information to Apple?

    I don't understand why Apple let iTunes must be installed on Windows 8 + because actually it works terrible.

    For example, it can not switch audio speakers headphones and vice versa (while other applications that correctly), there are also some problems of video output, sometimes also the iTunes window receive a second bar tiny minimize / closing maximise controls, also the search field sometimes loose the keyboard input.

    Developers need to make their applications compatible with a modern Eve, otherwise application does not work while the unit is in standby modern...

    I tried to explain this to a phone Apple support, but they told me that this isn't a problem with iTunes but Windows and I need to get in touch with Microsoft instead of Apple...

    Is it possible to transmit this information to Apple?

    Oleg,

    Support staff does not normally deal in development issues, so it is quite likely that simply, they did not understand the question.  To report it directly to Apple, use the comments link:

    http://www.Apple.com/feedback/itunesapp.html

    When you send feedback, try to be as clear and objective as possible.

    iTunes has a huge population of Windows users, so I don't know that apple is interested.

  • My firefox continues to open new tabs and new windows, takes me to infected wedsites which tells me that my norton. What can I do?

    Keep opening tabs and new windows. My norton says I'm to access known infected Web sites. How can I fix this.

    Thank you

    After doing the above.

    Adblock more {web link}
    Blocks annoying video ads on YouTube, Facebook ads, banners
    and much more. Adblock Plus blocks all the annoying ads, and
    supports Web sites by blocking is not discrete (configurable) default ads.

    Adblock Plus pop-up Addon by Jesse Hakanen-
    Pop-up Addon Adblock more {web link}
    Adblock Plus pop-up Addon - extends the functionality of blocking of the
    Adblock Plus for those annoying windows pop up that opens on the mouse
    clicks and other actions of the user.

  • Please confirm your e-mail address. -Do not work for older account reset and new on just created.

    Please confirm your e-mail address. -Do not work for older account reset and new on just created.

    Can not yet confirm my e-mail to a new account. Can't even after half an hour.

    What happened to ask a question without being registered? I can't not complete because the confirmation email does not get sent.

    Arrived late, but is OK now.

  • my phone has port and new battery and still will not hold a charge

    my phone has port and new battery and still will not hold a charge

    What do you mean 'there port and new battery? If someone other than Apple has opened and replaced the things, it is now unbearable.

  • old and new ipads appears in itunes

    Hi all
    Need a little help I backed up my Ipad Air to Icloud and for my PC

    I then unplugged my computer and plugged my new Ipad Pro

    I created the pro with the back to the top of the Air

    but now when I plug the Pro, in Itunes it shows that two connected ipads.
    I even changed the name of the pro directly on the machine.
    Now it shows me the old and new names and think that two ipads are connected

    I'm about to remove Air for ready for sale, but won't do so until I know this weird problem is resolved.

    Thank you very much

    Hmmm OK
    I studied a little further
    With disconnected TWO Ipads, as soon as I run Itunes, the former Ipad Air looks as connected

    If very strange

  • When I open Firefox, tab keeps flipping quickly between 'Connection' and 'new tab '. The browser does not connect to any site.

    This occurred just after the visit to the site of isohunt. I got a message saying "Firefox stops."

    IsoHunt from installing a program, will you allow?" (or words to that effect). I gave permission then the problem started.
    

    I used Firefox on my iMac for a long time without any problem. I'm running OS X 10.7.5

    I hope you can help

    I have this problem on my pc but I was watching youtube then fallout new vegas nexus so I closed it and then start playing a game, and then when I opened firefox again it was flashing between tap connection and new

  • iMovie 10.1.2 new film and new gray trailer

    used iMovie to import the media yesterday.  When work on this tonight.  New movie and new trailer are grayed out.  Quit/relaunch and restarted.  no effect.

    What is going on?

    They are grey in 10.1.2.  To create a new movie, open the projects window and click on the white square at the top left that says: "make movie".

  • Newsstand and new applications are available at the Canada? Icon 'see in the App Store.

    Newsstand and new applications are available at the Canada? I don't see them in the App Store.

    Not currently, but you might find some similar applications here > https://itunes.apple.com/us/genre/ios-magazines-newspapers/id6021?mt=8

  • Offers day and slow downloads WiFi (very slow).  Is there a way that I can download some updates and new programs using my macbook pro (to a public site in the city) and transfer it on my iMac which is too heavy to cart autour?

    Difficulty to access the updates and downloads with very slow wifi ("country").  Is it possible that I can download some updates and new programs using my MaBbook Pro (retina) on a public site in the city and transfer them on my iMac which is too heavy to cart autour?

    New programs, Yes.

    Updates, depends on what you're updating.

  • Travel in Australia and New Zealand

    We will travel in Australia and New Zealand later this year. In the meantime, we need there to be able to call us as we strive to rent wheelchair accessible vans, etc.. I have Skype, my girlfriend and MOM.

    When we are there, we want to be able to call using our cell phones. We all have the application installed.

    Can we have more than one number to our account? If two numbers of Skype. And what is the best way to call each other? I have a gift membership for the unlimited and everyone has the 60 free minutes provided with office 365.

    Jake

    @Jake what country are you living in?

    You can have several numbers in different countries on your Skype account, you can buy numbers Australian & NZ now so that the people of rental can you contact at a local rate or check if the companies there are on Skype free Skype-to-Skype calls.

    Unlock all your cell phones before going so that you can pick up some local SIMs in Aus & NZ. Also check your current suppliers of the cell would charge you for roaming prices in Aus and New Zealand, including data charges, more that likely would be very unattractive.

    Discover the 3 network, which have their feeling home price in Aus and NZ. This would allow you to buy a package of mobile data to your Skype, plus a package of minutes for local numbers as well as the local GSM numbers that you would have with the SIM card. Communicate with them via Skype or your Sim by distribution of local numbers.

    Also use Skype WiFi when available and add little credit to accounts that have only 60 minutes to call where they go over the allocation or want to buy another package in the short term to add to their 60 minutes.

    There is no single solution, but some research on Skype, unlock your phones and get pay-as-you-go local SIMs will save you a lot of money. Take a look at recommendations for communications on travel websites too. The video below is a good starting point.

    https://www.YouTube.com/watch?v=sNCLIPJymuE

  • How to move my music and new video files in iCloud after wrong download first to the iPad? Have no local on iPad now and cannot not even update all apps!

    How to move my music and new video files in iCloud after wrong download first to the iPad? Have no local on iPad now and cannot not even update all apps!

    Thank you

    iCloud is a synchronization system, not a storage system. If you delete photos/videos on your iPad, they are removed to iCloud. To increase the available space, go settings/iCloud/Photos and select optimize iPhone/iPad storage.

Maybe you are looking for

  • Pavilion dv7-2005el: ssd for dv7-2005el

    Hi, I want to update my computer dv7-2005el laptop with AMD Turion x 2 Ultra 64, with an SSD.What brand and model is compatible with my laptop?Thanks and greetings Fabrizio

  • PROCESS OF ANDROID HAS STOPPED WORKING

    MY TABLET HAS COME WITH THE MESSAGE... THE ANDROID PROCESS. PROCESS. AIRA HAS STOPPED UNEXPECTEDLY. PLEASE TRY AGAIN... DOES ANYONE KNOW HOW TO GET WITHOUT IT, BECAUSE IT DON'T ME LETS NOT USE MY TABLET

  • BlackBerry Smartphones Twitter freezes as soon as I open it

    Hello I had a Twitter update this week, followed by an update to App World.  I haven't used Twitter for a few days, so I can't be sure, but I think that his since he stopped working. If I click on the icon, I get my home page, but then it crashes & u

  • 12.1.0.2.0 Oracle expdp with %U.dmp is not resolved

    HelloI have a problem with Oracle 12.1.0.2.0 when using expdp with %U in the name of dumpfile the %U won't solve a certain number and decided instead of the letter U, see below, for example.Schemas EXPDP = SCHEMA_NAME dumpfile=LOADING_DIR:DMP_%U.dmp

  • Error 1002 when about to reinstall Vista to new drive hard-pavilion dv9500

    Hey there, First of all, a bit of background: The computer (HP Pavilion dv9500 17 ") is about 4-5 years.  The warranty expired in 2010. He was sent to HP before (about 2 1/2 years) within the warranty for a faulty NVIDIA card fried its motherboard an