What is the pattern operation to execute powershell command in cmd?

Akshatha Ballal
Tera Expert

Hi,

We are customizing the certificate discovery for our client. "Get-ChildItem -path  Cert:\CurrentUser\Root | select *" is the command we're making use of in the pattern to get the certificate details. We are using powershell.exe in cmd to execute this. But we are having trouble including this whole line. We are only able to include till Root and get the output.

find_real_file.png

If we include " | select *" we are getting the error "'select is not recognized as an internal or external command,
operable program or batch file." How do I execute this command in the pattern step? 

find_real_file.png

 

Regards,

Akshatha

1 ACCEPTED SOLUTION

Akshatha Ballal
Tera Expert

Answering my own question, the solution is to escape the pipe operator by using ^|

The command is failing because the pipe | is being interpreted by the cmd shell and not by PowerShell as explained here

 

View solution in original post

2 REPLIES 2

Akshatha Ballal
Tera Expert

Answering my own question, the solution is to escape the pipe operator by using ^|

The command is failing because the pipe | is being interpreted by the cmd shell and not by PowerShell as explained here

 

Rinku1
Tera Contributor

Hi @Akshatha Ballal,

 

I also have a similar requirement from user, Is there any particular format to insert PowerShell command inside set command details? Getting error while doing so.

 

Thanks