Forum Discussion
tarente
Jan 22, 2021Copper Contributor
Powershell issues running script from Windows Service 01/02 - powershell modules not available
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 wil...
- Jan 23, 2021Solved!
The problem was that powershell was executing in 32-bits thru the service and in 64-bits when launched from the command prompt.
I copied the code in described in https://stackoverflow.com/questions/19055924/how-to-launch-64-bit-powershell-from-32-bit-cmd-exe to the beginning of the script and now works as expected.
tarente
Copper Contributor
The user running the service is an administrator in the server.
If I connect to the server thru Remote Desktop and execute the command in a Command Prompt the script executes successfully.
I think the problem is that executing the command from the service's scope the complete profile of the user is not loaded. Is there a way to force loading the full profile of the user before running the script?
Thanks.
If I connect to the server thru Remote Desktop and execute the command in a Command Prompt the script executes successfully.
I think the problem is that executing the command from the service's scope the complete profile of the user is not loaded. Is there a way to force loading the full profile of the user before running the script?
Thanks.
tarente
Jan 23, 2021Copper Contributor
Solved!
The problem was that powershell was executing in 32-bits thru the service and in 64-bits when launched from the command prompt.
I copied the code in described in https://stackoverflow.com/questions/19055924/how-to-launch-64-bit-powershell-from-32-bit-cmd-exe to the beginning of the script and now works as expected.
The problem was that powershell was executing in 32-bits thru the service and in 64-bits when launched from the command prompt.
I copied the code in described in https://stackoverflow.com/questions/19055924/how-to-launch-64-bit-powershell-from-32-bit-cmd-exe to the beginning of the script and now works as expected.