Solved

Batch Script - Retrieve Settings for IIS, Win, SQL Server

Posted on 2003-11-08
1
649 Views
Last Modified: 2013-12-04
I'm trying to write a generic batch script to gather a bunch of security settings from various Windows 2000 computers.  I'm almost done but i'm stuck on a couple of things:

1. How do I get the "user rights assignments" and "Security options" from the local security policy?

2. For IIS, is it possible to get a list of script mappings (ie: .printer, .asp, .idq, etc)

3. How do I get the list of users and their permissions in SQL Server 7 or 2000?

Being from the Linux world, i've been struggling to find a list of the more hidden Window commands but haven't had any success (I know about the ones listed when I type help - but not much more).  I'm not sure how much of the above is actually possible through a batch script but your help is much appreciated.

Thanks,
KABOOM
0
Comment
Question by:KABOOM
1 Comment
 
LVL 9

Accepted Solution

by:
TooKoolKris earned 250 total points
ID: 9716192
Your not going to accomplish these things by using a batch file. You need to use some scripting.

Here's one for obtaining user account information. Remember to replace the "." variable in "strComputer" to that of the computer name or IP of the computer you are retreiving the info from. You need to use .vbs as the format.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount",,48)
For Each objItem in colItems
    Wscript.Echo "AccountType: " & objItem.AccountType
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Disabled: " & objItem.Disabled
    Wscript.Echo "Domain: " & objItem.Domain
    Wscript.Echo "FullName: " & objItem.FullName
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "LocalAccount: " & objItem.LocalAccount
    Wscript.Echo "Lockout: " & objItem.Lockout
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "PasswordChangeable: " & objItem.PasswordChangeable
    Wscript.Echo "PasswordExpires: " & objItem.PasswordExpires
    Wscript.Echo "PasswordRequired: " & objItem.PasswordRequired
    Wscript.Echo "SID: " & objItem.SID
    Wscript.Echo "SIDType: " & objItem.SIDType
    Wscript.Echo "Status: " & objItem.Status
Next

You are probably going to have to do some searching for the info you want from IIS and SQL as these would be different objects outside of the WSH library. I'm pretty sure each has it's own SDK that would have tools in there for automating tasks via scripting as well.

Good Luck
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
OfficeMate Freezes on login or does not load after login credentials are input.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 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