Run script on multiple servers & export to txt file

Welcome Forums General PowerShell Q&A Run script on multiple servers & export to txt file

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 5 months ago.

  • Author
  • #5795

    Topics: 1562
    Replies: 0
    Points: 0
    Rank: Member

    by JoeM at 2013-04-11 08:40:07


    Sorry for my first post being a question, normally hate to do this.
    Im Joe, from the UK & have been in various IT roles for the past 14 years.

    I have been asked to write a script to report back the TSM backup include/exclude list for some of our servers.
    The problem I have is, I havent done any scripting in powershell before. Im trying to learn it from a book/online at the moment, but it's a bit like reading another language to me. I did try something that I wrote but I killed the test server so I thought I should maybe ask for some help before I brake something important.

    I can manually run the stuff in CMD on each server but thats not an option when it could need to be done on 300+ of them.

    This is what I have to do at the moment

    cd c:program files\tivoli\TSM\baclient
    dsmc q inclexcl > c:\export.txt
    Press Enter
    Type Password & press enter

    The above process will give me a text file called export with the include/export list on the C: of the server.

    So what I would like to do, is run this script from my pc, and get back an export txt file for each server.
    If it's possible, it would be great if the txt file that was called the server name & saved to my pc's hard drive, so they are all in one place.

    Can anyone help me, if it's not possible to do the above – thats fine at least it saves me from wasting anymore time on it.

    Thanks in advance for any help

    by DonJ at 2013-04-11 08:43:27

    Do the servers have PowerShell Remoting enabled?

    by JoeM at 2013-04-11 09:00:16

    I am lead to believe that they are.

    by DonJ at 2013-04-11 09:05:26

    Then, you can probably put that into a script file and send it via Invoke-Command. It'll multiprocess 32 at a time. But it can't press Enter and type a password – it doesn't work that way. If those interactive bits are not avoidable, PowerShell is likely not the right tool for the job.

    by JoeM at 2013-04-11 09:37:10

    Ahh thank you, it doesnt look like there is a way arround it.
    You have saved me an awful lot of time, thanks again 🙂

The topic ‘Run script on multiple servers & export to txt file’ is closed to new replies.