Sign in to follow this  
Followers 0
RBrown1375

AutoIt and SCCM

24 posts in this topic

Is there anything special you have to do to make an AutoIT .exe run with SCCM? The package works fine if I right click and run it as Admin from the SCCM cache folder. I can get SCCM to deleiver the package to the system, but it just won't run the app. I have the AutoIT .exe in the "command line" of SCCM package settings and I selected "Run as Admin" in the setup portion of the package in SCCM and I made sure there are no spaces in the name of the app, but it just won't run when it hit the desktop from the SCCM cache folder. It's happening the same on Windows XP and 7.

Thank You for any ideas!

Share this post


Link to post
Share on other sites



RBrown1375,

This question had nothing at all to do with the one in your previous thread where you initially posted it. Much better to start a new thread in that case rather than add it to the old thread. :bye:

I have done it for you this time - please do it yourself in future. :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, RBrown1375. I am working with a customer right now that is on SCCM2007, and have no problem running a couple dozen different AutoIT packages. If you would like to post your code, or a reproducer, we can take a look to see if we can assist :oops:


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#include <Array.au3>
#include "RecFileListToArray.au3"
PST()
Func PST()
    Local $aArray, $aDrives = DriveGetDrive("FIXED") ; Read the Help file about DriveGetDrive.
    If @error = 0 Then
        For $i = 1 To $aDrives[0]
            $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2)
            If @error Then
                ContinueLoop
            EndIf
            For $j = 1 To $aArray[0]
                ;ConsoleWrite("FileDelete(" & $aArray[$j] & ")" & @CRLF)
    FileDelete($aArray[$j])
            Next
        Next
EndIf
EndFunc   ;==>PST

Here is my code. I can get the package to the machine, but it just won't execute? I does need to run in Admin mode and I have that set as well in the SCCM package settings. I have looked over JLogan3o13 posts on the same topic and made a change to give the users access but nothing changed.

Thank You!

Also, Melba23, thanks for starting a new thread.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

To begin with, can you let me know your SCCM settings: Mandatory collection? Pushing to XP/Win7 or both? etc.? I'll try to duplicate the package and let you know what I find.

Edit:

I implemented your code, unchanged, and it seems to work as expected. I have it set up as a Mandatory assignment, configured to run only when the user is logged in, with Admin Rights, allow Users to interact with the program. It works for me on both XP and Win 7.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I built a test group of three systems. 1 Windows XP, 1 Windows 7x32 and 1 Windows 7 x64 and all three are a VM running with VM player on a Windows 7x64 desktop. My Settings are:

  • Access Accounts have full control
  • I have my main server as the distribution point
  • In my source folder on my distribution point, I have the AutoIT package in a folder called "Source Files".
  • The command line is the DeleteTWPst.exe file
  • Run hidden
  • Requirements are any platform
  • Environment is When user is logged on, run as admin, allow users to interact and Runs with UNC Name
  • Advanced Run once for every user who logs and I just saw this......Disable this program on computers where it is advertised is checked - Smoking gun?
Under Advertisements
  • Program is my PST removal program from above and collection is my test collection
  • Schedule: has been as soon as possible and I set a start and stop.
  • Distribution points Download content run locally, allow clients to fall back.....

I'm going to run a test with that one setting above removed and I'll let you know what happens.

Thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Maybe I'm doing some thing wrong. How do you set it to mandatory assignment?

I have the program set to priority high.

Edited by RBrown1375

Share this post


Link to post
Share on other sites

In the SCCM console, go to Software Distribution, then Advertisements, and find your Program. Right click and go to Properties, then the Schedule tab. In the middle of the tab is a box with the label Mandatory assignments, click the yellow "starburst" icon, and choose Assign immediately, and As soon as possible from the drop down menu.

To answer your other question, if Disable on computers where it is advertised is checked, it will definitely not run.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I had the mandatory correct, but I did uncheck the Disable and am testing now. Thanks Again. I just can't figure out why it won't kick off. Take care.

Share this post


Link to post
Share on other sites

One last question about this. I have been testing this all day and I can deliver the AutoIT.exe but it won't run. Have you ever heard of an AD or SCCM policy that might inhibit this from executing? I'm using Admin rights on everything and it won't kick off. If I run it by hand after SCCM delivers the package, it runs fine????

