Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2003-11-08
1
651 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 10 4 70
Windows Security Event ID to check for Service account usage 3 174
Forensic audit of SBS 2008 3 91
Botnet detection help me please 21 132
No security measures warrant 100% as a "silver bullet". The truth is we also cannot assume anything but a defensive and vigilance posture. Adopt no trust by default and reveal in assumption. Only assume anonymity or invisibility in the reverse. Safeā€¦
OfficeMate Freezes on login or does not load after login credentials are input.

789 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