cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to run "im createissue" in MS PowerShell-Script ?

sklemm
5-Regular Member

How to run "im createissue" in MS PowerShell-Script ?


Hi,

I would like to know how to run Integrity-Command "im createissue" in Microsoft PowerShell-Scripts.

For example via the PowerShell-Command "Start-Process" and using "Here-Strings" for the arguments.

So far I had no success with my tests, see used code at the end of this message.

Do you have any code examples or recommendation ?

Best Regards

Stephan

Used code for testing:

Start-Process im createissue -argument @"

--hostname=integrity

--port=xxxx

--user=xxxx

--type="xxxx"

--field="xxxx"

--gui

"@ -NoNewWindow -Wait

1 ACCEPTED SOLUTION

Accepted Solutions

Here is a good first thing to do:

    im.exe issues '--query=Quick Query' '--fields=ID,Type,Summary'

The apostrophes are not strictly necessary for all parameters, but in the above example, the query has a space that needs quoting, and the field list has commas.

Every user has a quick query so you know that will work, and ID,Type,Summary are built-in fields.  Now you are off to a start.

You can capture the value of any field into a variable, once you have the id, like this.

   $summary = im.exe issues --fields=Summary $issueid

You can iterate a list of output like this:

   im.exe issues '--query=Quick Query' --fields=ID | foreach { do something in here and use $_ as the id }

View solution in original post

5 REPLIES 5
KaelLizak
14-Alexandrite
(To:sklemm)

Hello Stephan Klemm‌,

It looks like within the script you should probably use Invoke-Expression instead of Start-Process, like this:

invoke-expression "& `"$FullPathToIntegrityClientInstallDirectory\bin\im.exe`" createissue --hostname=integrity --port=xxxx --type=`"xxxx`" --field=`"xxxx=value`" --gui" where $FullPathToIntegrityClientInstallDirectory is a variable containing the path to the client install location, or is replaced with the actual full path to the client install directory.

I hope that helps.

Regards,
Kael

References:


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager

Here is a good first thing to do:

    im.exe issues '--query=Quick Query' '--fields=ID,Type,Summary'

The apostrophes are not strictly necessary for all parameters, but in the above example, the query has a space that needs quoting, and the field list has commas.

Every user has a quick query so you know that will work, and ID,Type,Summary are built-in fields.  Now you are off to a start.

You can capture the value of any field into a variable, once you have the id, like this.

   $summary = im.exe issues --fields=Summary $issueid

You can iterate a list of output like this:

   im.exe issues '--query=Quick Query' --fields=ID | foreach { do something in here and use $_ as the id }

I include .exe always because it avoids powershell aliases

If you really really want to start a new thread you can do so by putting the above examples into arrays of strings and feeding them to invoke-command as Kael suggested and put _that_ within a start-process.

oh, and of course you can use any command like createissue or editissue in similar ways to what is shown above.

Top Tags