Script to copy and execute a batch file.
-
Monday, September 17, 2012 8:18 AM
Hi,
I want to copy an exe file and execute a batch file using Group Policy on domain computer.
- Script will check if exe already exist otherwise copy exe file to a specific folder on client machine.
- Then using execute a batch file.
I want to perform that actions during user log in process.
Regards,
Mehar
All Replies
-
Tuesday, September 18, 2012 7:20 AMModerator
Hi,
> Script will check if exe already exist otherwise copy exe file to a specific folder on client machine
In my experience, I use below command:
if not exist "C:\example.exe" goto Action1 goto Action2 :Action1 xcopy /y /e "\\fileserver\example.exe*" c: c:\example.exe /q (or “/S”, silent installation, you should check whether your .exe file support silent installation) exit :Action2 Exit
I notice you mentioned deploy the script as user logon script. User logon script run in user context, make sure all your users has administrator permission to install the exe file.
This is just sample .bat script example, if you encounter any difficulties when customizing scripts, we recommend you create a thread in The Official Scripting Guys Forum! This is a best resource for scripting related issues.
The Official Scripting Guys Forum!
http://social.technet.microsoft.com/Forums/en/ITCG/threads
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Actually we have a product “System Center Configuration System” (SCCM), you can use SCCM to deploy .exe file.
For more information please refer to following MS articles:
Use Group Policy to assign computer startup scripts for 2007 Office deployment
http://technet.microsoft.com/en-us/library/cc179134(office.12).aspx
How to Install Configuration Manager Clients Using Logon Scripts
http://technet.microsoft.com/en-us/library/bb633072.aspx
Deploy Office 2010 by using System Center Configuration Manager 2007
http://technet.microsoft.com/en-us/library/ff404178.aspxHope this helps!
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
Lawrence
TechNet Community Support
- Marked As Answer by Mehar Muhammad Afzal Hamid Wednesday, September 19, 2012 2:15 PM
-
Wednesday, September 19, 2012 2:16 PM
Thanks LawrenceHi,
> Script will check if exe already exist otherwise copy exe file to a specific folder on client machine
In my experience, I use below command:
if not exist "C:\example.exe" goto Action1 goto Action2 :Action1 xcopy /y /e "\\fileserver\example.exe*" c: c:\example.exe /q (or “/S”, silent installation, you should check whether your .exe file support silent installation) exit :Action2 Exit
I notice you mentioned deploy the script as user logon script. User logon script run in user context, make sure all your users has administrator permission to install the exe file.
This is just sample .bat script example, if you encounter any difficulties when customizing scripts, we recommend you create a thread in The Official Scripting Guys Forum! This is a best resource for scripting related issues.
The Official Scripting Guys Forum!
http://social.technet.microsoft.com/Forums/en/ITCG/threads
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Actually we have a product “System Center Configuration System” (SCCM), you can use SCCM to deploy .exe file.
For more information please refer to following MS articles:
Use Group Policy to assign computer startup scripts for 2007 Office deployment
http://technet.microsoft.com/en-us/library/cc179134(office.12).aspx
How to Install Configuration Manager Clients Using Logon Scripts
http://technet.microsoft.com/en-us/library/bb633072.aspx
Deploy Office 2010 by using System Center Configuration Manager 2007
http://technet.microsoft.com/en-us/library/ff404178.aspxHope this helps!
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
Lawrence
TechNet Community Support

