General discussion

Locked

Scripting

By umarazina ·
Hello,

I am new at this (scripting) thing.

Here is a task I am trying to accomplish;
I need to find out all the network shares in every users logins that they map to via this lscritp.bat and also find all the printers they are attaching to.

There is around 1800 folders that are user ids and there is a sub folder in these that is named lcsript.bat for user logins. Below is a copy of the contents in that batch file. These folders are called by another batch file in NETLOGON on Domain Controller.

rem @net use /delete
rem @net use lpt1: \\pmi-nts-file01\[share_name]

@net use g: /delete
@net use g: \\pmi-nts-file01\sosales-common

@net use f: /delete
@net use f: \\sfo-nts-apps02\uar293

@net use m: /delete
@net use m: \\sfo-nts-apps02\bis

@net use r: /delete
@net use r: \\sfo-nts-file02\ddpc-gis


Each one of these 1800 folders is different because it?s associated with user id but in this folders there is a sub folder that is called lscript.bat.

Hey here is what I want to do.


Create a script to look for all network shares in all of these 1800 folders put the output to a text file or Excel sheet.

Also create another script that would look for ?net use lpt1? for all printers.


If someone get me started I hope to search and do more on my own.

Thanks in advance.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by rayeni In reply to Scripting
Collapse -

Using Kixtart or VBScript...

by Matthew Moran In reply to Scripting

First, there is virtually no reason to have individual scripts. That is too much headache and way to decentralized.

Kixtart is simpler to adopt than VBScript and can be implemented almost instantly. It provides you with the ability to return the user's name/id, and you can find out what drives are mapped.

Also, you can use a universal script for all users. You can call other scripts for non-standard items based on registry settings, group affiliation, etc.

You can find some of my scripting articles at InformIT and Windows Scripting Solutions
http://www.cbtoolkit.com/Default.asp?c=articles

The Informit article is freely available. Only a portion of the Windows Scripting Solution article is:
http://www.windowsitpro.com/Article/ArticleID/25279/25279.html

You can visit kixtart.org for additional information and to get the latest copy. It is much more "batchy" than VBScript - making it simpler to implement for Network Admins...

Collapse -

?

by umarazina In reply to Using Kixtart or VBScript ...

Kixtart is good product but at the momment I am just trying to analyze and find the resources these users are using. Once I clean it then I can implement amy be kixtart.

Now is there any tool or any scripts that I can use to analyze all these folders for printers and network shares.

Thanks

Collapse -

by Matthew Moran In reply to ?

My bad.. you want go return the values of the text files for review - returning specific batch commands and resources out of those text files.

I'll assume, due to the number, that all these folders are located on different servers but that the folders are grouped under a single folder.

I don't know of specific utilities to do this but I do know that it could be scripted in VBScript and the FileScripting Object.

You can traverse folder and even shares - read the text file (batch file) and look for specific text entries InStr(line,"Net Use") and other similar "Lpt" and "\\" to indicate a share resource.

Creating to look at a single server would be simple. Having it traverse multiple server/multiple shares, more complicated but doable.

I hope that goes somewhat in the right direction.

Sorry about that last post.

Matthew Moran
The IT Career Builder's Toolkit
http://www.cbtoolkit.com

Collapse -

No need for Appology

by umarazina In reply to

Thanks for helping,

I have copied all 1800 folders to my local machine and now if I can just get help in creating a script that would go and look through all of these folders and give me an output of all netowrk shares and all printers that will make my life at ease. Then I would implement kixtart and we never have to go through this again.

Thanks again.

Back to IT Employment Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums