| 1 |
ninoborges |
8 |
## This program will connect to every Netlogon Bat file and find what their Y drive
|
| 2 |
|
|
## is mapped to.
|
| 3 |
|
|
|
| 4 |
|
|
import string, sys, glob
|
| 5 |
|
|
|
| 6 |
|
|
place = "\\\mwbbpdc\\netlogon\\ric\\*bat"
|
| 7 |
|
|
files = glob.glob(place)
|
| 8 |
|
|
print len(files)
|
| 9 |
|
|
output=open('U:\\Y_Map_output.txt','w')
|
| 10 |
|
|
for x in files:
|
| 11 |
|
|
f=open(x, 'r')
|
| 12 |
|
|
contents = f.readlines()
|
| 13 |
|
|
f.close()
|
| 14 |
|
|
pos = -1
|
| 15 |
|
|
for y in contents:
|
| 16 |
|
|
y = string.lower(y)
|
| 17 |
|
|
res = string.find(y,'net use y:')
|
| 18 |
|
|
pos = pos +1
|
| 19 |
|
|
if res > -1:
|
| 20 |
|
|
break
|
| 21 |
|
|
pos2 = pos + 1
|
| 22 |
|
|
contents = contents[pos:pos2]
|
| 23 |
|
|
contents = string.join(contents)
|
| 24 |
|
|
usrnm = string.split(x,'\\')
|
| 25 |
|
|
usrnm = usrnm[5][:-4]
|
| 26 |
|
|
output_info = usrnm + "," + contents
|
| 27 |
|
|
output.write(output_info)
|
| 28 |
|
|
print usrnm + "," + contents
|
| 29 |
|
|
output.close() |