Script only works with its creator !?!

Hello,

I’ve to test a PS script using an API (bastion software) but it works only when launched by its creator !?!

For the moment, the user “admin” and the API key are set in the script.
The Windows user I use to test is in the same AD groups and application groups as the author of the script.

What could be the problem ?
How can I troubleshoot this issue ?
It seems to be a profile problem but how can I check that ?
(it is quite strange because users are created by automatic or very well defined processes)

Regards,

Steve.

Hi, welcome to the forum :wave:

Is the API key hardcoded in the script, or is it set by reading an encrypted standard string from disk? If it’s the latter, it can be decrypted only by the user that created it, on the machine it was created on.

If it’s not that, then you’ll need to provide more detail such as what’s not working, what error messages you’re getting and, ideally, a copy of the script with any sensitive information replaced.

If you do post code or errors, please ensure your post is formatted correctly:

How to format code on PowerShell.org

2 Likes

Not knowing the specifics of the error, I would say is it potentially could be the execution policy blocking the script from running?
Execution Policy

Hello,

The developer has found the cause of the prob. by performing a JSON transformation then a “print” at the level of the “try … catch” to have maximum details at the time of the error.

Detailed message obtained:
“The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer’s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.”

Unbelievable ! An adherence to IE on a W2019 server!!!

Solution:
Launch IE the first time and check “Don’t use recommended settings”. :slight_smile:

It was therefore a problem of setting IE for the user executing the script!

Well, I hope this wil help others because it took our minds for a while.

Steve.

Not surprised. M$ is still deploying slmgr.vbs for Windows licensing.

Depending on what’s invoking the webrequest/API you may be able to control whether it cares about IE first run. Invoke-webrequest and invoke-restmethod on windows powershell offer a “usebasicparsing” parameter which doesn’t require IE engine.

1 Like