DBY
Who's Online
0 registered (), 12 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Latest Photo Gallery
light pole in the water
Eastern State Penitentiary - Philadelphia
Top Posters (30 Days)
HarryB 13
FinalDJ 11
Anartist 11
Goofy 7
Fitzy 3
m2h 3
Meph 2
Doorslammer 1
Dough 1
Nightowl 1
Topic Options
#178269 - 02/17/11 05:36 AM Help with dos batch files and what not
TheGlow Offline
Dread Pirate

Registered: 07/07/03
Posts: 3052
Loc: Last house on the left
I started a new job at a hospital where we have to survey and document all the old PCs, then xfer data, mapped drives, etc to the new ones.
So far Ive come up with a couple good ones with my limited knowledge, like this lil ditty

@echo off
copy \\lhhds3200\data\is\!base.txt \\lhhds3200\data\is\%computername%-base.txt

"C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32" /report \\lhhds3200\data\is\%computername%-msinfo.txt /categories +pewpew

ipconfig /all >> "\\lhhds3200\data\is\%computername%-ipconfig.txt"
dir /B "C:\Documents and Settings\All Users\Desktop" >> "\\lhhds3200\data\is\%computername%-info.txt"
net use >> "\\lhhds3200\data\is\%computername%-info.txt"



wmic bios get serialnumber >> "\\lhhds3200\data\is\%computername%-serial.txt"








type \\lhhds3200\data\is\%computername%-serial.txt >> \\lhhds3200\data\is\%computername%.txt
type \\lhhds3200\data\is\%computername%-base.txt >> \\lhhds3200\data\is\%computername%.txt
type \\lhhds3200\data\is\%computername%-msinfo.txt >> \\lhhds3200\data\is\%computername%.txt
type \\lhhds3200\data\is\%computername%-ipconfig.txt >> \\lhhds3200\data\is\%computername%.txt
type \\lhhds3200\data\is\%computername%-info.txt >> \\lhhds3200\data\is\%computername%.txt

del \\lhhds3200\data\is\%computername%-serial.txt
del \\lhhds3200\data\is\%computername%-base.txt
del \\lhhds3200\data\is\%computername%-msinfo.txt
del \\lhhds3200\data\is\%computername%-ipconfig.txt
del \\lhhds3200\data\is\%computername%-info.txt


Note the pew pew. Anyways that spits out a copy of a base txt, which I set the department info , user contact #s, etc. then it adds in the system summary from msinfo32, ipconfig, mapped drives, shortcuts in the all users/desktop, and if admin rights were on, the serial.
I noticed I can remotely wmic the serial from my terminal or just write it down from side of the system.

Now I need a list of users, so I was thinking just to output the contents of c:\documents and settings. that would also list the date. My question is is there a way to remotely run this so it can name the txt from the target machine? Because Ill just assume computername will name it from the one executing the command, not the target. For now Im just guessing to just edit the batch and put the hostname name as target and then output filename.
basically I want to know how to set my own variable
i want to make it like users.bat, and be able to type users MEDICAL2 and have it auto set MEDICAL2 for target host and then file name.
_________________________

Top
#178270 - 02/17/11 05:44 AM Re: Help with dos batch files and what not [Re: TheGlow]
TheGlow Offline
Dread Pirate

Registered: 07/07/03
Posts: 3052
Loc: Last house on the left
Gotta love google.
Got it.
Only issue I had though, minor however, is how can you do something like run wmic which needs admin rights, while on a non-admin account? I would assume entering your credentials in the bat which is not good, but anyway to pop a prompt?
Currently it just says you dont have rights and moves along to the next part.

Also whats a good way, preferably without an app that has to be installed to copy data to an external? This is XP so if you hit that one in use file, it stops the rest of the xfers.
Anyway to just skip and continue and report the non copied files?
_________________________

Top
#178617 - 03/19/11 10:55 AM Re: Help with dos batch files and what not [Re: TheGlow]
dalbarn Offline
nzb whore

Registered: 09/24/01
Posts: 415
Loc: Utopia
instead of copy use robocopy.exe. Think its in the 2003 resource kit. (don't try to use the one built into vista and win7 on an xp machine, it won't run). Anyways there are switches for robocopy to skip files after so many. secs and number of tries. default is 5 tries for 30 secs then moves on to next file. Plus you can rerun it later to grab the files you missed the first time.
_________________________
Will work for Bandwidth
P.S. Usenet > BT

Top



Moderator:  ARTacus, Doorslammer, Nightowl, Rez 
Shout Box

Today's Birthdays
No Birthdays
May
Su M Tu W Th F Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31