Please help with these variables

Thanks LucD and RvdNieuwendijk for helping me with the first part of my script, now I'm stuck again.  In most cases, the script works fine, the commented sections (1-3) are what I want to do in the script.  Even if I had two beautiful solutions for my first problem, which was to record the name of the virtual machine and a custom attribute named "assignee" to a variable, I went with the response as provided LucD.  Now, here's my problem.

I want to save the new variables and then turn around and create a virtual machine with the same name as the variable $_. Name and then complete the custom attribute "assignee" with the variable recorded for the assignee.  What I've done so far was to save the $_.name in a text file, which will then create a virtual machine with the same name as that deleted line 10

Line 11, I chose to use Stop-VM because the virtual machine will get deleted, so no need to a gradual stop.

For line 9, I did that just to make me see the name on the screen, which will be removed

Given that the new variables will have to name the virtual computer, the 10 online list will help me to keep track of all those and then deploy.

I'll change the script to get data warehouses that have a certain amount of disk space, and I will choose random data warehouses and hosts ESXi Get-random, I'm just trying to get the core of the script works now.

Sorry, I'm getting long-winded, all I want now is to save the new variables of lines 4-6 in a big variable, or arrray or something and then I want to create a virtual machine with the same name VM and the custom attribute filled with what "assignee".  Thanks for any help.

# 1. Get the name of the virtual machine and the assignee of the virtual machines to deploy and save those as a variable
# 2. Remove the existing VM with the same name
# 3. Use saved data to deploy a new virtual machine with the same name and the assignee who has been registered
1. $AllVMs = @)
2 get-file TestDeploy | Get - VM | {foreach}
3. $assignee = Get-Annotation-entity $_ - CustomAttribute "Assignee" - ErrorAction SilentlyContinue
4 new-Variable - force - ErrorAction SilentlyContinue-name $_. Name - value (New-Object PSObject-property @ {}
5 VM = $_.name
6. the assignee = $assignee. Value
7. })
8. $AllVMs += $_. Name
9 write $_. Name
10. $AllVMs | Out-file c:\psresults\NewDeploy.txt
11 if ($_.powerstate - eq "receptor") {stop-VM - VM $_}
12 if ($_.powerstate - eq "Receptor") {Start-Sleep-3 seconds}
13 remove-VM - VM $_ - DeletePermanently
14.}
15. (type c:\psresults\NewDeploy.txt). Foreach {new-VM-model (Get-"TemplateName") - name $_-location (Get-folder 'TestDeploy')'}
16 - data store (data center, Get Data Center |) Get - Datastore 'Datastore') Spec - OSCustomizationSpec - VMHost (Get-VMHost 'MyHost')
17.}

I found the problem, the script was pouring out the complete variable instead of just the value.

The line should be like this

  $AllVMs += (Get-Variable -Name $_.Name | Select -ExpandProperty Value)

I've updated the two script above.

Tags: VMware

