How can I automate the creation of a partition from scratch for a large number of hosts?

I would like to help with the following steps to cerate a partition scratch on all hosts that have no script, then reprot back to me which guests were to have created.

all my ESXi hosts have a LUN to start with the space, all the boot LUN are named with the same naming that is conveiton "hostname-localstorage.

I would like to come up with a script that will check each host in a cluster for a partition of scaratch, if it does not create the folder ".locker -hostname" on local storrage and then set the partition scratching to the new location. Then the new report to me, which is already a partition from scratch and those to whom he owed create a parition scratch to so I can plan then a good time to put the hosts with newly created partitions scratch mainenance mode and restart their.

I glued the manual way to do it below. I'd appreciate any help anyone can give and it will be well appreciated. I try to avoid to do 1000 hours below. Thanks in advance...

Note: Before you begin, make sure that/tmp/scratch exists. If it does not exist, create it by using the command #mkdir/tmp/scratch.
  1. Open a command prompt where the PowerCLI is installed.
  2. Connecting to host ESXi using the command:

    connect-viserver ESXHostnameOrIP

  3. A list of the data stores accessible by using the ESXi Host command:

    Get-Datastore

  4. Mount a read/write as a PSDrive data store using the command:

    New-PSDrive -Name "mounteddatastore" -Root \ -PSProvider VimDatastore -Datastore (Get-Datastore "DatastoreName")

  5. Access the PSDrive new using the command:

    Set-Location mounteddatastore:

  6. Create a directory named only for the ESXi host using the command:

    New-Item "DirectoryName" -ItemType directory

    For example:

    New-Item ".locker-ESXHostname" -ItemType directory

  7. Check the current value of the ScratchConfig.ConfiguredScratchLocation configuration with the command option:

    Get-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation"

  8. Change the ScratchConfig.ConfiguredScratchLocation configuration option, specifying the full path to the directory created in step 6, using the command:

    Set-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation" -Value "/vmfs/volumes/DatastoreName/DirectoryName"

    For example:

    Set-VMHostAdvancedConfiguration  -Name "ScratchConfig.ConfiguredScratchLocation" -Value  "/vmfs/volumes/Datastore1/.locker-ESXHostname"

  9. The ESXi host in maintenance mode and restart so that the configuration change to take effect.

Mike P

I have something similar to use the script below.

I think you'll find that your out in there.

$configName = 'ScratchConfig.ConfiguredScratchLocation'

$mode,$warn = Get-PowerCLIConfiguration | %{$_.DefaultVIServerMode,$_.DisplayDeprecationWarnings}Set-PowerCLIConfiguration -DefaultVIServerMode "Multiple" -DisplayDeprecationWarnings:$false

Get-VMHost | where {$_.ExtensionData.Config.Product.ProductLineId -eq "embeddedEsx"} | %{    Connect-VIServer -Server $_.Name -User root -Password MyPswd    $scratch = (Get-VMHostAdvancedConfiguration -VMHost $_)[$configName]    $tgtName = ".locker-" + $_.Name.Split('.')[0]    if($scratch -notmatch ($tgtName + "$")){        $ds = Get-Datastore -VMHost $_ | where {$_.Name -match "localstorage"}        if($ds){            Set-Location -Path $ds.DatastoreBrowserPath            New-Item $tgtName -ItemType directory            Set-VMHostAdvancedConfiguration -Name $configName -Value ('/vmfs/volumes/' + $ds.Name + '/' + $tgtName) -Confirm:$false            Set-VMHost -VMHost $_ -State 'Maintenance' -Confirm:$false            Restart-VMHost -VMHost $_ -Confirm:$false            Set-VMHost -VMHost $_ -State 'Connected' -Confirm:$false        }    }    Disconnect-VIServer -Server $_.Name}

Set-PowerCLIConfiguration -DefaultVIServerMode $mode -DisplayDeprecationWarnings:$warn

It uses the DatastoreBrowserPath that Vitali has suggested.

Tags: VMware

