Page 1 of 1 1
Topic Options
#137805 - 2005-04-13 10:43 AM Help me........
kid Offline
Fresh Scripter

Registered: 2005-04-13
Posts: 5
Dear all,

I'm not a expert with vbs and KiXscripts.
I have a nice vbs script but I like to have it in KiX script.
How and what I have to do?
Please tell me step by step.

Or can I use call, run function in KiX to run a vbs script.
what code do I need for this ?
example: My vbs is on a shared map on a server.
\\my server\PCUINFO\InfoPC.vbs



this is my vbs script


''=========================================================================
'' PCU Information
''=========================================================================
''
''
CONST ForAppending = 8

Set WshNtwk = WScript.CreateObject("WScript.Network")

checkedCPU = WshNtwk.ComputerName


Set objFSO1 = CreateObject("Scripting.FileSystemObject")


If objFSO1.FileExists("\\twsevgdom001\data\CPUINFO\"& checkedCPU &"_PC_Info.csv") Then
objFSO1.DeleteFile ("\\twsevgdom001\data\CPUINFO\"& checkedCPU &"_PC_Info.csv")
End If

Set objFSO = CreateObject("scripting.filesystemobject")
strOutputFile = "\\twsevgdom001\data\CPUINFO\"& checkedCPU &"_PC_Info.csv"
Set objOutputFile = objFSO.OpenTextFile(strOutputFile, ForAppending, True)


strComputer = checkedCPU
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery _
("SELECT * FROM Win32_SystemEnclosure")
For Each objChassis in colChassis
For Each intType in objChassis.ChassisTypes
desc = intType
If desc = 1 Then PCkind = "Other" '' Could use Virtual here for VM machine. ''VM machines have in my testing always pulled this Category.
If desc = 2 Then PCkind = "Unknown"
If desc = 3 Then PCkind = "Desktop"
If desc = 4 Then PCkind = "Low Profile Desktop"
If desc = 5 Then PCkind = "Pizza Box"
If desc = 6 Then PCkind = "Mini Tower"
If desc = 7 Then PCkind = "Tower"
If desc = 8 Then PCkind = "Portable"
If desc = 9 Then PCkind = "Laptop"
If desc = 10 Then PCkind = "Notebook"
If desc = 11 Then PCkind = "Hand Held"
If desc = 12 Then PCkind = "Docking Station"
If desc = 13 Then PCkind = "All in One"
If desc = 14 Then PCkind = "Sub Notebook"
If desc = 15 Then PCkind = "Space-Saving"
If desc = 16 Then PCkind = "Lunch Box"
If desc = 17 Then PCkind = "Main System Chassis"
If desc = 18 Then PCkind = "Expansion Chassis"
If desc = 19 Then PCkind = "SubChassis"
If desc = 20 Then PCkind = "Bus Expansion Chassis"
If desc = 21 Then PCkind = "Peripheral Chassis"
If desc = 22 Then PCkind = "Storage Chassis"
If desc = 23 Then PCkind = "Rack Mount Chassis"
If desc = 24 Then PCkind = "Sealed-Case PC"
ctype = "Chassis Types : ,"& desc &" - "& PCkind ''intType
objOutputFile.Write ctype
objoutputFile.WriteLine

Next
Next

Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_ComputerSystem")
for each System in SystemSet
system_name = System.Caption
system_type = System.SystemType
system_mftr = System.Manufacturer
system_model = System.Model
next

Set ProcSet = GetObject("winmgmts:").InstancesOf ("Win32_Processor")
for each System in ProcSet
proc_desc = System.Caption
proc_mftr = System.Manufacturer
proc_mhz = System.CurrentClockSpeed
next

Set BiosSet = GetObject("winmgmts:").InstancesOf ("Win32_BIOS")
for each System in BiosSet
bios_info = System.Version
next

Set ZoneSet = GetObject("winmgmts:").InstancesOf ("Win32_TimeZone")
for each System in ZoneSet
loc_timezone = System.StandardName
next

Set OS_Set = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in OS_Set
os_name = System.Caption
os_version = System.Version
os_mftr = System.Manufacturer
os_build = System.BuildNumber
os_dir = System.WindowsDirectory
os_locale = System.Locale
os_totalmem = System.TotalVisibleMemorySize
os_freemem = System.FreePhysicalMemory
os_totalvirmem = System.TotalVirtualMemorySize
os_freevirmem = System.FreeVirtualMemory
os_pagefilesize = System.SizeStoredInPagingFiles
next


strResponseText = ("OS Name: ," & os_name & Chr(10))
strResponseText = strResponseText & ("Version: ," & os_version & " Build " & os_build & Chr(10))
strResponseText = strResponseText & ("OS Manufacturer: ," & os_mftr & Chr(10))
strResponseText = strResponseText & ("System Name: ," & system_name & Chr(10))
strResponseText = strResponseText & ("System Manufacturer: ," & system_mftr & Chr(10))
strResponseText = strResponseText & ("System Model: ," & system_model & Chr(10))
strResponseText = strResponseText & ("System Type: ," & system_type & Chr(10))
strResponseText = strResponseText & ("Processor: ," & proc_desc & " " & proc_mftr & " ~" & proc_mhz & "Mhz" & Chr(10))
strResponseText = strResponseText & ("BIOS Version: ," & bios_info & Chr(10))
strResponseText = strResponseText & ("Windows Directory: ," & os_dir & Chr(10))
strResponseText = strResponseText & ("Locale: ," & os_locale & Chr(10))
strResponseText = strResponseText & ("Time Zone: ," & loc_timezone & Chr(10))
strResponseText = strResponseText & ("Total Physical Memory: ," & os_totalmem & "KB" & Chr(10))
strResponseText = strResponseText & ("Available Physical Memory: ," & os_freemem & "KB" & Chr(10))
strResponseText = strResponseText & ("Total Virtual Memory: ," & os_totalvirmem & "KB" & Chr(10))
strResponseText = strResponseText & ("Available Virtual Memory: ," & os_freevirmem & "KB" & Chr(10))
strResponseText = strResponseText & ("Page File Space : ," & os_pagefilesize & "KB" & Chr(10))


objOutputFile.Write strResponseText
objoutputFile.WriteLine





Please help me
KiD


Edited by kid (2005-04-13 10:51 AM)

Top
#137806 - 2005-04-13 11:37 AM Re: Help me........
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Hmmm... fairly easy to convert, however there are plenty of similar scripts already done like this.

Here is just one example.

My Computer Info

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 271 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.048 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org