Similar Questions

  • Please help with the variable corresponding full framework

    HI :-), could someone please hepl a beginner?

    I'm writing a small script AS3 in CS4 that allows me to take a step back and forward through an animation.

    I have a stop button a play button rewind button and a button to the front.

    the buttons work ok apart from when I hit the button to rewind sometimes it jumps to the beginning of the timeline rather than just take a step back a frame at a time.

    When I use the button stops the timeline where he is, the rewind button steps back as needed. But if you click on the button rewind everything first, he jumps at the beginning of the timeline, I know the theory as to why I can't get this to work.  I need to know how to increment a variable of integer type (meter) to increment as the playes of animation. that is the counter variable to match the chassis number.  Here is the code I have, someone could please tell me how to match a variable of integer type to the current image and tell me where to insert the line of code on the list. I added a fictitious line or pseudo-device code to show what I'm trying to do, but the syntax is wrong.

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

    var counter = 1;

    gotoAndStop (counter);

    function setupevents()
    {
    buttonplay.addEventListener (MouseEvent.CLICK, playbutton);
    buttonstop.addEventListener (MouseEvent.CLICK, stopbutton);
    buttonrewind.addEventListener (MouseEvent.CLICK, Retouret);
    buttonforward.addEventListener (MouseEvent.CLICK, forwardbutton);
    }

    SetupEvents();


    It's the dummy line or pseudo-device code that I mentioned in the question above...
    counter = frame;

    function to play the movie
    function playbutton(event:MouseEvent)
    {
    Play();
    }

    function to stop the movie using the stop button
    function stopbutton(event:MouseEvent)
    {
    Stop();
    }


    function to take a step back through film using the rewind button
    function rewindbutton(event:MouseEvent)
    {
    If (Counter > 1)
    {
    Counter = counter - 1
    }

    gotoAndStop (counter);
    }


    function forward through film using the following button. I used a value of 60 because it comes to the amount of images in the scenario

    I don't know if this is a way of doing things or not
    function forwardbutton(event:MouseEvent)
    {
    If (Counter < 60)
    {
    Counter = counter + 1
    }
    gotoAndStop (counter);
    }

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

    I know that the code is rough and base but any help would be greatly appreciated, I tried to attach the .fla for anyone who needs more information about this.  But this Web page returned an error ""the content of this attachment type is not allowed.".

    Auldy66

    var counter = 1;

    gotoAndStop (counter);

    function setupevents()
    {
    buttonplay.addEventListener (MouseEvent.CLICK, playbutton);
    buttonstop.addEventListener (MouseEvent.CLICK, stopbutton);
    buttonrewind.addEventListener (MouseEvent.CLICK, Retouret);
    buttonforward.addEventListener (MouseEvent.CLICK, forwardbutton);
    }

    SetupEvents();

    It's the dummy line or pseudo-device code that I mentioned in the question above...
    counter = frame;

    function to play the movie
    function playbutton(event:MouseEvent)
    {
    Play();
    }

    function to stop the movie using the stop button
    function stopbutton(event:MouseEvent)
    {
    Stop();
    }

    function to take a step back through film using the rewind button
    function rewindbutton(event:MouseEvent)
    {
    prevFrame();
    }

    function forwardbutton(event:MouseEvent)
    {
    nextFrame();
    }

  • Please help with download. ?

    Please help with the download?

    Available downloadable Setup files:

    Download and installation help links Adobe

    Help download and installation to Prodesigntools links can be found on the most linked pages.  They are essential; especially steps 1, 2 and 3.  If you click on a link that does not have these listed steps, open a second window by using the link to Lightroom 3 to see these "important Instructions".

  • Get error 207 trying to download creative Cloud and someone please help with this problem, thanks in advance please.

    Get error 207 trying to download creative Cloud and someone please help with this problem, thanks in advance please.

    Please refer to

    Error 207 to "install Adobe".

  • I need to reactivate Photoshop CS4 because I have a new hard drive in a reminder for my 2.5 yr old iMac last operating system running. When you open the program, I was told to contact Adobe support and give them an error code: 150:30. Please help with per

    I need to reactivate Photoshop CS4 because I have a new hard drive in a reminder for my 2.5 yr old iMac last operating system running. When you open the program, I was told to contact Adobe support and give them an error code: 150:30. Please help with permission. ?

    You can repair it yourself. I have a screenshot guide. You use app the Mac Terminal and a python (.py) script that comes with the recovery of the license for the Mac package.

    Don't forget to leave a space after typing sudo python and note that your password will not display any points. Simply enter it blind.

    Start 11 Message and take your time. It does not work. Layout error 150:30 opening Photoshop cs4 on Macbook Pro

    Gene

  • Please help with reset the time lock

    We have problems with our computer to lock if we are online, etc.  We need to connect back with our password to see what we were reading.  If the mouse is still for a few minutes, the computer will automatically lock the computer mode.  Can someone tell me how to set this time around so that it does not lock the computer after a minute.

    Thank you!!

    Hi jomabe,

    Thanks for posting of answers.microsoft.com with respect to this application.

    According to the information provided, it can be either parameter must be changed or the option of power setting could be revised in order to help you with this problem.

    For a change of setting screen saver, click on empty place on the desktop and select PERSONALIZE / screen saver - check if the waiting period is set for a time relevant to your operation or if it needs to be revised.  In addition, if the Logon Screen summary view is checked, it will ask login during the resumption of the activation of the screen saver.

    Another area that may be the result of what is living could be in the power Plan options.  To check if the power management options contribute to the problem, follow these steps to customize a diet plan to check whether components that can be going to sleep can be adjusted to your needs.

    How to customize a diet plan

    To customize a diet plan, follow these steps:

    1. Click Start
      type Power Options in the start search box, and then click Power Options in the list programs.
    2. Click on change settings for the plan under the plan.
    3. The parameters of change for the plan page, select the display settings and parameters of sleep that you want your computer to use, or click on change advanced power to change additional settings.
    4. Click OK, or click on save changes to save the changes.

      Ensure that the plan of the power that you want the computer to use is selected in the Power Options page.

    Pasted from http://support.microsoft.com/kb/935799>

    Make sure to consider change Advanced Power settings selected in the context of your current power plan to check if a network card, hard drive or other component can go to 'sleep '.

    Please let us know on this issue if it helps with the determination or help.

    Kind regards

    Debbie
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Please help with the problems of Vista SP2

    So I spent all day on the forums here and I'm head over heels.  I had problems with Windows update and some other problems on my Dell Studio XPS.  It is a tower with double HDs in RAID mirror running Vista 64-bit with SP2.

    I got it for 3 years and I thought that I clean and correct certain defects to go back to the original Dell factory condition.  That did not fix the update install problem I did cleaning.  Now it's worse.

    I'm trying to install SP2 and get a catastrophic failure 0x8000ffff error-UNEXPECTED

    The onlychange is that several months ago, one of my WD 640 GB drives factory failed and I replaced it with a Seagate Barracuda 1 TB since I couldn't find a 640 GB drive.

    I tried to stop and restart all services BITS, etc. no luck.

    I tried to run among the MS FixIt for the problem of update, but it fails because it says that it cannot initialize the powershell.

    Help, please... I'm hopelessly lost and can not spend more money on this thing.

    Thank you!

    If you need additional help with the clean install, please start your own, new topic in this forum: http://answers.microsoft.com/en-us/windows/forum/windows_vista-system

    If these procedures look too complex - and there is no shame in admitting this isn't your cup of tea - take the machine to a local, good reputation and independent (i.e., not a BigBoxStore or a Geek Squad) computer repair shop & ask them to do the job.

  • Please help with conditional actions showing the PlayBar

    I tried to set up a tip action that will not allow users to move forward until they have clicked on the 3 themes I want to see again them.  I assigned variables, follow the tutorials and do everything now.  Please help how I my Advanced actions set upwards... everything shows and hides all work so I have to assume that the assignment of variable works as well.  I used numbers initially and changed my value of the variable of "dude" just to make sure I was not missing something.

    Capture.PNGCapture2.PNGcapture3.PNG

    Here's the aciton condtional which is performed after the entry of the slide

    Capture4.PNG

    All logic seems in tact for me however I click on each of my boxes and all conditions must be true, but will not display game bar...

    Note: I also tried to show a next button and just show the things randomly with the same logic and it just will not work... What am I doing wrong?

    Something escapes me in your question: How do trigger you the conditional action? I suspect that he is never executed, but may be wrong of course.

    I created a small example to check: slide contains 3 buttons that trigger an action condtional with two decisions. The first decision is a simulated standard measure (condition 1 = 1 is always correct) assigns the value 1 to the variable corresponding user and displays a caption text, that was initially hidden. This is a screenshot of this first decision Stand for the first Bt_One action to be triggered by the first button:

    The second decision Check is the action of condtional real, very similar to yours. This will be done after the first decision:

    Create a duplicate of this action for the other two buttons, you only have to edit the first decision where the user variable needs to be changed.

    In my example, when you click the last button (regardless of the sequence) all the text captions should have been disclosed (I na not hide others, but you can do the same of course) and the second decision check will result in a positive response, so the playback bar appears immediately.

    Lilybiri

  • Please help with a basic javascript syntax

    Can anyone help me please with an installation of 'remove from Favorites', I'm working.

    I have query to get all the favourites, and then I pulled out the Favorites to the bottom of the page

    Each favorite has a link 'remove from Favorites' - I want to make sure that when a user clicks on this link, they get a javascript confirm box pop up saying "are you sure you want to delete #favourites name # of your Favorites?

    So I have...

    function remove(profile,name) {}
    If (confirm ("are you sure you want to delete #name # your Favorites?")) {
    Window.Location = "remove_from_favourites.cfm? deleteFavID = #profile # & removedName = #name #
    }
    }

    and

    < div onClick = "remove(#rs_favs.favouriteeID#,#rs_favs.firstName#)" > remove from Favorites < / div > "

    but it does not work - I think that there are 2 problems...

    problem 1 - I used CF # in the suppression works as I don't know what we're doing in javascript for "output" a variable (see where it says "Are you sure you want to remove #name # favorite") what should I use instead of ' # '?

    problem 2 - I tried to pass to the function variables > > onClick = "remove(#rs_favs.favouriteeID#,#rs_favs.firstName#)" and I separated the but a commercial "," but I suspect that it is an incorrect syntax "


    If someone could please help me I would be very grateful to be honest, I like coldfusion - but javascript hurt just my head! :(

    Thank you very much.

    PS how I wrapped my text 'remove from Favorites' in a div rather that to make a link real 'a href' - is that correct or is there a better way (ideally I want the text to look like all my other links (ie they emphasize on mouse over))

    It's because you pass a value of string without single quotes in your onclick() function.

    To take

    Remove Favorites

  • Need help with choice variables remain in the new session

    I have a set of approx. Flash to the top with several variables. Y at - it a simple action script that will allow the user to maintain their choice after the closure of the .swf and revive it?
    Thanks in advance for your help.

    How do check you if these components have been checked or ticked. in fact, I probably don't want to know that.

    you really recommended to use a listener to detect when your components have changed and then you can use the modified method to define your variables and update your sharedobject.

  • HP Pavilion P7-1110: Please help with editing after scanning

    I know how to analyze an element, but after that I scan I do not know how to edit. I have Micro Soft Word 10 and my scanner is a HP Officejet 4630. If you can please help and thank you.

    Hi Tadpolegreen,

    Thank you for answering my questions!

    I would recommend going by there how to scan guide Scan in Windows 7 with full functionality software HP for HP Multifunction printers. Select how to scan with the HP software and how to scan in the form of editable text (OCR), follow the instructions.

    I hope this helps!

  • Please help with my reader prs 505

    Hi thr,.

    Please help me on my prs 505 reader, the display got very light canoe even read the words correctly, what's wrong with it, please help

    Thank you

    Jeevani

    Hi Jeevani,

    Welcome to the community of Sony!

    Sony Electronics apologizes for any question, you have met with your product. A small number of E Ink devices, with specific display panels, can become sensitive to the discoloration of the display when a page is turned while watching in strong direct sunlight. Clear the display is only temporary and can be corrected by adjusting the angle of the camera to avoid direct light from the Sun and then a page turns.

    Also, try the steps on the below technical support article:

    http://www.KB.Sony.com/selfservice/documentLink.do?externalId=C1008817

    Thank you for your message.

  • Please help with if, then formula

    I'm having troble with so and so, please help. So here's my question, if E is less than or equal to 30, then multiply K by 12% and specify the amount of 12% at Mr. Merci for your help and please show me the formula.

    Do you mean something like this?

    The formula in the column N:

    = IF(E≤30,K*12%,"")

    You do not specify what you want if the value of E is > 30, so the formula here is nothing.  If you want something, then replace ' ' to the desired value.

    SG

  • Very slow Macbook Pro (2012), please help with report EtreCheck

    Hi all

    My Macbook runs very slowly, I tried a number of things suggested online but none worked. I recently went to a repair shop and they suggested it could be to do with the dataflex (not sure if this was exactly, but I remember it sounding similar.) They described as a hard drive to another internal component connection, sorry for the inaccuracy.) I have me am replaced, but this did not help either.

    I downloaded the software EtreCheck and I was wondering if someone could help me to make light of the report on possible solutions? I have the feeling that it could be the hard drive needs to be replaced, but have no evidence of that. Verification has been run for the problem of "Beachballing" and got the sub report, please let me know if more info would be helpful. I hope it's telling in a way!

    Thank you for the pointers.

    EtreCheck version: 2.7.8 (238)

    Report generated 2016-01-26 22:56:56

    Download EtreCheck from http://etrecheck.com

    Duration 10:23

    Performance: Poor

    Click the [Support] links to help with non-Apple products.

    Click [details] for more information on this line.

    Problem: Beachballing

    Hardware Information:

    MacBook Pro (13-inch, mid-2012)

    [Data sheet] - [User Guide] - [Warranty & Service]

    MacBook Pro - model: MacBookPro9, 2

    1 2.5 GHz Intel Core i5 CPU: 2 strands

    4 GB of RAM expandable - [Instructions]

    BANK 0/DIMM0

    OK 2 GB DDR3 1600 MHz

    BANK 1/DIMM0

    OK 2 GB DDR3 1600 MHz

    Bluetooth: Good - transfer/Airdrop2 taken in charge

    Wireless: en1: 802.11 a/b/g/n

    Battery: Health = Normal - Cycle count = 420 - SN = 9G22603YVD3MB

    Video information:

    Graphics Intel HD 4000

    Color LCD 1280 x 800

    Software:

    OS X Mavericks 10.9.5 (13F34) - since startup time: less than an hour

    Disc information:

    Disk0 APPLE drive HARD TOSHIBA MK5065GSXF: (500,11 GB) (rotation)

    EFI (disk0s1) : 210 MB

    Macintosh HD (disk0s2) /: 499,25 go-go (248,48 free)

    HD (disk0s3) [recovery] recovery: 650 MB

    OPTIARC DVD RW AD - 5970H)

    USB information:

    Apple Inc. FaceTime HD camera (built-in)

    Apple Inc. Apple keyboard / Trackpad

    Computer, Inc. Apple IR receiver.

    Apple Inc. BRCM20702 hub.

    Apple Inc. Bluetooth USB host controller.

    Lightning information:

    Apple Inc. Thunderbolt_bus.

    Guardian:

    Mac App Store and identified developers

    Launch system officers:

    [failure] com.apple.maspushagent.plist [details]

    Launch system demons:

    com.Apple.Security.syspolicy.plist [failure]

    Launch officers:

    [loading] com.google.keystone.agent.plist [Support]

    [loading] com.oracle.java.Java - Updater.plist [Support]

    Launch demons:

    [loading] com.adobe.fpsaud.plist [Support]

    [loading] com.google.keystone.daemon.plist [Support]

    [loading] com.oracle.java.Helper - Tool.plist [Support]

    Items in user login:

    iTunesHelper Application (/ Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)

    Other applications:

    [ongoing] com.etresoft.EtreCheck.85920

    Plug-ins Internet:

    FlashPlayer - 10.6: Version: 19.0.0.226 - SDK 10.6 [Support]

    QuickTime Plugin: Version: 7.7.3

    Flash Player: Version: 19.0.0.226 - SDK 10.6 obsolete! Update

    Default browser: Version: 537 - SDK 10.9

    o1dbrowserplugin: Version: 5.41.0.0 - SDK 10.8 [Support]

    googletalkbrowserplugin: Version: 5.41.0.0 - SDK 10.8 [Support]

    JavaAppletPlugin: Version: 25 check the version of Java 8 update

    3rd party preference panes:

    Flash Player [Support]

    Java [Support]

    TeXDistPrefPane [Support]

    Time Machine:

    Time Machine not configured!

    Top of page process CPU:

    6% update_dyld_shared_cache

    4% WindowServer

    3% kernel_task

    mdworker (3) 2%

    1% launchd (4)

    Top of page process of memory:

    508 MB com.apple.WebKit.WebContent (4)

    502 MB kernel_task

    Safari of 283 MB

    Finder 197 MB

    152 MB softwareupdated

    Virtual memory information:

    988 MB of free RAM

    3.03 GB used RAM (750 MB cache)

    Used Swap 0 B

    Diagnostic information:

    26 January 2016, 21:59:30 self-test - spent

    Hello mrdivorce,

    It looks like of course as evidence of a hard drive failing for me. Hard drives 2.5 "in the MacBook Pro tend to fail after 2-3 years. Judging by the date on your MacBook, I think that your time is up. Maybe try to find a different repair store. Looking for Service Center authorized Apple (https://locate.apple.com/).

    I suggest upgrading to an SSD and increasing your RAM too. Then you have the hardware to run the last OS X 10.11.

  • Please help with this nightmare Yontoo

    Adding or deleting, I deleted Yontoo I have no idea how it it has been downloaded period, I'm at the wheel of a 'XL' that has served me well. My problem is I deleted this Yontoo and forggetaboutit. This program has created 6 file enties 1) %Temp%\Yontoo FFClient.xpi 2)%Temp%\Yontoo IEClient.dll

    3)%temp%\Yontoo Layers.crx 4)%Temp%\Yontoo Layers.pem 5)%Temp%\Yontoo Setup - Silent.exe 6) % Program Files%\Yontoo sleeping Runtime\Yontoo IEClient.dll... Then he then made 8 registry entries. If I can get these files removed from my machine, then I will devote my time to fix the registry. I say this because my nightmare does not stop there. Believe me when I tell you that this program "YONTOO" goes further because it created another register 16 subkeys. It's like something totally unknown to 'The Wild Wild West of the 21st Centuryt' someone would say enough is enough, but there is still a little to make this complete puzzle. This program goes further and creates and installs what they call 'Rage Page' it is a browser extension that changes the structure of the skin of the 'Facebook' and displays ads that seem to you guessed it "Facebook"... My main wish is that I will be able to get help with the "folders". I'm not a person notified with computers, but then I think that my say you I'm always pushing an "XP" in this era of high-tech a bit gave me there Yes... Anyway any help, you can afford to me will be greatly appreciated.  Thank you in advance.
    Respectfully * address email is removed from the privacy *.

    Hello

    Try the free version of revo uninstaller to completely remove all files and registry entries associated with YOONTOO.

     

    Revo Uninstaller. (free version)

    http://www.revouninstaller.com/revo_uninstaller_free_download.html

    When you are finished, download and run a full scan of Malwarebytes anti-malware from the link provided below.

    AV. Malwarebytes

    http://www.Malwarebytes.org/

    Also run a full scan of SuperAntispyware.

    SAS

    http://www.SUPERAntiSpyware.com/

    Remove any found object.

    Further reading

    http://www.ehow.com/how_8561545_delete-Facebook-pagerage.html

    Good luck and let us know if this helped.

Maybe you are looking for

  • ThinkStation P900 - small plastic clips

    Hello. We recently ordered a ThinkStation P900 for a customer. The Thinkstation was a small box with 4 plastic clips closed. Anyone know what these are for? Thanks in advance! ~ Tomska

  • Satellite L350-24U - freezing by copying

    Hello guys,. Used yesterday, I bought this laptop, it seemed to have no problem, but now, the laptop freezes when I put a usb device like a USB stick in a copying some large files like isos or something. Sometimes it freezes whitout I do anything. I

  • How can I make my guest account administrator?

    Vista

  • . FILES__ PNG IMAGE

    I have download 3 party.png image files to use in Adobe Photoshop Elements.  Previously, I was able to open the folder that they were in and all the images (20-30) open in the photos so that I could choose what I wanted to use and open them in Photos

  • LR CC 2015.6 shortcuts

    Before the last update (LR CC 2015.6) the shortcut Shift + T worked for correction in Radial brush and the graduated filter.Now it doesn't, this shortcut works for Transformation now. Is it a new shortcut for the correction within a filters local adj