Solved

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

Posted on 2003-11-08
1
642 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Users of Windows 10 Professional can disable automatic reboots using the policy editor. This tool is not included in the Windows home edition. But don't worry! Follow the instructions below to install (a Win7) policy editor on your Windows 10 Home e…
Article by: btan
The intent is not to repeat what many has know about Ransomware but more to join its dots of what is it, who are the victims, why it exists, when and how we respond on infection. Lastly, sum up in a glance to share such information with more to help…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now