?
Solved

Powershell ISE and send commands to command line interface

Posted on 2014-04-02
5
Medium Priority
?
634 Views
Last Modified: 2014-05-06
Hello EE,

I wish to send commands to an interactive command line interface. It works ok in a regular powershell.exe console , but not when i try to use the invoke-command as below , it interprets the "display" as a powershell command , in reality , I am still inside the runmqsc command  interface.

This works:
P:\>runmqsc INTYUL2
5724-B41 (C) Copyright IBM Corp. 1994, 2002.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager INTYUL2.


display ql(INTYUL2.CLIENTSET3.DCS.JUNK) CURDEPTH
     1 : display ql(INTYUL2.CLIENTSET3.DCS.JUNK) CURDEPTH
AMQ8409: Display Queue details.
   QUEUE(INTYUL2.CLIENTSET3.DCS.JUNK)      CURDEPTH(0)
end
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

Open in new window


This does not from ISE:

invoke-command -computer iasapp204 -scriptblock {

runmqsc INTYUL2 
Start-sleep -s 5
display ql(INTYUL2.CLIENTSET3.DCS.JUNK) CURDEPTH

}

Open in new window

0
Comment
Question by:davesnb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39972579
what if you give the full path of display in the code?

do you have display installed on remote computer iasapp204 ?
(for that to work, display should be existing on the remote machine)
0
 

Author Comment

by:davesnb
ID: 39972594
Sorry, in the first working example, the commands are issued from powershell locally on iasapp204. So to answer your question , yes it is installed and working locally.
0
 

Author Comment

by:davesnb
ID: 39972787
display is not an exe it is part of the runmqsc
0
 
LVL 4

Accepted Solution

by:
rastoi earned 1500 total points
ID: 39972861
then you need to pass it like paremeter or script to runmqsc not like powershell command.
The way you wrote it - for the section in brackets is each line considered to be powershell command.
Here
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=%2Fcom.ibm.mq.amqzag.doc%2Ffa15950_.htm
in option 3 . is syntax, how to pass "script" input/output
0
 

Author Closing Comment

by:davesnb
ID: 40044289
Thanks for the clarification
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

764 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