Thanks

Share this post


Link to post
Share on other sites

Hi, RBrown1375. As mentioned yesterday, your script works fine through SCCM for me, set to mandatory delivery. I know it is a pain, but you may want to delete the entire package, as well as the associated advertisement, and recreate it from scratch.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Trying that now. Cheers

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

How can I build in Administrative rights into my package? SCCM is not doing it and the package runs but not as the Admin and it fails to delete the files. I have had the same problem on XP and Win 7. I went into my script added #RequireAdmin, but that didn't help.

I added the following code to my script:

Local $sUserName = "Administrator"

Local $sPassword = "SomePassword"

RunAs($sUserName, @ComputerName, $sPassword, 0, @SystemDir)

This did work on my machine without a right click and run as but the script wouldn't close and I got a flashing red X even though it worked?

Edited by RBrown1375

Share this post


Link to post
Share on other sites

I can't beleive this but I'm running into the same issue with this AutoIT script, where the script runs fine if I right click and run as admin on the client Win 7 system, but if I install it with SCCM, the package gets deleiver and runs but doesn't work. It copies the 2 BMP's to the corect location but will not write to the registry like it does if I run it by hand. I have SCCM set to run as Admin, user is logged (tried it with user logged off) manditory, Access Accounts are the highest and as you'll see in the code I have it set to run with Admin rights. I also went in to the registry and killed the UAC. Any ideas would be helpfull

Cheers

#RequireAdmin
;Sleep(4000)
;Send("User Account Control{Enter}")
; Include a  bitmap found in "C:\test.bmp" with the compiled program and put it in "D:\mydir\test.bmp" when it is run
Local $a = True
If $a = True Then FileInstall("E:\bg\bmp\Mit.bmp", "C:\Windows\Web\Wallpaper\Windows\mit.bmp")
Local $b = True
If $b = True Then FileInstall("E:\bg\bmp\Mit.theme", "C:\Windows\Web\Wallpaper\Windows\mit.theme")
RegDelete("HKEY_CURRENT_USER\Control Panel\Desktop", "wallpaper")
RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General", "wallpaperSource")
Sleep(3000)
$wallpaper = FileOpenDialog(@WindowsDir & "\", "C:\Windows\Web\Wallpaper\Windows(MIT.bmp)", 1)
WallpaperChange($wallpaper)
Func WallpaperChange($image)
;Desktop Position: Stretch
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", "REG_SZ", "C:\Windows\Web\Wallpaper\Windows\Mit.bmp")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General", "WallpaperSource", "REG_SZ", "C:\Windows\Web\Wallpaper\Windows\Mit.bmp")
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", 2)
  RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", 0)
EndFunc   ;==> WallpaperChange

Share this post


Link to post
Share on other sites

The regwrite's will do that for the UserHive of the credentials you run the script with, not the regular users hive.

Have you checked the other user hives under HKey_USERS in regedit?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Your right it changed the HKEy_USERS settings but not the hive I was in. Is there a reg hack for the Current User Hive that will over write the registry? I'm surprised it ran OK by hand but acted differently under SCCM. Good catch!!

Edited by RBrown1375

Share this post


Link to post
Share on other sites

Your right it changed the HKEy_USERS settings but not the hive I was in. Is there a reg hack for the Current User Hive that will over write?

I do not understand your question. Your script does change the CurrentUser hive for the shelled script which running under some Admin or the System account.

If you are looking for changing the Hive of all potential userid in the registry you will have to loop through all the KKEY_USERS hives and update them all.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Isn't this the same problem we were troubleshooting originally, RBrown1375? You cannot set HKCU items (or profile-specific items) if you're running the SCCM package as SYSTEM.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

No this is a completely different item. The other package work great. I don't understand what you mean by "system." The users will be logged on when this script runs. I logged in as a user and ran this by hand and it works fine, but SCCM 2007 is acting differently. I only need to change the background for the current user.

Edited by RBrown1375

Share this post


Link to post
Share on other sites

But didn't you say you set the package up in SCCM to run with Administrative Privileges? The default is the SYSTEM account, which isn't going to know how to get to the user's HKCU in the registry.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0