[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

A script to find out which servers have a web.config file

Posted on 2014-08-22
6
Medium Priority
?
310 Views
Last Modified: 2014-09-12
Can someone help me to write a vbs/dos batch script to find out which servers have a web.config file

Thanks
0
Comment
Question by:rakkad
  • 2
  • 2
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
SagiEDoc earned 1500 total points
ID: 40278450
I have attached a vb script file and a txt file. Place both files in c:\scripts then open the serverList.txt file and add the servers you would like to check for the web.config file. One server per line.
In the script file set the path you would exspect to find the web.config file (line 37)
Run the FileCheck.vbs script.
FileCheck.vbs
Server-list.txt
0
 

Author Comment

by:rakkad
ID: 40279847
Can't you do a script that will search the local computer of all drives and find the presence of the web.config file

Thanks
0
 
LVL 26

Expert Comment

by:Lionel MM
ID: 40280401
a quick and simple way for a local computer it to use dir but you would have to do disk by disk
dir c:\web.config /s
dir d:\web.config /s
If you want the results to go to a log file then you can do this
dir c:\web.config /s >C:\Logs\WebConfig.txt
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rakkad
ID: 40280509
Can this be done via your vb script ? So it will search via the serverlist.txt and check for any drives that has a web.config file

Thanks
0
 
LVL 13

Expert Comment

by:SagiEDoc
ID: 40282422
Change line 36 in the VBS file to this:

ExecQuery("Select * From CIM_DataFile Where FileName = 'web.config'")

That will search all local drives.
0
 
LVL 26

Expert Comment

by:Lionel MM
ID: 40282954
The only way I know of to be able to use your serverlist.txt on remote servers is to use a utility like psexec http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx to run DIR on a remote server. It may be best to use the vb scipt suggested by SagiEDoc but if you do want to install psexec then this is what you will psexec @C:\serverlist.txt) "dir c:\web.config /s"
0

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question