• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

is this type of batch file possible?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

jediobi1

Member
Joined
Apr 27, 2003
i need batch file that will this list of items

1. create a local admin account

2. unjoin machine from domain and reboot

3. after reboot login

4. rename machine and reboot

5. after 2nd reboot login

6. join machine and reboot
 
I am no expert at scripting using a batch file, but I am fairly confident you cannot have the same batch file call a reboot then after the PC is up and running again continue where it left off. However, one work around you might be able to do is create multiple batch files, and have each batch file add the next one to the start up process (and remove itself) before sending the reboot command.

I am sure there are better options, I just wanted to give you something in case no one else with better knowledge on batch scripting pops in.
http://stackoverflow.com/questions/3331947/resume-batch-script-after-computer-restart


Edit.. It might also be easier to do using PowerShell instead since it sounds like you are doing this on windows.
http://blogs.technet.com/b/heyscrip...-windows-powershell-script-after-restart.aspx
 
Last edited:
Definitely use powershell, it's infinitely more flexible, easier to use, and has more support available. You should be able to do all of the things you want in Powershell, you'll just have to get a little creative. For the startup issues, the easiest solution would just be to code your script in such a way that after each step it creates a control file to know what step is next, set the script to run on startup and look for that control file to know which actions to take.

The toughest part will be logging in (assuming the account has a password). There was a post a while back relating to auto-login, I think the OP found a solution that worked so you might search for it.
 
hey all i need some more help, i have a csv file with a list of machines that i need to search AD in the old OU for and move them from the old OU which is figure A to the new OU which is highlighted in figure B, does anyone know how to do this in bulk?

Figure A
oldou2.jpg

Figure B
newou2.jpg
 
Last edited:
my only issue with powershell is its confusing for one and i dont know how to make it search the old OU under workstations and i dont know how to make it move them to nonbuild under NMO>AST>Workstations>non build
 
Back