Build array within scriptblock and use outside the block

Hi,
I am using scriptblock to run several commands in parallel. The code working fine. BUT I am trying to build an array of object within the scriptblock. My aim is to have all execution results in one array and after exiting the script block to print the results
from all run. I notice that what i build within script block getting destroyed and in the end the $result variable is null. Is there any way that I can build and accumulate the results in a variable and use that outside scriptblock?
code:
$result= @()
ForEach ($Command in $Commands)
    While (@(Get-Job -state running).count -ge $MaxThreads){      
    Start-Sleep -Milliseconds $SleepTimer
    Start-Job -scriptblock {
$n = $Command
$result += New-Object Psobject -property @{DATE = (Get-Date -format "MMddyy"); RESULT = $n}
    } -ArgumentList $Command -Name "$($Command)job" | Out-Null
While (@(Get-Job -State Running).count -gt 0)
    Start-Sleep -Milliseconds $SleepTimer
ForEach($Job in Get-Job)
    Receive-Job -Job $Job
    Remove-job -Force $Job
$result

Yep, but my real problem is that every now and again I just can't help myself and end up feeding the troll.
I've had plenty of fun recently watching it twist in the wind and blather on about absolutely nothing of any substance. I'm assuming we'll get another missive across these threads later (dance puppet, DANCE)...
The real shame though is when it ends up attacking the poor random OPs for asking a question. We're used to dealing with it so I can laugh at the situation, but it does bother me that the people who are just out looking for help end up getting lambasted
by some complete jerk.
I'm going to keep on ignoring it, hopefully if we all just stop playing along it'll get tired and go be useless somewhere else.
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)
Offensive as he (?) can often be, it is difficult to take his attacks personally, because he obviously has no clue what (or who) he is talking about.
What bothers me more about this phenomenon is:
the disrespect shown to people just looking for help;
the impact on the effectiveness of the forum with all the time and space wasted for no purpose;
the troll himself, who seems to either be suffering some kind of emotional or personality disorder, or is playing some kind of game without concern for its effect.
He doesn't get much positive feedback here, so perhaps he just feels that being able to write the way he does in a public forum, and get some response, is enough to prove his worth to his ego. Unfortunately, we will probably never find out more about him
than is evident from his posts.
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.
Seems to be a "tagger" mentality.  Marking territory with acts of vandalism.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • Can IPhone be activated and used outside the US on other networks?

    Dear all,
    I was wondering if the iPhone can be launched and activated to operate outside the United States, any other country using their networks or its just exclusively by AT&T..?

    You have to activate the iPhone on the AT&T network. However, you can ask AT&T to enable international roaming and use it in other countries. If you do not have international roaming enabled, you can still do email and internet browsing when you are connected to wifi in other countries, but no phone service or sms.
    Other users report spotty international roaming performance for phone calls and sms. Also, international roaming for phone and data (other than on wifi) is extremely expensive.

  • Remote location, 7kbs d'load speed, 10 days to d'load Lion, only software updates are through the App Store. Why can't we d'load and install outside the Cloud anymore? Some of us can't use the cloud.

    Remote location, 7kbs d'load speed, 10 days to d'load Lion, only software updates are through the App Store. Why can't we d'load and install outside the Cloud anymore? Some of us can't use the cloud and never will be able to.

    That is true - I apologize for not being specific - what I was mainly referring to is iLife applications. I have a notice on the App Store that says 3 apps need updates, I look at the apps and they are huge so since my connection is so slow I use my work connection and d'load the files from support to my Windows machine and carry them home, once d'loaded my MacAir states it cannot install, the update must come from the App Store.
    I do the same thing for large Leopard and Lion files and I can install them without error, it is just the App Store files that the system stops.

  • Press on Button and release outside the button armed frame

    Press on Button using the Mouse and release outside the button armed frame does not generate MouseEvent.
    Or Press on the Button outside the armed frame and release inside the armed frame does not generate MouseEvent.
    Window 7
    java version "1.6.0_22"
    Java(TM) Platform, Standard Edition for Business (build 1.6.0_22-b04)
    Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
    The question :
    Is this normal behaviour for Java Swing. Does this exist in the java specification? any idea ? or is this a bug ?
    the sample code below for you to test
    public class PanelButtonArmedFrameClick extends JPanel
       private static final long serialVersionUID = 1L;
       private JButton btn;
       public PanelButtonArmedFrameClick()
          btn = new JButton("Click on \n the button");
          this.add(btn);
          MouseListener mouseListener = new MyMouseAdapter();
          btn.addMouseListener(mouseListener);
       private static class MyMouseAdapter extends MouseAdapter
           * {@inheritDoc}
          public void mouseClicked(MouseEvent e)
             JOptionPane.showMessageDialog(new JFrame(), "Button clicked");
       public static void main(String... args)
          SwingUtilities.invokeLater(new Runnable()
             public void run()
                JFrame frame = new JFrame("Testing");
                JPanel panel = new PanelButtonArmedFrameClick();
                frame.getContentPane().add(panel);
                frame.setPreferredSize(new Dimension(500, 500));
                frame.setMinimumSize(new Dimension(500, 500));
                frame.pack();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
    }

    Sure this is not a bug and this is the behavior of mouseClickedEvent.
    mouse clicked = mouse pressed + mouse released.
    mouseClickedEvent is a combination of mousePressed and mouseReleased evenst which are generated at the same pixel location. So if you generate mousePressed and mouseReleased events at different locations you will not get mouseClicked event.
    Thats why you are not getting mouse clicked event when you are performing mouse pressed event on one place and mouse released event on another place.

  • I need to link to a screen within a movie from outside the movie

    Hi,
    That last question was answered so quickly, I'll ask this
    next one right away:
    I need to link to a screen within a movie from outside the
    movie (so for example, from file1.cp, I need to open file 2, screen
    4).
    Am I able to do this in Captivate 1?
    Thanks,
    Kim

    I've just gotten a chance to check out these responses. About
    the Flash - no can do. Don't have it. And about breaking the file
    apart, that would get messy because I have several files already.
    OK. At least I know my options are limited to linking to page 1
    from outside, so I'll have to be creative.
    Thanks for the response.
    Kim

  • Error: "Variable State has been used outside the reusable components"

    When I open a query in the ad hoc query designer I get several error messages like "Variable State has been used outside the reusable components."  I don't what this means or how to fix it.
    "State" is one of the variables used.  And there is a error for every variable that is used.
    All the variables are in the free characteristics.
    When I open the query in Query Designer, it is ok.
    Any ideas?

    Hi Fong,
    PLease check the following link:
    http://help.sap.com/saphelp_nw04/helpdata/en/1f/03223c5f00612be10000000a11402f/content.htm
    It states that:
    You cannot integrate variables into the query directly.
    However, you can use variables in reusable structures, or restricted or calculate key figures, which are used in the Ad-hoc Query Designer
    Hope this helps...

  • Can i get a sim card for an unlock iphone 4 to use outside the country

    can i get a sim card for an unlock iphone 4 to use outside the country? i bought an iphone 4 unlocked but it didnt come with a sim card and my old phone the sim card wont fit so where can i get a sim to fit and work in the new iphone 4 in another country.

    You would get it from whatever carrier you were going to use.

  • Unlock iphone 5 sprint using outside the U.S.A?

    I got an iphone 5 sprint like a gift and send it to my country Vietnam. I heard that Sprint iphone 5 sprint can work with any international sim card, is that true? and does Sprint support to do unlock ip5 sprint using outside the U.S.A?

    Sorry. Sprint will only unlock the SIM slot for current Sprint customers in good standing for use while traveling internationally . If you are not a Sprint customer, there is no way for you to activate or use that phone.

  • Can Internet Explorer (IE) be downloaded to and used on the late 2008 model of iMac running OS X 1.9.5?

    Can Internet Explorer (IE) be downloaded to and used on the late 2008 model of iMac running OS X 1.9.5? If yes, where can it be downloaded from?

    Only if you run Windows. IE does not work on a Mac without Windows.
    Windows on Intel Macs
    There are presently several alternatives for running Windows on Intel Macs.
    Install the Apple Boot Camp software.  Purchase Windows 7 or Windows 8.  Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows.  Boot Camp enables you to boot the computer into OS X or Windows.
    Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  Parallels is software virtualization that enables running Windows concurrently with OS X.
    VM Fusion and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  VM Fusion is software virtualization that enables running Windows concurrently with OS X.
    CrossOver which enables running many Windows applications without having to install Windows.  The Windows applications can run concurrently with OS X.
    VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris.  It is not as fully developed for the Mac as Parallels and VM Fusion.
    Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc.  There are performance differences between dual-boot systems and virtualization.  The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. A more recent comparison of Parallels, VM Fusion, and Virtual Box is found at Virtualization Benchmarks- Parallels 10 vs. Fusion 7 vs. VirtualBox. Boot Camp is only available with Leopard and later. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
    You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive.

  • Is there a way to switch back to the old color scheme for the keypad? The new black-on-white color scheme is more difficult to see and use for the visually impaired.

    Is there a way to switch back to the old color scheme for the keypad? After upgrading to ios 6, the keypad switched to a black-on-white color scheme.  I have a severe visual impairment and found the previous white-on-black color scheme much easier to see and use. 
    The inverted colors option doesn’t make things look all that better.    My dad, who does not have any serious vision problems, has put off upgrading his iphone because of the color scheme changes.    

    I have exactly the same concern. It seems it would be a simple fix for Apple to allow users to turn off the camera (and even the mic) while keeping FaceTime open -- especially now that it turns out FaceTime must remain open in order to send and receive iPhone calls on a Mac.
    I like to think this new functionality of FaceTime will be baked into a future release of Yosemite, as the current setup has that not-quite-finished feel of a work in progress. In the meantime, there's nothing like a little piece of Post-It stuck over the camera to keep the NSA from watching your face as you type a post to the Apple Support Communities.

  • How to disable the security code and use only the Touch ID

    how to disable the security code and use only the Touch ID

    You can't use Touch ID without a passcode.
    http://support.apple.com/kb/HT5883

  • HT4009 Purchasing gems on the clash of clans game.  It tells me to contact customer support   This happens a lot  and support takes the block off my account  and everything works fine. Looking forward to y'all resolving my issue   Ryan Hinger

    Purchasing gems on the clash of clans game.  It tells me to contact customer support   This happens a lot  and support takes the block off my account  and everything works fine. Looking forward to y'all resolving my issue   Ryan Hinger

    If you are getting a message to contact iTunes support then only they can help you (these are user-to-user forums, we won't know why you are getting the message) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • How to Declare Arrays in bpel and use them as acollection

    Hi,
    I Am new to Bpel, I had created an empty Bpel Process and configured file adapter to a directory, In my text file i have 3 records with four columns, each column seperated by ',' and each record seperated by "EOL(end of line)", Below is the xsd file generated by the native format xsd builder, taken a recieve activity to recieve the contents of file from file adapter.
    So all the data which is in the file will be there in recieve activity.
    FileContents
    55555,rgfdgsd,gfdgfdg,23
    66666,retretret,trtertg,21
    77777,rtrttreter,trtter,23
    My Question is
    I want to compare whether value of C1 = '55555' and if the value is equal to 55555 then that record with c1=55555 has to be inserted into database by using Arrays
    How to compare the value of c1 through bpel functions.
    with java i have to use the logic similar to this by using Xpath
    getElement by tagname(c1);- it will give all the elements with tagname c1, three records are there with tagname c1 (c1=55555,c1=66666,c1=77777), we have to iterate through the elemnts and check whether the value iof c1='55555' and get the whole parent block which contains values of c1,c2,c3,c4 and insert that to database
    What variables we have to use to get the Similar logic in bpel
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    targetNamespace="http://TargetNamespace.com/FileAdapter"
    xmlns:tns="http://TargetNamespace.com/FileAdapter"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
    <xsd:element name="Associates">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Associate" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C1" type="xsd:double" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="C4" type="xsd:double" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    I want to do it by using Arrays,
    Please post the step by step procedure like
    How to declare an Array?
    How to iterate the results in recieve acticity of file adapter and put them to array?
    How to compare the values in array with our desired value?
    Please Look into this and suggest me the solution.
    Regards

    I think it is a good option to use transformations. Do you have any critical reason why you want to do this using array?
    Little explanation below for your questions.
    As per my understanding from variable is the recieve activity variable and to variable is the Array variable is it right?
    Yes. Here I was try to build my array from the different source system data. This will append data to the array variable.
    How can we declare an array variable in bpel(to variable) with name as Variable_Array, part as payload and query as ArrayList?
    *Any element that can hold another element can be a array.
    For example if element A is declared as sequence of element B type, then A acts as a array for B*
    Could you please explain this also, what is from variable? and what is to variable?
    +<assign name="Assign_XPath_For_Array">+
    +<copy><from expression="concat('/ns1:ArrayList/ns2:ArrayElem') "/><to variable="Variable_Xpath"/></copy>+
    +</assign>+
    what is the type of to variable "Variable_Xpath"(String or int etc)?
    This creates a dynamic Xpath and store in some variable here. Here the variable is called Variable_Xpath which is a string
    similarly what is the type of to variable?
    +<assign name="Assign_Read_Array">+
    +<copy>+
    +<from expression="bpws:getVariableData('Variable_Array','payload',bpws:getVariableData('Variable_Xpath'))"/>+
    +<to variable="Variable_Read_Array_Element" query="/ns1: ABC"/>+
    +</copy>+
    +</assign>+
    To variable type is the variable that I read from the Array.
    *For example if A is the array holding B, then the to variable is B and from is doing A[counter]*
    Every Little Helps
    Kalidass Mookkaiah
    http://oraclebpelindepth.blogspot.com/

  • I had to select one set of commands applied to build array VI to be disabled after the first iteration

    I 'am attaching one VI . here my intention is to stop the program from taking 19-0 commands after first iteration.And when I click the case selector to true  then the cpmmands from 163-170 to be read by the for or while loop  . Can i expect kind help?
    Attachments:
    translation case.png ‏86 KB

    Setup your serial port before your main loop.  Close it afterwards.
    Look into the Select function in the comparison palette.  You can wire your arrays (or better yet, strings) to each of the outside terminals and wire your button to the select input.  Wire the output to the VISA write.
    Instead of type cast, use Byte Array to String and String to Byte Array.
    You probably don't need the buttons and case structures in the inner loop.
    You are reading all of the bytes in the port, but you are only looking at the first one.  As stated in 3, use the String to Byte Array.  Use the Search 1D Array to see if your character 27 came through (the resulting index will be negative if it wasn't found).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Week No. on new P45 forms does not align and prints outside the ...

    The new P45 sapscript (HR_GB_P45_A4_D & HR_GB_P45_A4) does not align the Week number within the box of the pre-printed HMRC stationery. The week number appears on all three forms (1/1A, 2 and 3), being page 1,2 and 3 of the sapscript, and all are printed out of their appropriate box.
    Has anyone else encountered this problem ?.
    I can correct this as we currently use a Z version of the sapscript. I have checked the Z version (a recent copy) of the SAP original sapscript to ensure that the original will also have a mis-alignment, which it does. However, despite changing this I would still like SAP to correct their mistakes. I must admit I am VERY surprised that nobody else has encountered this problem as any week number being displayed on either the HR_GB_P45_A4 or HR_GB_P45_A4_D form will not align correctly.
    Jason
    Edited by: Jason Stratham on May 26, 2009 2:55 PM
    Edited by: Jason Stratham on May 26, 2009 4:28 PM

    P45 form printing to tray 1,2, and 3.
    On a slightly related subject we occassionally find that our lexmark three bin printer seems to forget it's bin setup and every now and then the pages will come out on the wrong HMRC pre-printer stationey. We have double-checked the paper loaded and we ONLY have the P45 form 1/1A in try 1, form 2 in tray 2 and form 3 in tray 3. However, despite this it still occassionally goes wrong, with the form 1 and 2 printing to tray 2 and form 3 printing to tray 3. This normally happens after a long weekend, so I don't know whether this is a printer driver caching problem or suchlike. Has anyone had any similar problems?.
    Jason

Maybe you are looking for