Run invoke-command on multiple machines at the same time

Hey all so I read that if I store my New-pssession in a variable then used that in my invoke-command it would run all computers at the same time.
$a = Get-Content "C:\Users\cody-horton\Desktop\list.txt"
$session
for($i=0;$i -lt $a.Length;$i++){
if(!(Test-Connection -Cn $a[$i] -BufferSize 16 -Count 1 -ea 0 -quiet)){
Write-Host $a[$i] -foregroundcolor red
else{
$session = New-PSSession $a[$i]
Invoke-Command -Session $session -FilePath "\\My computer\C`$\Users\public\Documents\zip folder.ps1"
What exactly am I doing wrong I just need to run this script on multiple machines at the same time.
Thanks.
Edit: Also what would be the best way to close all the sessions thanks.

Hi there,
So what I think you are doing wrong here is that you are overwriting the value in $Session everytime you executed code inside for loop. try the below:
$a = Get-Content "C:\Users\cody-horton\Desktop\list.txt"
$session = @() #define this as an array
for($i=0;$i -lt $a.Length;$i++){
if(!(Test-Connection -Cn $a[$i] -BufferSize 16 -Count 1 -ea 0 -quiet)){
Write-Host $a[$i] -foregroundcolor red
else{
$session += New-PSSession $a[$i] #add the new session to the array, at the end it will be a collection of sessions
Invoke-Command -Session $session -FilePath "\\My computer\C`$\Users\public\Documents\zip folder.ps1" #I think the above one won't work..first you need to copy the script locally on the machine and then execute it#Why this won't work because of Second-Hop Authentication
Have put comments where I edited your code.
Hope this helps
Knowledge is Power{Shell}. http://dexterposh.blogspot.com/

Similar Messages

  • WDS 2012 R2 - Cannot PXE multiple clients at the same time

    Hello All,
    This is my first post on here so I apologize if this is the wrong place.  I work for a school district and we are implementing WDS 2012 R2.  We've been extremely satisfied with the speeds and ease of use through unattend files.  However, for
    the past month I've been looking for a possible answer to a problem that has plagued us from day one of implementation.
    So here's the problem:
    I have a stand alone WDS server which is not a domain controller and is not our DHCP server.  I have IP helpers and broadcast forwarders setup on the network.  As well as option 66 and 67 in DHCP.  So far so good right!
    Well that's partially right.  When we boot one client at a time to the WDS server.  Everything works as intended.  We can TFTP the necessary files from the WDS server.  Everything boots up and we're off and running.
    However, if we boot up two or more clients at the same time.  The WDS server never responds to the traffic.  The clients get their DHCP information.  They start the referral and download from the WDS server, but get no response.  I'm
    really hoping that someone on here would have some insight of something I can try.  I've about exhausted my list of peers and contacts.  They're all stumped as well and were smart enough to stay with 2008 WDS.
    I would prefer to stick with 2012 R2 since it's setup and working for the most part.  With only this one hiccup.
    Thanks in advance for any guidance!

    Hello Daniel,
    I appreciate the reply and apologize for taking so long to get back to this.   Things have been a little hectic over here.
    I have tried everything on this forum and I am still unsuccessful in PXE booting multiple clients at the same time.
    Multicast is enabled on the server, and it works for the clients.  However, as stated in the original post.  I cannot boot multiple machines at the same time.  I can start them from the image selection screen around the same time though.  So,
    that appears to be working fine.

  • Can I run the currency translation for multiple years at the same time?

    Dear Friends,
    I set up currency translation on our BPC NW 7.0 system and it is working fine ONLY if I run it for any one year at a time. But if I select multiple years in the data package (FX Restatment) selection it only calculates for the first year in that selection.
    say if I run the data package for years: 2009, 2010, 2011, 2012, it only performs currency translation for the year 2009.
    Can I run the currency translation for multiple years at the same time ?
    Note: The year is determined from the YEAR property of the "Time" dimension
    appreciate any inputs,
    thanks

    You can run currency translation for multiple years.
    I think the problem it is actually related to how you are sending the parameter to currency translation script.
    Just review the script logic log and you will see with what parameters was called currency translation FXTrans.
    My expectation is that actually the script is called just with first year and that's the problem.
    Log of script logic you can find it into:
    C:\BPC|DATA\Webfolder\YourAppset\YourApplication\Private Publications\Users used to run logic\Temp
    Regards
    Sorin Radulescu

  • Can I export multiple folders at the same time, keeping the album structure

    I'm exporting all of my photos from 2010 so far. Is there a way to export multiple folders at the same time, while keeping the existing album structure? It seems that when I try it, iPhoto exports them all to the same folder.
    I really don't want to do this one album at a time, and here's why -
    I'd like to select all of the albums, then export, using the plugin, to WalMart so that I can order prints.

    Check out [iPhotoToDisk|http://www.iphototodisk.com/index.html]
    I'd like to select all of the albums, then export, using the plugin, to WalMart so that I can order prints.
    Why not upload to Walmart from iPhoto? Check out the first option here:
    There are many, many ways to access your files in iPhoto:
    *For Users of 10.5 and later*
    You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    Uploaded with plasq's Skitch!
    *For users of 10.4 and later* ...
    Many internet sites such as Flickr and SmugMug have plug-ins for accessing the iPhoto Library. If the site you want to use doesn’t then some, one or any of these will also work:
    To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
    This is also true for emailing with Web-based services. However, if you're using Gmail you can use iPhoto2GMail
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    *If you want to access the files with iPhoto not running*:
    For users of 10.6 and later:
    You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and later:
    Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    3. *Show File*: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
    Regards
    TD

  • Is there any version of Indesign that allows to open multiple instance at the same time

    I am using Indesign CS3 to generate the bulk reports automatically(programmatically) using Adobe indesign library . One of the key limitation to this tool is it allows to open only one instance at a time unlike word where multiple instances can be opened at the same time. Is there any adobe indesign too version desktop/server which allows to open multiple instances at the same time. Any help on is appreciated. Thanks.

    @PeterG
    You said "You might want to examine the End User Licensing Agreement (EULA) for  any prohibition against using these two instances at the same time with  the same license; the license does permit two installs for the same user  that are not used simultaneously." I thought that meant you had read the EULA. It's pretty unambiguous on that point.
    For everyone's edification about multiple installations and server use with a standard license here's the relevant text:
    2. Software License.
    If you obtained the Software and any required serial number(s) from Adobe or one of its authorized
    licensees and as long as you comply with the terms of this agreement, Adobe grants you a non-exclusive
    license to install and use the Software in a manner consistent with its design and Documentation and as
    further set forth below. See Section 16 for specific provisions related to the use of certain products and
    components, for example font software, Acrobat, After Effects, Adobe Presenter, Contribute, Adobe
    Device Central, Flash Player, Flash Builder, and Adobe Runtimes.
    2.1 Limited Use. The Software, or portions of the Software, may allow installation and use without a serial
    number. If so, you may install but not use such non-serialized Software on any number of Computers as
    part of an organizational deployment plan. Further, you may install and use such non-serialized Software
    on any number of Computers for demonstration, evaluation and training purposes only and only if any
    Output Files or other materials produced through such use are used only for internal, non-commercial and
    non-production purposes. You may not use such non-serialized Software after any applicable time-out
    period has ended, unless you input a valid serial number under Section 2.2. ACCESS TO AND USE OF
    ANY OUTPUT FILES CREATED WITH SUCH NON-SERIALIZED SOFTWARE IS ENTIRELY AT
    YOUR OWN RISK.
    2.2 General Use. You may install and use one copy of the Software only on the Permitted Number of your
    compatible Computers into which you enter a valid serial number.
    2.3 Distribution from Server. You may copy an image of the Software onto Computer file server(s) within
    your Internal Network for the purpose of downloading and installing the Software onto Computers within
    the same Internal Network for use as permitted by Section 2.1 and 2.2.
    2.4 Server Use. You may install the Software on Computer file server(s) within your Internal Network only
    for use of the Software initiated by an individual from a Computer within the same Internal Network only
    as permitted by Section 2.2. The total number of users (not the concurrent number of users) able to use the
    Software on such Computer file server(s) may not exceed the Permitted Number.
    By way of example, the foregoing does not permit you to install or access (either directly or through
    commands, data or instructions) the Software: (a) from or to a Computer not part of your Internal Network,
    (b) for enabling Web hosted workgroups or services available to the public, (c) by any individual or entity
    to use, download, copy or otherwise benefit from the functionality of the Software unless licensed to do so
    by Adobe, (d) as a component of a system, workflow or service accessible by more than the Permitted
    Number of users, or (e) for operations not initiated by an individual user (e.g., automated server
    processing).
    2.5 Portable or Home Computer Use. Subject to the important restrictions set forth in Section 2.6, the
    primary user of the Computer on which the Software is installed under Section 2.2 (“Primary User”) may
    install a second copy of the Software for his or her exclusive use on either a portable Computer or a
    Computer located at his or her home, provided that the Software on the portable or home Computer is not
    used at the same time as the Software on the primary Computer.
    2.6 Restrictions on Secondary Use by Volume Licensees. If the Software was obtained under an Adobe
    volume license program (currently known as Adobe Open Options) by any licensee other than an
    educational volume licensee, the second copy of the Software made under Section 2.5 must be used solely
    for the benefit and business of that volume licensee. For more information about secondary use by volume
    licensees, please visit our Web Site at http://www.adobe.com/go/open_options.
    There is also language stating that if you have a dual boot or other system capable of running more than one OS you will need a separate license for each platform if you want to run the software on more than one.

  • How can one share iTunes Library across two machines at the same time?

    **I have setup 1 of 2 machines to host all the songs in my iTunes library. I then went to machine 2 of 2 and held down option key on start up of iTUnes, changed the location of the liobrary on machine 2 to a shared folder on machine 1.**
    **This works awesome and I can use itunes on each of the machines 1 and 2 with no duplicate library in my home.**
    **Problem: I can only run one machine at a time. I can not run itunes on both machines at the same time. The error message from machine 2 is ITUNES library is locked and cant write to the folder. iTunes works correct if I QUIT iTunes on machine 1.**
    **Can iTunes run at the same time on 2 machines and access the same library?**
    *Thank You Troy*

    Troy Yoho wrote:
    Can iTunes run at the same time on 2 machines and access the same library?
    in a way, yes.
    set up _*Home Sharing*_ on both machines.
    JGG

  • How to Modify multiple users at the same time.

    Hi All,
    I oversee a lab with 8 24" imacs running 10.4. Each machine has the same set of guest user accounts. The machines are not connected by a actual server, although I can dump files to a common folder. My problem is every time I want to make system pref changes I have to go into each user account to apply them, (i.e.,adding a new monitor profile). Any ideas or work-arounds out there?
    Thanks
    Phil

    Hi Phil, and a warm welcome to the forums!
    It's not clear if these are connected in anyway, but if they are, something like Timbuktu® Pro for Mac OS X, or ARD...
    http://www.netopia.com/software/products/tb2/mac/
    http://www.apple.com/remotedesktop/

  • Lightroom CC issues with multiple export at the same time

    Back before Lightroom updated to the CC version, I was able to use export presets to send 4 different versions of the photos I'm working on at the same time (A Full Size for client at certain size, full size for myself, web-sized with watermark and a thumbnail). Since updating to the CC version, I'm only able to start the export process on two of these versions before the system simply becomes crippled and I cannot even navigate through Lightroom without it chugging along.
    For reference, I'm running a 2014 rMBP with 16GB of RAM, LR is the only app open at the time and it's showing that I have roughly 6GB of RAM free when attempting this export.
    TL;DR: LR5 worked wiht multiple exports at the same time, but LRCC now chugs after 2 exports are started

    Re: "Selecting video in Messages, now starts Face time for video. Face time is one to one only."
    Apple "Messages" supports two different types of video conferencing. It's become more than a little confusing. If you (or the person on the other end) ONLY have accounts set up for Apple's "iMessage" service (associated with your Apple ID and "iCloud") you may see the video symbol, but when you click on it you will be connected via FaceTime which is limited a 1-to-1 video conference.
    However, if you have set up an AIM account in Messages (you may already have an AIM account ID if you once used iChat for video, audio and screensharing) and the person at the other end also has an AIM account you will be connected via AIM and will be able to do screen sharing and multi-person video conferences just like the old iChat, i.e. you'll have iChat Theater features, up to 4-way conferencing, etc.
    It can get very confusing if, for example, you've signed up for AIM using a .me or .cloud email address. But once you have it set up and learn to recognise the way Messages switches between AIM and iMessage all the old iChat features work just fine in Messages.

  • Accessing multiple portals at the same time?

    Is it possible to access multiple portals at the same time?
    For example, what I want to achieve is different properties (layout,
    portlets, look & feel) for different groups of users accessing the same
    portal. The Associated Groups part on the Portal admin page is not
    fulfilling our requirements. So we decided to have different portals for
    different groups of users, all working through one portal, and accessing
    their custom portals. Is this achievable?
    What we are thinking is: put the common functionality in the repository
    portal directory, and the custom portlets/jsps in the group-specific portal
    directories. This way we can customize portal behavior for different groups
    of users. Is this achievable?
    Thanks.
    Amit

    You have to user respective DRILL commands present in WAD to configure the drill operations on multiple characteristics...

  • How do I delete multiple documents at the same time

    How do I delete several or multiple documents at the same time.  Do I have to delete each one individully?

    You can select multiple adjacent files or folders by clicking on the first one then shift-click on the last one.  Multiple non-adjacent files or folders can be selected one at a time by command clicking on each one.  Click on any selected file or folder then drag/drop to trash.

  • How do I delete multiple emails at the same time rather than individually?

    How do I delete multiple emails at the same time rather than individually?

    My mistake
    I was looking at my KB, even tested my suggestion with the command key, and then wrote option
    Barry

  • Give commands to two keithley2400 at the same time

    Hi All,
    I would like to give commands to 2 keithley2400 at the same time and wish them to do current sweeping simultaneously at real time. That means I have run two loops simultaneously. It seems to be difficulat yet not so difficult since there is no dependency between these two loops... Is it possible? using what structure? The solution i use right now is a simple true/false button with two case structure. And of course it won't work. Sometimes two units will run simultaneously but most of the time they will run in order.

    While multiadressing may get you "synchronous" enough it's by no means a guarantee that both instruments will really react equally fast when receiving the trigger command over the GPIB bus. For true hardware synchronized operation you will have to use the trigger bus on the back of the device to connect them together, select one of the 4 trigger lines to use and set them up correctly on both instruments, one as input and one as output and then send the trigger command to the device that drives the trigger line. That will give you synchronisation to microseconds accurate. GPIB multi addressing will be in the range of several milliseconds and sequential GPIB in the range of maybe 100 milliseconds. 
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Cannot open 2 Virtual Machines at the same time to access the same Database

    Folks,
    Hello.
    I am installing Oracle Database 11gR2 RAC system using 2 Virtual Machines (rac1 and rac2) on the top of VMPlayer 3.
    The VM rac1 and rac2 run correctly when one of them is shutdown.
    Their locations are F:\VM_RAC\rac1 and F:\VM_RAC\rac2.
    While rac2 is running, I open rac1. But this error message comes up:
    Error: "Cannot open the disk F:\VM_RAC\sharerac\asm1.vmdk or one of snapshot disks it depends on. Reason: failed to lock the file."
    While rac1 is running, I open rac2. But this error message comes up:
    Error: "Cannot open the disk F:\VM_RAC\sharerac\asm1.vmdk or one of snapshot disks it depends on. Reason: failed to lock the file."
    The 2 error messages are the same. This means I cannot open 2 VMs rac1 and rac2 at the same time. When we run RAC system, we have to open 2 machines or more than 2 machines at the same time so that all machines can access the same Database Server.
    My question is:
    Can any folk tell me how to have rac1 and rac2 run at the same time ?
    Thanks.

    You need to disable disk locking, which ordinarily is performed by the first VM to prevent any other VMs from corrupting your vmdk files via uncoordinated writes. You will have to shutdown both of your VMs and edit the *.vmx flat file for each, adding lines like the following (settings taken from workstation 6, but should be nearly identical settings for VM Player 3.x):
    http://crosbysite.blogspot.com/2007/10/clustering-in-vmware-workstation-6.html
    scsi1.sharedbus = "Virtual"
    disk.locking = "false"
    diskLib.dataCacheMaxSize = "0"
    diskLib.dataCacheMaxReadAheadSize = "0"
    diskLib.dataCacheMinReadAheadSize = "0"
    diskLib.dataCachePageSize = "4096"
    diskLib.maxUnsyncedWrites = "0"
    A few comments:
    - your shared disks (scsi1) must be on a separate virtual scsi bus than the boot disk (scsi0), to allow setting the sharedbus flag as seen above.
    - you must also ensure the cache parameters and unsynced writes settings are set to guarantee that all IO is immediately flushed to the vmdk file so the other VM can immediately access the latest version of data.

  • Can you use sync on multiple computers at the same time? ie have someone else logged into your firefox account for you whilst you are also logged in

    I am trying to sign up to something but there is only a short window so was going to ask a friend to sign in at the same time using my account to try to sign up (with my password being saved into my firefox account)

    Hi. Yes, you can use Sync on multiple devices at the same time. I use it to keep my bookmarks in sync across my desktop and Android versions of Firefox.

  • Is there a way to delete multiple pictures at the same time from the iphone4s?

    Is there a way to deleter multiple pictures at the same time, from my iphone4s? I know how to delete one at a time. Thanks

    Open your Photos App > Camera Roll > At the top right corner you will see a rectangle with a right arrow, select that. Now you can select as many photos as you want and you can hit the red Delete button on the bottom right.

Maybe you are looking for

  • Print Text File in NW 3.12?

    I have to admit some ignorance regarding NetWare printing, so my apologies in advance... I work for a document management company, and am trying to find a solution for a customer running a fairly archaic, DOS 6.22-based application that utilizes a Ne

  • Video Filters effect on footage

    If I capture footage inverted, like from a 35mm adapter, and rotate it twice so it is right side up does the render effect the quality of the footage? it seems it shouldn't, but i'd like to know for sure. thanks vince

  • How do I get to the console of a VM using UCS Director?

    Is there a way with UCS Director to present users of the system the console of the VM like when you launch the VSphere Client and bring up the console?  I can see that users can RDP into a running machine or connect to a web interface but that appear

  • Crystal 2008 crashes when trying to print

    Hello, I am unable to print from Crystal 2008; the program crashes and I get the error crw32.exe I have disabled the DEP in my computer. I have installed the SP1 of Crystal 2008. I have uninstalled the SP3 of Windows XP. I have uninstalled and reinst

  • Importing a page

    I have imported a page from one application to another application int the same workspace. After importing the page it runs very slow in the new application (but all the functions works fine). Do I have to do any change after importing the file? thx,