Similar Questions

  • How can I download the Facebook app without having to pay for it?

    How can I download the Facebook app without having to pay for it?

    Please explain? The place where you try the download?

  • How can I sync the playlist of Safari on my iPhone for Safari on my windows machine?

    First of all, I must say that I was really happy to see Safari for windows! Thank you!!! Chrome and IE were all two overclocking my machine and the cooling fan will not turn off. I did the same 'stress test' with Safari and the memory usage is less than 25% of the other two.

    On the question: How can I sync the playlist of Safari on my iPhone for Safari on my windows machine? I downloaded the iCloud (iCloud desktop application) Control Panel and updated all my information.

    When I go in the Favorites section of the Control Panel, there is no option for Safari. The only options that are present are: Internet Explorer, Firefox (not installed), and Chrome. I did a lot of research, but can't seem to find a solution...

    Thank you!

    What version of Safari installed on Windows? What version of Windows are you using?

  • How can I change the time on my computer from 24 hour to 12 hour clock clock?

    How can I change the time on my computer from 24 hour to 12 hour clock clock?

    How can I change the time on my computer from 24 hour to 12 hour clock clock?

    Here is the method for Windows 7. If you are using Vista, there may be a slight difference, but basic procedures should be similar...

    Start > Control Panel > region and language > Format > more settings > time tab >

    under time format, set hh: mm hh: mm

    H = 24 hours

    h = 12 hours

    Click OK when finished.

  • How can I mirror the screen of my duo of 11 for sony bravia kdl 55nx810 sony

    How can I mirror the screen of my duo of 11 for sony bravia kdl 55nx810 sony

    I think you'll have a WiDi for TV adapter. The duo 11A WiDi built in.

  • How can I remove the information dialog box/box from popping up whenever my mouse stops on an object?

    How can I remove the information dialog box/box from popping up whenever my mouse stops on an object?

    Here is the procedure to remove the Vista tips: http://www.windowsreference.com/general/how-to-enabledisable-tooltips-in-windows/.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I have a U135 DX netbook with a built-in webcam. How can I find the cam and I press these keys for easy access

    I have a U135 DX netbook with a built-in webcam. How can I find the cam and I press those keys for easier access please PS I'm not a manual.

    You can get a manual here.

    http://www.msi.com/product/NB/U135DX.HTML#/?DIV=manual

  • How can I get the adobe Creative Cloud ENT 1.0 for Windows 10 Installer?

    How can I get the adobe Creative Cloud ENT 1.0 for Windows 10 installation program?, is - if compatible win 10 Pro?

    I don't understand if you're talking about the creative cloud Packer, which is used to create deployment packages or the creative Cloud Desktop Application that is used to install and update applications on office services and access.

    Creating cloud packer is available from the deployment Enterprise Dashboard, site Licensing tab or the creative teams of cloud portal.

    The creative Cloud Desktop Application can be downloaded to desktop applications Adobe Creative Cloud | Adobe Creative Cloud

    Both are compatible with Windows 10.

  • How can I move the hair of a person from one photo to another and place it on another person?

    How can I move the hair of a person from one photo to another and place it on another person? I went through each instructional video you have and have not been able to master this. I tried the smart brush without result, and frankly, I don't think that your product is very intuitive. I work with the software as a professional and I would like to speak directly to someone who could guide me through this process, as I do for one of my clients of having problems with the software that I represent. Thanks, my email is [email removed by host address]

    First of all , we do not communicate with posters by private email.

    The purpose of the forum is for everyone to benefit from the questions and answers, not only the original poster.

    Secondly, you do not discuss Adobe here in the user forums.  You ask the help of users of volunteers like you who give their time for free. Nobody has any obligation to answer your questions.

    Thirdly, Adobe does not support tutoring hand-holding, step by step that you are looking for.  They have excellent video tutorials on Adobe TV.

    Photoshop is a professional application, making no apologies for his very long and steep learning curve

    Read this FAQ to get advice on how to ask your questions correctly to get faster and better answers:

    http://forums.Adobe.com/thread/419981?TSTART=0

    Finally, the titles of topic or subject should be clear, relevant and concise so that individual users can tell at a glance if they can help or not.

    This field is not for trying to adjust your entire question in there.

    Keep this in mind next time you post.  Thank you.

    Thank you!

    EDIT/ADDENDUM: on the other hand, if your ID Adobe is indicative of your true identity, like the beautiful Jay López, in real life, I and others here will be happy to oblige with one-on-one tutoring.

  • I designed my social media buttons. How can I add the link to each of them. For example: How can I add my Facebook link to my button on my muse site face book?

    I designed my social media buttons. How can I add the link to each of them. For example: How can I add my Facebook link to my facebook on my site of muse button?

    Hello

    Please select the button that you created and go to the hyperlink tab, and add the URL of the facebook page here.

    Please take a look at the screenshot below.

    Concerning

    Vivek

  • How can I change the looks of Access Infrastructure Web location for the virtual machine files?

    How can I change the looks of Access Infrastructure Web location for the virtual machine files?

    My default is set to MACHINES C:\VIRTUAL.  But I want to change it to turn to an external drive connected with an eSata cable. Can I do this?

    Hello

    Add just like a new data store.

    Login to your web access, select your host (not the virtual machines) in the left menu.

    You should see a link on the right side with "Add data store", give it a name of store and add the directory.

    Now, you can add a virtual machine to this place.

    Good luck!

    --

    Wil

    _____________________________________________________

    Visit VMware developers at http://www.vi-toolkit.com wiki

  • How can I fix the old sick apple mouse from 6 months on wire scrolls alone now

    How can I fix the Apple mouse sick, aged 6 months on a thread that has been scrolling OK but now scrolls just of internet pages to the top of the page using El Captain so far?

    Probably need a clean place, tried.

  • How can I use the copy of Windows XP from the desktop on the laptop?

    loading xp with a different product code

    I have a laptop that works under XP. I lost track of the original disc. I also have an office which was under XP but Win 7 is working now. I have the XP installation disc. How can I use the drive of the desktop on the laptop?

    I dought you would get away with it. Try kb892130

    Or the pc on a xp boot cd, reinstall xp with xp cd.

  • How can I increase the size of my partition on the C drive?

    I am constantly running out of space on drive C, I have tons of space on my D drive partition. How can I move the partition to increase space on my C drive?

    Hello

    By "tons" of space on your partition D:, what size does this mean?

    D: partition, if 5-15GBs is normally the recovery partition, except on a few machines, and should not be bothered with.

    Acer for example on the previous models used D: as a data partition, which is OK to change.

    To extend C: into the space where D: is currently > back up data on D: > and then delete D: > D: becomes now allocated space > extend C: into the space where was D:.

    Here is a tutorial on how to do it:

    http://www.Vistax64.com/tutorials/95418-disk-management-delete-extend.html

    See you soon.

  • How can I automate the process of replacing these. PNG in my art?

    I have a very large project, that I'm in the middle and it becomes very painful to have to do these one by one.

    SAMPLE.jpg

    I've already sorted 'go - to'.psd I copied and pasted into all subdirectories of name-based. Now, it's just a matter to recreate with the insignia of various clans and tartan as well as their name. First of all, I was wondering if there is a way to bulk to replace the badge 'clan '. PNG is even if they are all named differently by their clan.

    If this is possible then it is perhaps possible to replace the tartan aswell?

    What is the name, I have files delimited by tabs that crank out every spelling of the name clans individual once the main file has undergone all the work described above. I.O. If the clan has a common spelling of 'Auchinleck' but also goes by, file in step finals Affleck, Auchinlech, Aachnaleck, Auchinlick, then these will all be taken care of with the tab -delimited.


    No control of Photoshop help would be most appreciated!

    So you're a candidate to learn scripting.

    Windows and Mac have an internal scripting language and Apple, PowerShell script respectively.

    Photoshop can also use the script. Visual basic script on Windows and on Mac Apple script. Windows and Mac can also use JavaScript for Photoshop.

    In the Photoshop script forum are links to learn more about writing scripts.

    Photoshop scripts

Maybe you are looking for

  • opens any after automatic update! dead in the water!

    yesterday, I learned that an automatic update has occurred. for 6.blah.2 or something. I do not know. I was immersed in the constitution, and Thomas Jefferson was waxing her ass. In any case last night I stop, everything is right with the world. This

  • International warranty Qosmio G15?

    One of my friends told me that all the laptops computers toshiba come with international warrenties, but you must register them through the internet... A store here in Saudi Arabia sells the G15 for one low price (I think it brings them the United St

  • Pavilion 23 "while a single J4V83A: 23-p114 dual band wireless card

    Anyone know if or what dual band wireless card will work in thia computer 23-p114 Tkanks

  • 23 - g013w: passes simple

    I have simple pass on my computer and I like the concept, BUT when I read a page or just to think about what I read in as a minute my screen turns off and simple pass appears and I have to continue to put in my pass, I need to know is, if there is a

  • If I delete my library iTunes download again to free unused applications?

    I have tons of unused applications that take place in my iTunes library. I would delete it to reclaim space, but I don't want to have to pay again if at some point in the future, I want to use one of these applications. If I remove them, I'll be able