PDA

View Full Version : Collecting config info



Jayuk76
01-25-2002, 12:51 PM
If I wanted to run a script to collate informa\tion such as

IP Address, Netbios Name, Apps Loaded, System info such as Chip, RAM, Printers installed, Username, etc how would one go about this?...SImilar to say surveying a PC?

king_ging
01-28-2002, 03:29 PM
Hi jayuk76,

when you install kix you get some sample kix scrips and this one might interest you

you will have to make just few changes

good luck
; KICK.KIX
;
; KiXtart Sample script displaying all available macros
;
; Note : This code sample is provided for demonstration purposes only.
; Microsoft makes no warranty, either express or implied,
; as to its usability in any given situation.
;
; Copyright (C) 2001 Ruud van Velsen.
; All rights reserved.
;

break on
AT( 1,30) "User Info"

$Items = "WUSERID","USERID","LDOMAIN","FULLNAME","COMMENT","PRIV","PWAGE","MAXPWAGE","LONGHOMEDIR","HOMEDIR","HOMEDRIVE","HOMESHR","LANROOT","SID","PRIMARYGROUP","LSERVER","RSERVER","USERLANG"

$Values = @WUSERID, @USERID, @LDOMAIN, @FULLNAME, @COMMENT, @PRIV, @PWAGE, @MAXPWAGE, @LONGHOMEDIR, @HOMEDIR, @HOMEDRIVE, @HOMESHR, @LANROOT, @SID, @PRIMARYGROUP, @LSERVER, @RSERVER, @USERLANG

Disp( "User Information", $Items, $Values )



:GROUPMEM
$Page = 1
$Count = 0
$Y = EnumGroup($Count)

While Len($Y)
Cls
color b/n
Box(0,0,24,79,grid)

Color y+/n
At( 1,30) "Group Membership - Page " + $Page

color g/n
At ( 3, 5 ) "Groups"

$Line = 3
Color w+/n
While Len($Y)
At ($Line,19) $Y

$Count = $Count + 1
$Y = EnumGroup($Count)

If Len($Y)
$Line = $Line + 1
Endif

If $Line = 22
Goto ExitLoop
Endif
Loop
:ExitLoop

Color y+/n
At (23,32) "<any key to continue>"
Get $x

$Page = $Page + 1
Loop




; Display network and OS stuff


$Items = "LM","WKSTA","ADDRESS","DOMAIN","LDRIVE","RAS", "", "PRODUCTTYPE", "BUILD", "CSD", "KIX", "DOS", "PRODUCTSUITE", "INWIN"

$Values = @LM, @WKSTA, @ADDRESS, @DOMAIN, @LDRIVE, @RAS, "", @PRODUCTTYPE, @BUILD, @CSD, @KIX, @DOS, @PRODUCTSUITE, @INWIN

Disp( "Network & OS Information", $Items, $Values )



$Items = "CURDIR", "SCRIPTDIR", "STARTDIR", "SYSLANG", "DATE", "TIME", "DAY", "MDAYNO", "WDAYNO", "YDAYNO", "MONTH", "MONTHNO", "YEAR"

$Values = @CURDIR, @SCRIPTDIR, @STARTDIR, @SYSLANG, @DATE, @TIME + "." + @MSECS, @DAY, @MDAYNO, @WDAYNO, @YDAYNO, @MONTH, @MONTHNO, @YEAR

Disp( "Miscellaneous Information", $Items, $Values )



Function Disp( $Title, $ItemsToDisplay, $ValuesToDisplay )

Color b/n
Box(0,0,24,79,grid)

$Count = 0
Color y+/n
At( 1,30) $Title

For Each $Item in $ItemsToDisplay
Color g/n
At( $Count+3, 5 ) $Item
Color w+/n
At( $Count+3, 19) $ValuesToDisplay[ $Count ]
$Count = $Count + 1
Next

Color y+/n
At(23,32) "<any key to continue>"
Get $x

EndFunction

ED_klein
02-09-2002, 05:24 PM
You might also look at a inexpensive shareware product "LOGINFO" - it doesn't do much about apps, but it does a very nice job on config, memory dirve space OS etc. Do a Google search on Loginfo

govi
02-13-2002, 11:54 PM
Hi,

Use WMI & you can retrieve whatever information you want......

Here is a basic script, which i am including for easy understanding.This script takes the IP of the machine you want to query....


Dim myserver
Dim strMoniker
Dim strQuery
Dim Comp
Dim CompSysSet
Dim CompSys


myserver=Inputbox("Please Enter The IP Address")
msgbox myserver

strMoniker="winmgmts:{ImpersonationLevel=impersonate}!//"& myserver &"/root/cimv2"
strQuery="select * from Win32_ComputerSystem"

Set Comp = GetObject(strMoniker)
Set CompSysSet = Comp.ExecQuery(strQuery,,0)

For each CompSys in CompSysSet

Wscript.Echo CompSys.Description
Wscript.Echo CompSys.Domain
Wscript.Echo CompSys.BootUpState
Wscript.Echo CompSys.Name
Wscript.Echo CompSys.SystemType
Wscript.Echo CompSys.UserName
Next

There are many more classes you can query. It depends on the information you want....
For Example:- if you want to find NetworkCard Info, then query the class named Win32_NetworkAdapterConfiguration

Search the MSDN site for more classes, there are many interesting things to do....

govi
02-14-2002, 12:10 AM
Here goes another example.....see it's very easy, once you learn how to do it

Dim myserver
Dim strMoniker
Dim strQuery
Dim Comp
Dim CompSysSet
Dim CompSys


myserver=Inputbox("Please Enter The IP Address")
msgbox myserver

strMoniker="winmgmts:{ImpersonationLevel=impersonate}!//"& myserver &"/root/cimv2"
strQuery="Select * from win32_NetworkAdapterConfiguration where IPEnabled=True"

Set Comp = GetObject(strMoniker)
Set CompSysSet = Comp.ExecQuery(strQuery,,0)

for each CompSys in CompSysSet

Main=Main & "DNS Domain: " & CompSys.DNSDomain & VBCRLF
Main=Main & "Desc: " & CompSys.Description & VBCRLF
Main=Main & "IPAddress: " & CompSys.IPAddress(0) & VBCRLF
Main=Main & "Subnet Mask: " & CompSys.IPSubnet(0) & VBCRLF
Main=Main & "Default Gateway: " & CompSys.DefaultIPGateway(0) & VBCRLF
Main=Main & "MAC: " & CompSys.MACAddress & VBCRLF
Main=Main & VBCRLF
next

wscript.echo Main
Wscript.Quit