Foreground Snapins
-
So from time to time I run into a program that either doesn’t have a native silent installation or it just plain won’t work.
I recently discovered a opensource scripting language called autoIT (https://www.autoitscript.com/site/autoit/) which allows you to script mouse clicks and keyboard sends and such, meaning I can script all the options and next clicks of an installation wizard.
I got this to work, along with a few other things I still do in a batch script. It lets you turn the script into a exe, so it’s easy to compile it and deploy it within another script.
Running the batch script works great, but then I tried to make it a snapin and it didn’t work. I’m pretty sure because it requires opening a program in the foreground and snapins and the fog service are all in the background. So I’m wondering if it’s possible to allow the fog service to open a program in the foreground for scripting something like this?Thanks,
-JJ -
And I am testing it on the newest version of the client 0.11
-
This is not possible. The SYSTEM account is prohibited from interacting with desktop environments. This is why we have FOGUserService for showing GUIs.
-
@Joe-Schmitt So there’s a way to do it with the FOG user service? Or it’s just not possible?
-
Anything spawned by FOGUserService runs as that user. There is no safe way of doing what you want.
-
So then I need a different new solution for scripting program installations that don’t like being scripted. Anybody know of any good ones? Like maybe a newer version of RIP (Rapid install packages)?
-
@JJ-Fullmer What if you made your autoIT script, then wrapped the autoIT script with an msi wrapper? That way the system user “clicks and what not” would still operate and all the wrapper would do is make it a potential possibility to make it a silent install.
Of course I’m not even sure this is possible, but i think it’s a better shot than the track you’re on currently.
-
@Tom-Elliott Do you have any guidance off hand on how to make an msi wrapper. Or know of any good guides on msi wrappers?
Thanks for the idea, I am looking into it now. -
@Tom-Elliott
Oh it seems you mean the program called MSI wrapper… http://exemsi.com/getting-started -
@JJ-Fullmer it wouldn’t solve your issue. SYSTEM can’t interact with desktop sessions on newer windows versions. Its a security concern and is strictly prohibited. No amount of wrappers will circumvent that.
-
@Joe-Schmitt Then I must hack the system! Mwahahahahaha!
-
@JJ-Fullmer Not the best solution, but one work around I had done for a program that I had the same issues with is to schedule a task to install the software. I created a snapin that setup a scheduled task (using SCHTASKS) on the client and then kicked off the task before finishing. This allowed the program to come up in the user session and either be interacted with or in your case run the autoit script. I tried to find that script but I must have deleted it because I can not find it anywhere. But that may give you a starting point to try.
-
@ITSolutions @Tom-Elliott
The msi-wrapper didn’t work in the snapin as @Joe-Scmitt predicted. Because even in the msi wrapper it still just opens up the gui installer and clicks through it. Still a really cool tool though, I’m sure I’ll find a use for it in the future.
I’m going to give the Scheduled tasks idea a go. -
@ITSolutions I don’t suppose you can find the script that you had? I can’t seem to get this to work.
I have tried a variety of things in the snapin for creating and running the scheduled task.
Such asschtasks /Create /TN fas /TR "\\arrowfs3\scripts\Silent-Installers\Accounting\FAS.exe" /SC ONCE /ST 00:00 schtasks /RUN /TN fas
schtasks /Create /TN fas /TR "%~dp0\FAS.exe" /SC ONCE /ST 00:00 /RL HIGHEST /RU %domain%\%username% /RP %password% schtasks /RUN /TN fas
I was able to get the gui to pop up manually running the scheduled task from the command line but it didn’t do the same when run as a snapin. Perhaps it just can’t be done or I’m missing something. I suppose I could make the whole batch script be the scheduled task instead of just the exe version of the autoit script.
-
@JJ-Fullmer Perhaps try the /IT (interactive) switch
-
@JJ-Fullmer I started digging a little further and found my scripts that I used for that and started to remember a few things. I had mixed results with the scheduled task also it worked sometimes, but not always and so I had to come up with a different solution and what I did was created a runonce entry in the reg and an auto login, then rebooted the machine. At the end of the script that ran I logged back off automatically, this is how I was able to consistently get the program to run. I eventually found a different solution for the program I was using and no longer had to use this. Hopefully you can make use of it though
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v LWSoftware /t REG_SZ /d \\10.1.90.2\software$\Software_install.bat /f reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d . reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUsername /t REG_SZ /d Thecontrollerofall reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d supersecret reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_SZ /d 1
Just in case you were wondering this was my scheduled task script, that as I said I got it to work on a couple machines, but very unreliable
C:\Windows\system32>schtasks /create /tn "FOG install" /tr "\\10.1.90.2\software$\Software_Install.bat" /sc once /st 12:00 /f C:\Windows\system32>schtasks /run /tn "fog install" C:\Windows\system32>schtasks /delete /tn "fog install"
-
The autologon idea might work, because most of the time the snapin would be installed right after imaging and I have a autologon for a setupcomplete type script. But I’d prefer a more flexible snapin solution that doesn’t require a restart, because it looks like a lot of the programs we use aren’t very scripting friendly.
@Quazz I tried the /IT switch it still didn’t work when started from the system account sadly.
I’m still experimenting with this. I’m trying to move to a Windows 10 LTSB image with a more snapin provisioning style for all my programs rather than having them all pre-installed in the image.
So I’ll keep playing with it and report back if I happen to find a universal solution that hasn’t been yet suggested.
-
I know this is an old thread, but i am trying to achieve the same as @JJ-Fullmer. Automating post install of reboot restore rx using the snap in.
My environment is Fog 1.3.0. RC8 with smartinstaller. So this is not possible?
-
@kwetiaw The professional version allows for network deployment, they also offer a msi repackager for the professional version. http://support.horizondatasys.com/Knowledgebase/Article/View/97/0/rollback-rx-deployment-guide