Cmd not execute in a local computer
I created a file in Autoit, with Snapin not working. The auto-it file is in network.
I thought, that I could create a snapin with a .bat file so that it would be copied to the folder x86 \ fog.
And then create another snapin to execute that bat of the folder fog, what what would do is call the exe file of auto-it.
How can I run a bat with the snapin option to run on the local machine?
I’ve read a lot to solve the problem, and I think that’s the quid of question:
Snapins Run as SYSTEM or root
All Snapins including SnapinPacks run as the SYSTEM or root user’s security context. If a snapin or SnapinPack runs successfully by manual execution but not via the FOG Client - this is typically related to the security context. For example, say you have a shared directory that is granted read access for all Domain Users. Well, an individual host’s local SYSTEM or root account is not a member of Domain Users. Therefore, unless alternative credentials are supplied to access the share, any script executed that tries to read this share will not work. There are a few solutions to this. Granting the share read access for anonymous users is the most simple. Specifying credentials within scripts or as arguments are viable options.
How can i specifying credentials with scripts or arguments in snapin console? Could you put an example?
Thks a lot.
Thanks george, but I do not understand why FOG can not execute cmd and exe remotely with administrator permissions.
At least to transfer the file I did it with the Reboot restore itself, you say send file and execute, and it works perfectly. Open autoit file in the network and install perfect.
The same file I put in the FOG snapins and it is copied to the FOG temp folder but it is not executed.
I have tried to create a bat exe, with administrator permissions but it still does not work.
Are there any way to do that i want to do?
@xavierc I think I understand what you are saying, I can tell you that you will have issues with other deployment tools too.
Well I would have to ask you a few questions:
- Why don’t you deploy the autoit exe directly using FOG? That would cut out the batch file and psexec in the mix. If there are additional files you need in addition to the autoit executable you would then create a snapin pack (i.e. zip file) with all of the needed files for the install.
- The FOG Client runs as the SYSTEM user which has full local access but no remote access. With that said your batch file can reach outside the local computer to remote computer share by mapping a network drive in the batch file.
@echo off net use t: \\<server_name>\<share_name> /user:<domain>\<user> <password> t: cd installer autoit.exe /silent net use t: /delete
That method will allow the SYSTEM account access to remote files.
IMO deploying the entire package with FOG would be much easier, but I understand certain install packages (like AutoCAD 35GB) is not practical to send out via a snapin pack so using the remote network share is the best solution there.
ok, I’ll try to explain myself better
I have to install the new version of the Reboot Restore RX on more than 250 computers.
with autoit I have done a self uninstaller and installer with the license of the new version, unnatended
But the installer program taht needs to be installed, is networked.
As FOG allows deploy files, I had thought that first I would copy a bat file, with the commands to execute the compiled autoit exe of the network, in all the local computers in the folder where the FOG is installed in x86 \ fog and then calling the psexec would call the bat file to run.
But if there is a program to be able to execute files from the network from to a local computer, it would also be worth it.
@xavierc There is some examples of how you could use the snapin system in FOG on the wiki: https://wiki.fogproject.org/wiki/index.php?title=Snapin_Examples
@xavierc First let me say I don’t know snapins or have used them. In my work we have a different method to deploy applications. I do know a little about the snapin system.
When you say " in the directory x86 \ fog I have the file dinstall.bat" I’m confused because that is a relative path. Is that dinstall.bat part of the snapin or is that location some other location on the local computer.
If we assume that is part of the snapin pack you created. So that snapin pack is copied to the target computer and expanded when its executed. You would call that dinstall.bat command by using the current directory variable followed by the path like this You would reference
%~dp0\x86\fog\dinstall.batThat would call the dinstall.bat at some relative path where FOG expanded the snapin pack. You don’t need to know the actual full path to the batch file (which is represented by
%~dp0), you just need to know the relative path within the snapin pack.
After saying all of that I’m not sure if it answered your question.
Thanks for answering
I have tried with psexec, psexec allows the execution of files. But I need to know what arguments to put in the snapin.
To give a real example. in the directory x86 \ fog I have the file dinstall.bat
What arguments should I put in the normal snapin to run locally with the psexec command?
What I am trying to achieve would be valid for any file that I would like to run locally but that the information of the files is in the network
The snapins run under the local SYSTEM account. Just realize that account has full control of the local system but had no rights on the network or different computer. If you need your FOG snapin that reaches outside the local computer you will need to take some considerations.
What you have said fog should do (batch file run and executable) should work as long as the executable is either on the local computer, or delivered with the snapin to the target computer.