I am attempting to import a GPO using Kaseya.  The script itself is a sample script from Microsoft called: 'ImportGPO.wsf'.  Contents of the script, I believe, are irrelevant to this issue.

The specific command I'm running from Kaseya is:  

cscript C:\MyFolder\GPO\ImportGPO.wsf C:\MyFolder\GPO gpoName gpoName /CreateIfNeeded

Details:

1. If I run this manually (outside of Kaseya and in an elevated command prompt), it works great.

2. If I run this with Kaseya as SYSTEM, it fails with Access Denied (expected as GPO changes require domain authentication).

3. If I run this with Kaseya as USER after using impersonateUser, it fails with the Library not registered error.

4. If I run this with Kaseya as USER after using impersonateUser and script elevated command prompt as part of the procedure, it fails with the Library not registered error.

5. I am only getting this error on ONE server out of many.  It's an SBS 2008, but that does not make it unique in my many environments.

My original theory was that this is a UAC issue.  But I believe I have successfully scripted an elevation that should bypass it.  Also, the errors are completely different.  Tonight I will disable UAC and reboot on this server - but I am not expecting that to resolve the issue.

Since it's only this one server, I could just update this one manually and move on... but I want to future proof my script and not risk further failures.

Anyone have ideas on what might be causing the issue?  Google searching only tells me to install things and register DLLs, but that should not be relevant since the functionality is present when I run the script outside of Kaseya. 

Thank you for any help!

Arthur



Updated #4 with complete information.
[edited by: ApexArthur at 12:04 PM (GMT -8) on Jan 9, 2017]