Jan 22 2021 02:52 AM
Hi,
I am facing problems executing some powershell scripts from a Windows Service.
Background
The Windows Service (started with an AD user) will execute a command through Process Class.
It will launch a command like in the folder that we specify:
Issue
Some of the powershell modules are not "available" to be imported, although they are available in the folder "C:\Program Files\WindowsPowerShell\Modules". E.g.:
If we run the same command from a Command Prompt the script executes correctly!
Workaround
Run the following command:
Thanks in advance,
Tiago R.
Jan 22 2021 10:29 AM
Is this user running this service is an admin, maybe this user doesn't have the proper permission to load the module from that directory,
Try to include the Import-Module XXXXX in your script and execute it.
what is the output? are you getting any errors when Import-module is executed?
Jan 23 2021 05:41 AM
Jan 23 2021 11:43 AM
Solution