Issue parsing powershell output

vdeshpande
Kilo Explorer

I am working on a Exchange integration using Orchestration. we have a custom powershell script

Output is showing as below

WARNING: The names of some imported commands from the module 'Exchange' include

unapproved verbs that might make them less discoverable. To find the commands

with unapproved verbs, run the Import-Module command again with the Verbose

parameter. For a list of approved verbs, type Get-Verb.

Deshpande, Amruta

1.   - How do I get rid of the WARNING message

2. How do I parse only last line ignoring warning message

Thank you

1 ACCEPTED SOLUTION

Hi Varsha,


If you are importing exchange module, then your synyax would be


import-module -moduleName           - DisableNameChecking


View solution in original post

6 REPLIES 6

Deepak Ingale1
Mega Sage

Hi Varsha,



You can suppress the warning method by using below powershell command.



Import-Module -DisableNameChecking



This command will hide the warning message being displayed


Hello Deepak,



Thank you for the response.


Where exactly I need to include this import statement in powershell script


1. In the beginning of the script ?


or


2. Use it in command we are executing ?


I included in the beginning of script and it is throwing below error


*** Cannot process command because of one or more missing mandatory parameters


If you can share some sample commands , that will be helpful



Thanks


Varsha


You do it at the start of your script.



For instance, I import the Active Directory module like this:



if (-not(Get-Module -Name 'ActiveDirectory')) {


  Import-Module ActiveDirectory


}



That tests if the module is loaded and if not, load it.



You can parse your output like this:



In the Sensor script of your powreshell activity place something like this: workflow.scratchpad.results = activity.output;



Now it's stored in a scratchpad and you can parse it with javascript.



i.e. look for an error:'


if (workflow.scratchpad.results.indexOf("** ERROR: Unable to retrieve user") > 0) {


// error...


Hi Varsha,


If you are importing exchange module, then your synyax would be


import-module -moduleName           - DisableNameChecking