Get-Content not grabbing all machines in a text file

Good Afternoon,
I am running a script that I found on another page to determine if a particular service is running on multiple computers.  
I am testing this for future use.
Here is the syntax in the ps1 file:
$computers = Get-Content -Path C:\Temp\serverstest.txt
Get-Service -ComputerName $computers -Name "Service Name" | Select Name, MachineName, Status
The text file has five server names in it.  There are no spaces at the end of the name or extra lines after the last one. The script will run but it only returns the first server in the text file. Here is what the text file looks like
The output is this:
Name                                       Machine Name           
Status
ccmexec                                   cmgrtstqw1               
Running
That is all that is returned.  It does not look like it is grabbing all the servers in the list to report against.
I figure I either mistyped something or goofed it somehow.
Thoughts or suggestions.
PS...I have to say that I have found the Scripting Guys Forum IMMENSELY helpful in understanding Powershell....Thanks

Hi,
Looks like this is a PS 2.0 thing. Try this instead:
Get-Content .\pcList.txt | ForEach {
Get-Service -ComputerName $_ -Name 'CcmExec' | Select Name, MachineName, Status
Don't retire TechNet! -
(Don't give up yet - 12,700+ strong and growing)

Similar Messages

  • Get information from an array saved into a text file

    I am trying to get information from an array saved as a text file to extract the information to build an string. This string will go out from the serial port to a device which will listen this message and it will answer the question. All the information sended sequencially it has to be obtained from that array. Every row contain one instruction and this has to be sended one after one.
    Could you tell me if is possible to make this driver? And if you have a similar driver, Where can I get it from?

    The VIs that I would suggest using are found in the String Function Pallet:
    Spreadsheet String To Array
    Array To Spreadsheet String
    The delimiter should be the termination character. These VIs will adapt to a string array.
    For the Spreadsheet String To Array wire an empty string array and use %s as the format. The delimiter should be the termination character of the text file, most likely a end of line (\r\n).
    For the Array To Spreadsheet String the delimiter should be the termination required for your serial device.
    Using a combination of these two VIs should provide you the functions required to make the driver.

  • Wirte the content of an internal table into a text file

    Hello Experts,
    how can I wirte the content of an internal table into a text file and putit on my local
    desktop ?
    Regards
    ertas

    Hi,
      You can use the FM GUI_DOWNLOAD for this purpose.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'c:\testmmv.txt'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = LT_STR
      FIELDNAMES                      = 
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22
    IF SY-SUBRC <> 0.
    Implement suitable error handling here
    ENDIF.
    With regards,
    Vamsi

  • Premiere not showing all audio tracks in video file?

    Hello,
    The short version of my issue is that I am not seeing all audio tracks in my imported AVI video. I know they are there, but only one track is showing.
    Longer version:
    I have an application called Action! that is used for recording games. There is a setting on this application that allows you to record your microphone as a separate audio track.  I made a 15 minute video using this. If i play this video in Action!'s media player, i can switch between my game track and my microphone track. If I play the video file in Windows Media Player, it plays both tracks. When I import this video file into Premiere (or Soundbooth) it only shows the Game track and not the microphone track. I cannot find a way to get to the microphone track. It just seems like it doesnt exist. Any thoughts?
    Thanks in advance

    music from library on drive/aiff

  • Search PDF contents for ISBN number and save to text file

    Hi,
    Hoping someone can help me create a script that can find the ISBN inside of a PDF and write that filename and number to a text file.
    I've found a way to do this using java using and document processing in Acrobat but I need to do it by pointing at a folder of files.
    Format desired would be:
    original filename.pdf, isbn#
    Any help is appreciated,
    John

    you could give the command line tool ps2ascii a try. It also works with pdf and you could  pipe it's output (pure text) to a nice perl/ruby/grep/sed/awk 1-liner to extract the isbn numbers (still have to read a book about Regular Expression ;-) )
    I did a quick & dirty version, but I think you will have to install ps2ascii first. I don't remember but I think it was installed with ghostscript (using macports)
    --30.04.2011 hubionmac.com
    --quick & dirty script to extract first ISBN-Number of a PDF file... just uses grep, maybe some nice reqexp would do a better job!
    set myselection to choose file of type {"pdf"} with multiple selections allowed
    set myoutput to ""
    repeat with pdf_file in myselection
    tell application "Finder" to set pdfname to name of (pdf_file as alias)
    set pdf_file_posix to quoted form of POSIX path of (pdf_file as alias)
    do shell script ""
    try
    --first add the path, otherwhise s2ascii will fail since it cannot find ghostscript (gs) which is also installed in /usr/local/bin (think by macports)
    set ISBN_String to do shell script "PATH=\"$PATH:/usr/local/bin\"; /usr/local/bin/ps2ascii " & pdf_file_posix & " | grep -m 1 ISBN"
    set foundLine to true
    on error
    display dialog "maybe \"" & pdfname & "\" does not contain a ISBN at all"
    set foundLine to false
    end try
    if foundLine is true then
    repeat with s in every word of ISBN_String
    try
    get s as integer
    set s to s as text
    set foundisbn to true
    exit repeat
    on error
    set s to ""
    end try
    end repeat
    end if
    set myoutput to myoutput & pdfname & tab & s & return
    end repeat
    tell application "TextEdit"
    activate
    set a to make new document
    set text of a to myoutput as text
    end tell

  • Not able to read other than text files

    Hi,
    I am trying to read a set files in a folder, but i am able to read only test files all other file format cannot be read. word document is not read correctly!
    I use fileInputstream object and get the bytes of the file length and set the charset to "UTF-8". the output is like a junk data.
    I feel i need to set the exact charcterset, but donot no how, can any body help me out.
    i tried character.unicodeblock.of this is not returning the exact uincode( may be i am wrong)
    Thanks in advance.

    Don't read binary files as though they were text.
    Also if you are just copying files, you shouldn't even bother to read text files as text, unless you want to go beyond copying and, say, change the encoding.
    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]

  • How can I get Firefox to execute html code in a text file?

    I used Notepad to create a text file, markup.html, that contains html code. How can I get Firefox to execute this code?
    Also, how can I use the <script> tag in the html code using the src attribute to execute code in a file written in Javascript?

    First guess is that you did not use an .html extension on the file. The file may well be ''name.html.txt''
    * see http://www.bbc.co.uk/webwise/guides/file-extensions
    *http://windows.microsoft.com/en-gb/windows/show-hide-file-name-extensions#show-hide-file-name-extensions=windows-vista
    Forum Note
    This is normally offtopic for this forum. I say normally because now we cover webmaker questions. I wonder if this is therefore on topic as a webmaker question?
    I have tagged with webmaker-contribution

  • Symbols do not flow into InDesign from standard text file

    Within our application, we have the option to type in symbols within a text editor. Symbols include the copyright, registered, and trademark symbols. We then take the text that is typed in and merge the text to a standard text file, then place that file within InDesign CS3. At one think those symbol flowed in perfectly, but recently those symbols do not flow into InDesign on their own. What could be causing this problem.
    Any body have any thoughts?
    Thanks,
    Brian

    You can get these three (serif) characters in Symbol with
    <0xF6D9><0xF6DA><0xF6DB>. Your three characters come in pink (which
    means they don't exist in the font). It could be that they used to work
    because you had a different Symbol font loaded. I always seem to have at
    least three Symbol fonts (T1, TT, OT) going, even though I try to only
    have one.
    But why bother with the font change? These characters are ANSI: © ALT
    0169, ® ALT 0174, ALT 0153. You should be able to see them in your
    text editor and in just about every decent text font.
    Kenneth Benson
    Pegasus Type, Inc.
    www.pegtype.com

  • How to extract the Html content of a UI Map into a text file or html file?

    Hi,
    Is there any possibility in OUAF or Java or from the Database, to retrieve the Html Content of a given a UI Map ?
    If UI Map name is the input, then it should fetch the entire html portion of it into a text file. How to acheive this?
    This needs to be done programatically either by writing some Java code or some SQL at the DB level?
    Edited by: OATS Explorer on Dec 29, 2012 9:10 AM

    F1_MAP.HTML_DEFN would give the html contents and F1_SCHEMA.SCHEMA_DEFN would give you the UI Map's Schema.
    SELECT map.map_cd
      , map.html_defn
      , sch.schema_defn
    FROM f1_map map
      , f1_schema sch
    WHERE map.map_cd = sch.schema_name
    AND sch.schema_type_flg = 'F1MP'

  • Standard business content not extarcting all data

    Hello,
    I am currently rolling out QN data.  The standard business content for 2lis_05Q0task includes FECOD FEGRP & OTEIL (from table QMFE) fields however the data is not being pulled. All the other data is coming in ok.  Is there something I need to do to get this data?
    Thanks For your help
    Mireille

    Hi,
      Pls Check in QMFE table if the data is present for these fields.
       Take the notification no from the RSA3 extraction and
    look for it in the QMFE table.
    Rgds,
    Ravindra.

  • Network Accounts Unavailable but not on all machines

    Hi
    I have a client with a Dual processor XServe G5 running 10.4.8 server, their Macs are also on 10.4.8 and they are setup with Network Home Directories.
    In the last few weeks, I have had intermittant problems with a couple of the machines that don't seem to be able to log onto their accounts in the morning when first switching the machines on. Clicking on the status line in the login window in this instance shows "Network Accounts Unavailable".
    To solve this I have been logging in remotely as admin to the machine(s) in question, deleting the LDAP configuration in Directory Access, re-configuring, rebinding and then logging out. When doing this, the Network Accounts are then shown as available and the user can log in normally.
    Interestingly, when I get to the point of deleting the configuration, it says that it can't contact the LDAP server, and asks if I want to force a disconnection and I guess this is why the user can't get to their network account in the first place, because it can't see the LDAP server?
    However, other machines on the network, don't have this problem and can log in after a restart or shutdown with no problems. Why would it do it on just a couple of machines? Could it be the network switch?
    None of these machines are connected via a wireless connection, they are all hard wired into a small 5 port switch, which in turn is wired back to the main switch in their rack and this is a 10/100 Allied Telesyn unit.
    Any ideas as to what I can do to resolve these intermittant issues. It's becoming a pain to have to resolve this every morning for the client when they come in.
    Thanks
    Paul
    PowerBook G4 17"   Mac OS X (10.4.8)  
    PowerBook G4 17"   Mac OS X (10.4.8)  

    Hmm, seems I solved it by tweeking with the broadband router.
    (I fed it with a backup DNS, and reactivated DoS firewall)
    Does neither explain why another PC worked well alongside this one,
    nor why another OS gave other results.
    Maybe just a broadband router inconsistency, anyway, l'll consider this fixed for now.

  • Firefox keeps crashing and keep getting do not trust all sites on firefox

    Firefox keeps crashing and I keep getting this
    This Connection is Untrusted
    You have asked Firefox to connect securely to www.mozilla.org, but we can't confirm that your connection is secure.
    Normally, when you try to connect securely, sites will present trusted identification to prove that you are going to the right place. However, this site's identity can't be verified.
    What Should I Do?
    If you usually connect to this site without problems, this error could mean that someone is trying to impersonate the site, and you shouldn't continue.

    Hello,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information. <br>
    '''Note''': ''This will cause you to lose any Extensions and some Preferences.''
    *Open websites will not be saved in Firefox versions lower than 25.
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • Mail 3.5 will not grab all email messages from servers

    I may be missing a setting somewhere, but I'm pretty sure I've looked at most everything. When I launch Mail, I currently have a Hotmail Mailbox and a Gmail Mailbox. Neither are functioning 100%. Both have only downloaded a portion of the messages available on the server. The Hotmail account (POP) has downloaded only 140 message, but when it "checks for new mail" it shows it is downloading message 466 out of 466, with 0KB left to go. Gmail has downloaded only 107. I don't know what the total number of email messages is in my gmail account, but it far exceeds 107. What is very annoying is that the Hotmail account is only downloading the oldest messages, as opposed to the newest like Gmail did. I have moved the MessageUidsAlreadyDownloaded3 from the Mail library folder and restarted Mail, but to no effect. Any ideas?

    After much searching around and trying different approaches, I finally solved my issue. I ran the combo 10.5.6 updater, and this solved the issue. Prior to running the combo updater, when I repaired permissions several things could not be repaired. After the combo updater, everything works fine, and permissions are fine as well.
    My mail issue happened after I updated Quicktime, fyi.

  • Relink does not work; all events staying red and files disappear!

    A very bad bad story...
    after continuis spinning ball (i hate this thing what so often comes to please me) I used "forced stop" fcpx. (i could not else)
    after restart fcpx all the events are in red.
    after restart mbp + fcpx: all events are red again... that looks bad to me...
    i tried more than ones the relinck function:
    no result at all. I saw actions being done, the harddisk drive was working but no relinked files in the events. (i tried one by one, there are 9)
    An other attempt with relinck: a small event (about 9 files) and not important for me seems to be going well, the red clips disappear in the event window but .. all clips disappeard to!; a totally empty event window... I looked with finder into the map and believe it or not: all the files were gone! I could not believe this thinking i made a fault.  Thus:
    I repeated this action with another map (and copied the files in it first) and the same happens: totally empty.
    I tried to re-import from camera/archief: no result.
    The last thing to do was:
    to open a new event and "imported from file": the clips came into the event window but .... red...
    So, in my opnion there is something very very wrong...
    What can i do more to restore the connection because the most events have a content according to the finder.
    BTW, i know there is a lot of discussion about this matter and may be with the solution but i can 't find it... (even with the searchfunction)
    For any help or suggestion: Thanks!
    Bruce.
    (I am going to sleep now, it is over midnight here)

    That's not stupid, I happened to me too yesterday.
    How are you supposed to know that the files fcpx is pointing out are originals or Proxies. You have to go check in the Prefs.
    Wishlist: Since choosing to read fullres or proxy media is an application wide feature, it should appear clearly somewhere (in the Timeline bar, the Library, or the Inspector) as a reminder.
    A couple of time I have wondered which files fcpx was reading. The only way to know is the cmd-F (Locate in Finder) command. The Inspector doesn't give any answer to that.

  • I just switched to Verizon and now I am not receiving all my calls or texts.  Does anyone know why this is?

    Two days ago I switched from AT&T, today I discovered that people have been trying to call/text but I am not getting them.  When they call it rings normally and goes to voicemail but my phone doesn't ring.  Also I can currently only text or receive texts from 2 people.

    Old phone is off and number is fully ported?  SIM card new and installed/seated properly?  All Apple credentials disabled if coming from iPhone?

Maybe you are looking for

  • How can I dinamically alter the position of an outputText?

    I�ve got an outputText (outputText1) that�s bind to a database, sometimes I have got two lines on it and others two pages. My problem is that I need to show another outputText right under the outputText1. How can I do this? Thanks for any help. Marlo

  • BBP_GET_STATUS_2 only works when entering SC number

    Hi all. SRM 4.0. I am seeing some strange behaviours in my system these days. The job BBP_GET_STATUS_2 is set up in batch to run every 5 minutes, but now I am seeing issues where the documents are not properly updated in SRM. The case is that in the

  • Got iDVD error: hardware error Help! What does it mean?

    Thanks in advance. I was trying to burn a disc, and started having trouble with burning this movie (have done several before, including earlier versions of this movie). After wierd things happening twice - the first disc would burn, then the second o

  • Output determination for pipeline/ Consignment settlement

    Dear friends,     I am not able to configure the message determination for the output type KONS for the pipeline settlement. Could anybody guide me what config needs to be done for this? Senthil

  • Blank CC desktop app

    I want to update LR and can't.  When I bring up my Adobe CC desktop app it is blank.  I have unnistalled/installed it twice with thte same result. And yes, I am current with my payments.