| Author | 
		  Message
		 | 
		
		  | abinaya | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 12:42 am Post subject: How to execute mqsi commands from Powershell | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 20 Jun 2017 Posts: 17
  
  | 
		  
		    
			  
				Hi All
 
 
I have IIB Version 10.0.0.8 in windows environment and I want to  execute mqsi commands in powershell . After executing mqsiprofile in powershell I am getting error as "The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product." whenever I try to run any other mqsi command.
 
 
But the same steps works for a normal command prompt environment. Any assistance is appreciated., and thanks in advance.
 
 
 
Windows PowerShell
 
Copyright (C) Microsoft Corporation. All rights reserved.
 
 
 
PS C:\Program Files\IBM\IIB\10.0.0.8\server\bin> . .\mqsiprofile
 
 
MQSI 10.0.0.8
 
C:\Program Files\IBM\IIB\10.0.0.8\server
 
 
PS C:\Program Files\IBM\IIB\10.0.0.8\server\bin> . .\mqsilist
 
The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product.
 
PS C:\Program Files\IBM\IIB\10.0.0.8\server\bin> | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 2:47 am Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				for the environment variables to stick, I believe you'll have to run mqsiprofile before you run powershell. Powershell treats the environment differently from the normal command line, and you'd have to assign the values using $env:name=value for the variable to stick in the powershell session...
 
 
Have fun   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | abinaya | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 3:22 am Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 20 Jun 2017 Posts: 17
  
  | 
		  
		    
			  
				Hi 
 
Thanks for your reply . I tried setting the environment variable path to the folder where mqsiprofile is there in a powershell script . 
 
 
Setting environment variable path
 
Set location -path “mqsiprofile.cmd location”
 
.\mqsiprofile
 
.\mqsilist 
 
 
Wrapped these in a script and tried to invoke the script from powershell ., but the behaviour is same . Getting the same error text | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 8:16 pm Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
   
	| abinaya wrote: | 
   
  
	Hi 
 
Thanks for your reply . I tried setting the environment variable path to the folder where mqsiprofile is there in a powershell script . 
 
 
Setting environment variable path
 
Set location -path “mqsiprofile.cmd location”
 
.\mqsiprofile
 
.\mqsilist 
 
 
Wrapped these in a script and tried to invoke the script from powershell ., but the behaviour is same . Getting the same error text | 
   
 
 
You need to source mqsiprofile before you run powershell...   _________________ MQ & Broker admin | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | abinaya | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 10:03 pm Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 20 Jun 2017 Posts: 17
  
  | 
		  
		    
			  
				Hi 
 
 
can you please elaborate what you mean by "source mqsiprofile" ?
 
 
$BROKER_HOME = "C:\Program Files\IBM\IIB\10.0.0.8\server\bin"
 
$env:PATH =$env:PATH + $BROKER_HOME 
 
Set-Location -Path 'C:\Program Files\IBM\IIB\10.0.0.8\server\bin'
 
.\mqsiprofile
 
.\mqsilist
 
 
I have this in a script and on execution i get error as The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | abinaya | 
		  
		    
			  
				 Posted: Tue Jun 19, 2018 10:13 pm Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 20 Jun 2017 Posts: 17
  
  | 
		  
		    
			  
				I tried this too :
 
 
$BROKER_HOME = "C:\Program Files\IBM\IIB\10.0.0.8\server\bin"
 
$env:PATH =$env:PATH + $BROKER_HOME 
 
mqsiprofile
 
mqsilist
 
 
Powershell screen :
 
 
PS C:\Users\xxx> ."D:\Scripts\Maintenance\test.ps1"
 
 
MQSI 10.0.0.8
 
C:\Program Files\IBM\IIB\10.0.0.8\server
 
 
The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product.
 
PS C:\Users\xxx>
 
 
mqsiprofile is getting set but its not retained . that is my understanding from the error . How to retain the mqsiprofile | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |