Scripting in 'DOS' what a ball ache!
#1
Scooby Regular
Thread Starter
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like
on
1 Post
Scripting in 'DOS' what a ball ache!
Not really a prob but Ill share it..
One of our clients has supplied the pc's, they are sitting on their own network within our building.
say 300 pc's abd they want the boot order changing, the mac address writing down and a couple of other bits.. Not really a problem as its not my project..
Anyway been thinking about how to do this for a while to improve the process for building new pc's (and to help the lad out!), as I want to change the boot order on ours and ensure they all have passwords set on the bios..
So looking for a network driver I found the HP business system desktops bios utility.. Using repset you can replicate the changes to the bios.. Cool - That deals with that..or does it?
So I found a way of formatting usb devices.. didnt fancy formatting my pen drive at the moment.. so I tested with an external 2.5" usb hdd.. formatted it and made it boot using windows 98 / or xp startup files.. (cant remember) cd would have been good, but need to write the logfile somewhere..
Then downloaded ultimate boot disk or whatever it was... this then got me the mac address (think it uses NBMAC) but it works.. Halfway there..
So need to prompt whoever is doing the process to enter the desk number and the assety tag number (we use this as the computer name) so how the **** do you do that in dos without loads of utilitys, Not to worry Ill use CSCRIPT, ah cannot be run in Dos mode.. DAMN.. ok Ill use KIX.. nope.. same problem..Finally found an old version of kix.. really annoying because its really simple what I wanted to do..
Knocked up a script to open the file from repset to get the serial number.. and planned on writing all details out to a log file as required.. and also write the asset tag into the repset file to save it in the bios..
Fookin the old version of kix cant write text files yet!!
Ended up setting environment variables and then from a batch file echoing these to a test file.. ie echo %computername% %macaddress% %serialnumber% >>MachineList.txt
If it doesnt quite work like I want Im going to have to find my copy of Microsoft Quick Basic 4.5
Anyway.. now you boot the pc, enter the asset tag number (might as well stick it on at the same time!) and it configures the bios with it.. makes all relevant changes and it also logs them all to a text file including the serial number and the desk number, next step for our pcs will be do it on a cd, make it write the log files to a share, and copy the ghost client on.
But it was nearly 9pm friday evening.. and I was staying at work until I had cracked it! much to the amusement of the lads on the team!! (he probably could have just about changed them all manually in that time..)
David
One of our clients has supplied the pc's, they are sitting on their own network within our building.
say 300 pc's abd they want the boot order changing, the mac address writing down and a couple of other bits.. Not really a problem as its not my project..
Anyway been thinking about how to do this for a while to improve the process for building new pc's (and to help the lad out!), as I want to change the boot order on ours and ensure they all have passwords set on the bios..
So looking for a network driver I found the HP business system desktops bios utility.. Using repset you can replicate the changes to the bios.. Cool - That deals with that..or does it?
So I found a way of formatting usb devices.. didnt fancy formatting my pen drive at the moment.. so I tested with an external 2.5" usb hdd.. formatted it and made it boot using windows 98 / or xp startup files.. (cant remember) cd would have been good, but need to write the logfile somewhere..
Then downloaded ultimate boot disk or whatever it was... this then got me the mac address (think it uses NBMAC) but it works.. Halfway there..
So need to prompt whoever is doing the process to enter the desk number and the assety tag number (we use this as the computer name) so how the **** do you do that in dos without loads of utilitys, Not to worry Ill use CSCRIPT, ah cannot be run in Dos mode.. DAMN.. ok Ill use KIX.. nope.. same problem..Finally found an old version of kix.. really annoying because its really simple what I wanted to do..
Knocked up a script to open the file from repset to get the serial number.. and planned on writing all details out to a log file as required.. and also write the asset tag into the repset file to save it in the bios..
Fookin the old version of kix cant write text files yet!!
Ended up setting environment variables and then from a batch file echoing these to a test file.. ie echo %computername% %macaddress% %serialnumber% >>MachineList.txt
If it doesnt quite work like I want Im going to have to find my copy of Microsoft Quick Basic 4.5
Anyway.. now you boot the pc, enter the asset tag number (might as well stick it on at the same time!) and it configures the bios with it.. makes all relevant changes and it also logs them all to a text file including the serial number and the desk number, next step for our pcs will be do it on a cd, make it write the log files to a share, and copy the ghost client on.
But it was nearly 9pm friday evening.. and I was staying at work until I had cracked it! much to the amusement of the lads on the team!! (he probably could have just about changed them all manually in that time..)
David
#2
Youre right .. it can be a complete pain in the @rse but you seem to be doing a good job of getting around it
Not sure if you use these but the pstools suite is free and 'kin excellent for inclusion in scripts etc.
Download it from http://www.sysinternals.com/Utilities/PsTools.html
Its a set of command line util's that make remote management much easier.
The psinfo one gives excellent results when getting info such as installed hotfixes or service pack levels etc.
We used psinfo together with psexec recently to collate SP and hotfix levels of 10,000+ machines into a spreadsheet
The best of the bunch imo, is psexec which allows you to execute commands on remote machines.
We use it to push stuff out to sets of machines.
You can even use it to open things interactively on the target machine ... for instance you can use it to open up a command shell under the system account interactively on the target machine.
It will also copy the relevant executable to the target before execution etc
Another example of collating info would be to use psxec to execute ipconfig /all on a list of machines and pipe the results out to a text file
eg psexec \\%machinename% ipconfig /all >> results.txt
you could use the "for" command to rotate through a list of machine names
eg for /f %%f in (names.txt) do ipconfig /all \\%%f >> results.txt
or for /f %%f in (names.txt) do psinfo -s \\%%f >> results.txt
may need some tweaking but should rotate through the list (in names.txt) and append the results.txt file with all the results. You could incorporate a "find" statement to get the info you want
Not sure if you use these but the pstools suite is free and 'kin excellent for inclusion in scripts etc.
Download it from http://www.sysinternals.com/Utilities/PsTools.html
Its a set of command line util's that make remote management much easier.
The psinfo one gives excellent results when getting info such as installed hotfixes or service pack levels etc.
We used psinfo together with psexec recently to collate SP and hotfix levels of 10,000+ machines into a spreadsheet
The best of the bunch imo, is psexec which allows you to execute commands on remote machines.
We use it to push stuff out to sets of machines.
You can even use it to open things interactively on the target machine ... for instance you can use it to open up a command shell under the system account interactively on the target machine.
It will also copy the relevant executable to the target before execution etc
Another example of collating info would be to use psxec to execute ipconfig /all on a list of machines and pipe the results out to a text file
eg psexec \\%machinename% ipconfig /all >> results.txt
you could use the "for" command to rotate through a list of machine names
eg for /f %%f in (names.txt) do ipconfig /all \\%%f >> results.txt
or for /f %%f in (names.txt) do psinfo -s \\%%f >> results.txt
may need some tweaking but should rotate through the list (in names.txt) and append the results.txt file with all the results. You could incorporate a "find" statement to get the info you want
Last edited by smokebelch; 25 September 2005 at 06:34 PM.
#4
Scooby Regular
iTrader: (5)
Join Date: Feb 2003
Location: Worcester
Posts: 2,625
Likes: 0
Received 0 Likes
on
0 Posts
batch files are nothing on trying to write xml for our ris... I have been banging on for the last 2 years on how I see our users building there own pcs to our strict std and we are getting there with sms gpo's and Ris, but I find wrting things in the xml for ris is an absoulte ball ake but I know nothing about programming
I ve spent most this weeks spare time trying to find a way of the pc naming it self from which OU its in and which user is logged on,,, may be thats why Ive had to work today just to catch up on the day to day rubbish I ve missed but I will get there one day
and buy dell pc's with open mange you can preduce reports on the assets and they will set the boot oder to any thing we want ( pxe in our case ) but that would be to easy
I ve spent most this weeks spare time trying to find a way of the pc naming it self from which OU its in and which user is logged on,,, may be thats why Ive had to work today just to catch up on the day to day rubbish I ve missed but I will get there one day
and buy dell pc's with open mange you can preduce reports on the assets and they will set the boot oder to any thing we want ( pxe in our case ) but that would be to easy
#5
Originally Posted by GaryK
Yes but batch files have been around since DOS itself, 20+ years old now which is a lifetime in IT terms
Thing is ... for speed of creation/simplicity etc I find I use them daily.
Sure they are very basic, but day to day, simple is what gets the job done.
It is funny though when you think (as already stated) how old it all is.
Never really thought of it like that before
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM