Cannot run AutoIT script as a program in Microsoft System Center
Posted on 2014-08-22
We are running Microsoft System Center 2007. We have the CCM agent installed on our machines and they have UAC enabled. We run MSIs with no problem on machines frequently using the CCM agent, we also run Shell commands on machines frequently with no issues using the "ShellExecuteWait" function.
I am trying to run a simple AutoIT script to remove some directories and files from a machine. If I run this script on my own machine using a Local Administrator account it works perfectly. If I set it up as a program in SCCM and advertise it to a machine it works up to the point of execution and then hangs.
There doesn't seem to be any problem on SCCM:
The package is copied to the remote machine
CCMexec.exe runs the script
The script "sticks" on execution and never finishes... you can see it running as System in task manager.
Why does this work on my machine using a Local Admin, but when I run it under the LSA account using CCMexec.exe it fails? I think it may have something to do with the LSA not having a registry hive. I've ran processexplorer on the hung process and it seems to indicate its waiting for user input as the process state displays "state:wrUserRequest".
The script is below:
#$ProgramPath="c:\Program Files (x86)\Program\Version1"
#IF FileExists ($ProcommPath) Then
# DirRemove ( "c:\Program Files (x86)\Program\Version1", 1)
# DirRemove ( "c:\Program Files (x86)\Program", 1)
Please don't respond with "why don't you do it using a MSI, or powershell script or ShellExecuteWait" or using some other function. We know how to make this work using other methods. We want to know why this won't work, or what we are doing wrong that is keeping it from working.