Introduction to Using the PowerShell Command Line with DB2 on Windows

You may also like...

6 Responses

  1. Andres Gomez says:

    Very interesting article. I know it is not easy to get into PowerShell. I started a year ago by creating scripts in PowerShell to install my programs. I wanted to share them with you:


    • sabndeep says:

      Nice one Andres,I am new to powershell and to DB2.And have been assign to write a powershell script to install DB2 client in WIN& machine.Can you help me on this.

  2. Samuel Pizarro says:

    Hi Ember
    Nice article.

    Trying to use the powershell session, but facing issue with db2pd command.

    Or the output is empty for some parameters, or it complains that the database is not ACTIVE.
    But both instance and DB are active and running, and same commands works on regular DB2CLP window.

    Windows 2008 and/or 2012, and win-7
    Db2 10.5
    Any ideas ?

  3. Dejan says:

    Hi Ember!

    Thanks a lot! It worked fine here.

    BTW … You mentioned you would like to have
    ls -lart

    on WIN?
    How about tar bzip2 gzip dd diff du egrep fgrep head tail less pwd wc touch …?

    I don’t use PowerShell. So, this HowTo works for CMD
    Feel free to adapt it for PowerShell and please give me a hint in this case!
    Otherwise just run CMD!

    1. Visit
    2. Download Unix_Utils and feed your USB pen drive with Unix Utils – it’s just a ZIP Archive. There’s no need to install anything.
    3. In a WIN environment – just UNZIP or COPY Unix Utils into an arbitrary directory
    4. Normally, you should be allowed to change %PATH% … so just add the directory \UnxUtils\usr\local\wbin to %PATH%
    5. Finally … try
    ls -latr | grep [:digit:]

    Should you NOT be allowed to change %PATH% … Then:
    set UU=\UnxUtils\usr\local\wbin to %PATH%
    %UU%\ls -latr | %UU%\grep [:digit:]

    Have fun!

  1. August 18, 2015

    […] “command line environment not set up”.   There are several good posts on the internet on how to set up the db2 command line environment in PowerShell, and how to make the changes stick in the user profile so that they do not have to be re-done every […]

Leave a Reply

Your email address will not be published. Required fields are marked *