Execute one batch file on several Windows clients with active directory












0














For installing programs using an exotic package manager, I would like to execute a .bat file (repeated at each logon until success) once on each computer connected to an active directory, with a specific user with enough privileges.



Let's go simple, let's say my command is:



rem Windows batch
net use s: \myServerexotic_share
c:exoticbininstall_stuffs.exe s:exoticstuff_to_install


Is it possible to execute commands as privileged user without asking the user at logon? What is the active directory stuff to use?



PS: I never used active directory before.










share|improve this question
























  • Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
    – Pimp Juice IT
    Jan 15 at 0:45


















0














For installing programs using an exotic package manager, I would like to execute a .bat file (repeated at each logon until success) once on each computer connected to an active directory, with a specific user with enough privileges.



Let's go simple, let's say my command is:



rem Windows batch
net use s: \myServerexotic_share
c:exoticbininstall_stuffs.exe s:exoticstuff_to_install


Is it possible to execute commands as privileged user without asking the user at logon? What is the active directory stuff to use?



PS: I never used active directory before.










share|improve this question
























  • Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
    – Pimp Juice IT
    Jan 15 at 0:45
















0












0








0


1





For installing programs using an exotic package manager, I would like to execute a .bat file (repeated at each logon until success) once on each computer connected to an active directory, with a specific user with enough privileges.



Let's go simple, let's say my command is:



rem Windows batch
net use s: \myServerexotic_share
c:exoticbininstall_stuffs.exe s:exoticstuff_to_install


Is it possible to execute commands as privileged user without asking the user at logon? What is the active directory stuff to use?



PS: I never used active directory before.










share|improve this question















For installing programs using an exotic package manager, I would like to execute a .bat file (repeated at each logon until success) once on each computer connected to an active directory, with a specific user with enough privileges.



Let's go simple, let's say my command is:



rem Windows batch
net use s: \myServerexotic_share
c:exoticbininstall_stuffs.exe s:exoticstuff_to_install


Is it possible to execute commands as privileged user without asking the user at logon? What is the active directory stuff to use?



PS: I never used active directory before.







windows active-directory






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 '17 at 2:28









Ashton

665416




665416










asked Jun 25 '14 at 11:18









MUY Belgium

171214




171214












  • Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
    – Pimp Juice IT
    Jan 15 at 0:45




















  • Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
    – Pimp Juice IT
    Jan 15 at 0:45


















Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
– Pimp Juice IT
Jan 15 at 0:45






Are you still looking for a solution to this problem? If so then I have some questions.... You are in an AD domain environment and you are a domain administrator? You just need to execute install_stuffs.exe onto each machine needed and when you say "with a specific user with enough privileges" you just mean that needs to be an account with enough privileges to install that and access the \myServerexotic_share, correct? Will the install_stuffs.exe process allow installing via UNC path rather than mapped drive to UNC path as well (i.e. install_stuffs.exe \myServerexotic_share~ )?
– Pimp Juice IT
Jan 15 at 0:45












1 Answer
1






active

oldest

votes


















0














To do this, you need to use group policy and a container in AD.



First, go into your active directory Users and Computers Snapin (Start > control panel > admin tools > Active directory users and computers) and creae a new Organisational unit (OU). Place all of your users into the OU which you want the script to apply to. You need to do this as you are next going to apply a policy to the container that these users are in.



Next, open the Group Policy Management Console (GPMC) and locate the OU which you are working with. Right click it and choose the option "create a GPO and link it here" This will create a Group Policy Object (GPO) which will be applied to all users and computers in your OU.



Right click the newly created policy and select Edit. This will open a new window which will allow you to set settings for this policy.



Navigate in this window to user settings > Policies > Windows Settings > Scripts (Logon/Logoff) > Logon Within this area of GPMC, you can add scripts which will be run whenever a user (to whom this policy is applied) logs onto a PC. You can add your batch files location here and then test.



Please note that the logon script will need to be placed in a location where everyone can access is in order for it to run.






share|improve this answer





















  • Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
    – MUY Belgium
    Jun 25 '14 at 14:55










  • That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
    – Fazer87
    Jun 25 '14 at 15:08










  • Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
    – MUY Belgium
    Jun 30 '14 at 8:55










  • Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
    – Fazer87
    Jun 30 '14 at 9:31













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f773250%2fexecute-one-batch-file-on-several-windows-clients-with-active-directory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














To do this, you need to use group policy and a container in AD.



First, go into your active directory Users and Computers Snapin (Start > control panel > admin tools > Active directory users and computers) and creae a new Organisational unit (OU). Place all of your users into the OU which you want the script to apply to. You need to do this as you are next going to apply a policy to the container that these users are in.



Next, open the Group Policy Management Console (GPMC) and locate the OU which you are working with. Right click it and choose the option "create a GPO and link it here" This will create a Group Policy Object (GPO) which will be applied to all users and computers in your OU.



Right click the newly created policy and select Edit. This will open a new window which will allow you to set settings for this policy.



Navigate in this window to user settings > Policies > Windows Settings > Scripts (Logon/Logoff) > Logon Within this area of GPMC, you can add scripts which will be run whenever a user (to whom this policy is applied) logs onto a PC. You can add your batch files location here and then test.



Please note that the logon script will need to be placed in a location where everyone can access is in order for it to run.






