Powershell Doesnot work

Hello,

I’m trying the powershell tool in the easymorph with exact script as in the example.
https://easymorph.com/learn/powershell.html
But nothing happens after running.
powershell
I have powershell 64 bit installed.
but the same command in powershell works fine.
Any help would be appreciated.

Thanks,
Sujith.

Hello Sujith,

what PowerShell version is installed on your computer?
Do you see any error messages?
What version of EasyMorph are you using?

Hi Dimitry,

  1. PS version:
    powershell
  2. No error messages
  3. 3.8.1.0

Update EasyMorph to the most recent version please, and try again.

Hi Dimitry,

There was no issue or error, but when I do the calculate option it was not showing the output on the client. But when i did an export to csv of the output, I got the results.
Do you know why, the output wont show when i do calculate option. I’m facing this from a long time for all the easymorph files I’ve created.

On another note, The output of the powershell command will only be Distinguishedname and errors? Can I not output the properties I select.
E.g:
If I run this command and export the output, in the file i can see only 2 columns (output,errors). Is there a way where I can get all the properties selected?
get-aduser -filter * -properties cn,name,SID,samaccountname

I'm not sure I understand you. What do you mean by the "client" here? What did you export to csv? How is that export connected to PowerShell?

I see that the table is collapsed. Did you try to expand it in order to show the datagrid?

image

At this point, EasyMorph only captures one text value per line of output. It means that if you want to capture several values per line from PowerShell, you will need to use PowerShell syntax to generate output as a string of delimited values (e.g. "North America, Canada, Toronto") and then use the "Split delimited values" action in EasyMorph in order split a column with delimited values into several columns.

Thanks Dimitry. I will use the workaround mentioned.

You’re welcome!

Hi Dmitry,

I also have a question.

I used a powershell action that gets urls from a webpage. It works fine on the Desktop. However, when I try to run it on the server it does not seem to work. I have tested this by exporting the list of retreived urls to a file. On the desktop I get a value but on the server, the file is empty.

Any Idea what would be the cause of this ?

Server version: 3.9.5.1
Desktop version: 3.9.5.3

It’s hard to say. At least make sure that PowerShell versions on Desktop and Server are the same.

Ok we shall try the update. Question: Does the powershell action refers to the powershell executable in the background ?

Could it be that it is installed at another location on our server and that it therefore does not work or doesn’t it matter where that executable is installed?

Hi Nikolaas,

The “PowerShell” action doesn’t refer to powershell executable.

Can you please store the whole dataset, returned by the “PowerShell” action on the EasyMorph server, and then check if it contains any errors?

Hi Andrew,

Don’t know if I am understanding your suggestion. I only use the powershell action to list URLs from a webpage as suggested in the other post . To test if the powershell action worked on the server, I exported the retreived urls to a file. I use relative paths so normally it should work on the server.
So it is our powershell action that is not working but we will retest when we have updated our server. Maybe that is the problem…

I shall report back when I have tested that.

Kind regards

Hi Nikolaas,

I don’t think that updating EasyMorph Server will make any difference - there were no significant changes in the “PowerShell” action since version 3.8.0. Dmitry meant the version of the PowerShell itself, not the version of EasyMorph Desktop and Server.

As for my previous suggestion. Please make sure that “Errors” column, returned by the “PowerShell” action, is also exported to a file. It’s possible that “Errors” column contains some errors which will tell us why your PowerShell script is not working on the server.

In any case, the most likely reason for this issue is Invoke-WebRequest cmdlet. It seems that it uses the Internet Explorer engine for parsing websites. And some of the security restrictions don’t allow EasyMorph Server to access Internet Explorer engine because EM Server by default works as a local Windows service.

Please try to run Invoke-WebRequest cmdlet with the -UseBasicParsing option. This way the cmdlet should not use Internet Explorer engine for parsing. As a downside, it will only give you a webpage as a plain text. So you’ll have to extract links from it with our own code.

The UseBasicParsing option seems to do the trick. thanks !