Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to load NI DAQ MX in Powershell?

(I hope this is the right forum to ask this question.)

 

I wish to load the NI DAQmx feature set in Microsoft Powershell. I am on Windows 7. I cannot find any samples show to do this.

 

I believe I have everything installed. I also have some Excel files that load NIDAQmx.tlb and properly run the device attached to me PC. The Excel files have VBA code (written by someone else) that inject current and voltage to an attached device. Excel's VBA project references load C:\Windows\SysWOW64\NIDAQmx.tlb (and also C:\Program Files (x86)\NationalInstruments\Shared\TDM Excel Add-In\ExcelTDM.dll).

 

Since the Excel files run properly, I assume I have everything installed I might need to use NIDAQ MX in Powershell. However I am stymied how proceed. I would like to replace what the Excel file plus is VBA code do and do it in Powershell code.

 

Any advice or samples how to get NI DAQ MX features loaded in Powershell would be of great benefit.

 

Thanks

Joe

0 Kudos
Message 1 of 5
(5,216 Views)

@joespr wrote:

(I hope this is the right forum to ask this question.)

 

I wish to load the NI DAQmx feature set in Microsoft Powershell. I am on Windows 7. I cannot find any samples show to do this.

 

I believe I have everything installed. I also have some Excel files that load NIDAQmx.tlb and properly run the device attached to me PC. The Excel files have VBA code (written by someone else) that inject current and voltage to an attached device. Excel's VBA project references load C:\Windows\SysWOW64\NIDAQmx.tlb (and also C:\Program Files (x86)\NationalInstruments\Shared\TDM Excel Add-In\ExcelTDM.dll).

 

Since the Excel files run properly, I assume I have everything installed I might need to use NIDAQ MX in Powershell. However I am stymied how proceed. I would like to replace what the Excel file plus is VBA code do and do it in Powershell code.

 

Any advice or samples how to get NI DAQ MX features loaded in Powershell would be of great benefit.

 

Thanks

Joe


How is this question in any way related to Measurement Studio for .NET ?

0 Kudos
Message 2 of 5
(5,194 Views)
Hi Joe,

I've done a bit of searching, and at first glance it seems you should be able to load .NET assemblies using power shell. What have you tried so far? Are you running into any specific errors? Is there a particular reason you are constrained to using power shell to do your NI-DAQmx communication?

Thanks,
Daniel Dorroh
National Instruments
0 Kudos
Message 3 of 5
(5,183 Views)

Thanks for the replies.

 

I didn't know where to post the original questions which is why I guessed here might be good.

>>How is this question in any way related to Measurement Studio for .NET ?

So if there is a better place, let me know and I will move it.

 

I would like write Powershell scripts that run the NI DAQ MX functionality using Powershell (so I am running from the command line) to minimize (or eliminate) use of a UI.

 

I'm at a loss how to get started with Powershell and NI DAQ MX. I know, for example, if one is writing an application in in C this situation, the first thing one does in the code is load NIDAQMX.LIB and also one includes NIDAQMX.H. Well, the .H file is inappropriate in Powershell for sure. And loading .LIB files does not go well. So, what to do, since there is no NIDAQMX.DLL ?

 

I mentioned the Excel file with macros that I obtained which loads NIDAQMX.TLB. Loading the objects in a TLB file Powershell is possible, the TLB needs to be "registered". I was able to register NIDAQMX.TLB (after installing WIndows Update KB2640696). However, even after registring I could not load its objects.

 

So I am looking for a sample from someone who might have gotten this to work.

 

Thanks for your help or any advice.

Joe

0 Kudos
Message 4 of 5
(5,152 Views)

@joespr wrote:

Thanks for the replies.

 

I didn't know where to post the original questions which is why I guessed here might be good.

>>How is this question in any way related to Measurement Studio for .NET ?

So if there is a better place, let me know and I will move it.

 


Here's an idea. How about asking at a PowerShell forum?

 

 

0 Kudos
Message 5 of 5
(5,141 Views)