share|improve this answer





















  • Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
    – MUY Belgium
    Jun 25 '14 at 14:55










  • That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
    – Fazer87
    Jun 25 '14 at 15:08










  • Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
    – MUY Belgium
    Jun 30 '14 at 8:55










  • Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
    – Fazer87
    Jun 30 '14 at 9:31


















0














To do this, you need to use group policy and a container in AD.



First, go into your active directory Users and Computers Snapin (Start > control panel > admin tools > Active directory users and computers) and creae a new Organisational unit (OU). Place all of your users into the OU which you want the script to apply to. You need to do this as you are next going to apply a policy to the container that these users are in.



Next, open the Group Policy Management Console (GPMC) and locate the OU which you are working with. Right click it and choose the option "create a GPO and link it here" This will create a Group Policy Object (GPO) which will be applied to all users and computers in your OU.



Right click the newly created policy and select Edit. This will open a new window which will allow you to set settings for this policy.



Navigate in this window to user settings > Policies > Windows Settings > Scripts (Logon/Logoff) > Logon Within this area of GPMC, you can add scripts which will be run whenever a user (to whom this policy is applied) logs onto a PC. You can add your batch files location here and then test.



Please note that the logon script will need to be placed in a location where everyone can access is in order for it to run.






share|improve this answer





















  • Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
    – MUY Belgium
    Jun 25 '14 at 14:55










  • That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
    – Fazer87
    Jun 25 '14 at 15:08










  • Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
    – MUY Belgium
    Jun 30 '14 at 8:55










  • Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
    – Fazer87
    Jun 30 '14 at 9:31
















0












0








0






To do this, you need to use group policy and a container in AD.



First, go into your active directory Users and Computers Snapin (Start > control panel > admin tools > Active directory users and computers) and creae a new Organisational unit (OU). Place all of your users into the OU which you want the script to apply to. You need to do this as you are next going to apply a policy to the container that these users are in.



Next, open the Group Policy Management Console (GPMC) and locate the OU which you are working with. Right click it and choose the option "create a GPO and link it here" This will create a Group Policy Object (GPO) which will be applied to all users and computers in your OU.



Right click the newly created policy and select Edit. This will open a new window which will allow you to set settings for this policy.



Navigate in this window to user settings > Policies > Windows Settings > Scripts (Logon/Logoff) > Logon Within this area of GPMC, you can add scripts which will be run whenever a user (to whom this policy is applied) logs onto a PC. You can add your batch files location here and then test.



Please note that the logon script will need to be placed in a location where everyone can access is in order for it to run.






share|improve this answer












To do this, you need to use group policy and a container in AD.



First, go into your active directory Users and Computers Snapin (Start > control panel > admin tools > Active directory users and computers) and creae a new Organisational unit (OU). Place all of your users into the OU which you want the script to apply to. You need to do this as you are next going to apply a policy to the container that these users are in.



Next, open the Group Policy Management Console (GPMC) and locate the OU which you are working with. Right click it and choose the option "create a GPO and link it here" This will create a Group Policy Object (GPO) which will be applied to all users and computers in your OU.



Right click the newly created policy and select Edit. This will open a new window which will allow you to set settings for this policy.



Navigate in this window to user settings > Policies > Windows Settings > Scripts (Logon/Logoff) > Logon Within this area of GPMC, you can add scripts which will be run whenever a user (to whom this policy is applied) logs onto a PC. You can add your batch files location here and then test.



Please note that the logon script will need to be placed in a location where everyone can access is in order for it to run.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 25 '14 at 11:28









Fazer87

10.2k12539




10.2k12539












  • Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
    – MUY Belgium
    Jun 25 '14 at 14:55










  • That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
    – Fazer87
    Jun 25 '14 at 15:08










  • Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
    – MUY Belgium
    Jun 30 '14 at 8:55










  • Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
    – Fazer87
    Jun 30 '14 at 9:31




















  • Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
    – MUY Belgium
    Jun 25 '14 at 14:55










  • That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
    – Fazer87
    Jun 25 '14 at 15:08










  • Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
    – MUY Belgium
    Jun 30 '14 at 8:55










  • Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
    – Fazer87
    Jun 30 '14 at 9:31


















Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
– MUY Belgium
Jun 25 '14 at 14:55




Right script is executed whenever the user log in. if I can read technet.microsoft.com/en-us/library/cc753404.aspx , logon & logoff script are runned as user, startup & shutdown script are run as local system administrator. So, I cannot do what I planned : I have to place either a startup either a shutdown script?
– MUY Belgium
Jun 25 '14 at 14:55












That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
– Fazer87
Jun 25 '14 at 15:08




That should be ok. The policy is in the same location, but you go through computer policies > policies.... and then set a startup script.. also, you put the computer accounts into the OU which you created at the beginning
– Fazer87
Jun 25 '14 at 15:08












Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
– MUY Belgium
Jun 30 '14 at 8:55




Sorry for being a bit meticulous, but accepted answer should start with 'No, It is not possible with Active Directory alone. But you may want to do this either' since what I prior think of is, as far as I can understand you suggestion, not possible.
– MUY Belgium
Jun 30 '14 at 8:55












Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
– Fazer87
Jun 30 '14 at 9:31






Then you need to go back, re read my answer and do a bit of research on Technet regarding modifying your script to execute with higher priviledges - which is entirely possible. This will give you everything you need
– Fazer87
Jun 30 '14 at 9:31




















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f773250%2fexecute-one-batch-file-on-several-windows-clients-with-active-directory%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido