Posted on 2014-08-27
Last Modified: 2014-08-27
Is there any command I can use in my PSexec scripts to get it to record what it installed?  I used PSExec to install some software with a list of PC's.  I'm wanting to know basically if I can record what scrolls on the command screen to a txt file so I know what has installed and what has failed?
Question by:WellingtonIS
    LVL 23

    Expert Comment


    Yes you can. At the end of the command just type in > d:\Myfolder\log.txt (where you can add any path you would like to offcourse) this PIPE's all to a text file.

    Author Comment

    ok I have 3 commands in this particular bat file.  Does it matter which one or is it only going to record what command I add it to?  

    Here's the command for example...
    Psexec \\@%var% -u xx\xxx -p xxx cmd /c copy "\\sss\sss\WRM_ssoCA.cer" c:\
    psexec \\@%var% -u xxx\xxx -p xxx cmd /c copy "\\sss\sss\certmgr.exe" c:\

    psexec \\@%var% cmd /c c:\certmgr.exe -add -all c:\WRM_ssoCA.cer -s -r localmachine root

    psexec \\@%var% -s cmd /c del "c:\WRM_ssoCA.cer"
    psexec \\@%var% -s cmd /c del "c:\certmgr.exe"
    LVL 23

    Accepted Solution

    Add it after every command line you execute. Do keep in mind that using 1 > is overwriting the file (so don't add the same log file after every line with a single >, the last one will overwrite the one before which will overwrite the one before..

    If you want to add them all to one file use 2 >>'s. So your command file would be below. All appended into one text file.

    Psexec \\@%var% -u xx\xxx -p xxx cmd /c copy "\\sss\sss\WRM_ssoCA.cer" c:\ >> D:\Logfile.txt
    psexec \\@%var% -u xxx\xxx -p xxx cmd /c copy "\\sss\sss\certmgr.exe" c:\ >> D:\Logfile.txt

    psexec \\@%var% cmd /c c:\certmgr.exe -add -all c:\WRM_ssoCA.cer -s -r localmachine root >> D:\Logfile.txt

    psexec \\@%var% -s cmd /c del "c:\WRM_ssoCA.cer" >> D:\Logfile.txt
    psexec \\@%var% -s cmd /c del "c:\certmgr.exe" >> D:\Logfile.txt

    Author Closing Comment


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
    I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now