DocMerit Comp 230 Week 5 Ilab Report Vbscript Modular Lab Report
DocMerit Comp 230 Week 5 Ilab Report Vbscript Modular Lab Report
written by
realer
Scan the QR-code and learn how you can also turn your class
notes, study guides into real cash today.
'Noemi Matos
'01-June-2016
'Week 5 iLab
'COMP230 - Prof. Sasha Perez
' Menu Driven Computer / Network Tests
' This VBScript program is run using the PC_Tests.cmd Batch Script
Set args = WScript.Arguments
WScript.Echo vbCrLf
Select Case args.Item(0)
Case "1"
Call System_Information
Case "2"
Call System_Memory_Size
Case "3"
Call OS_Version
Case "4"
Call Printers_Status
Case "5"
Call Logical_HDD_Information
Case Else
WScript.Echo chr(7) & chr(7) & "Error, Choices are 1..5 or x!!!"
End Select
Sub System_Information
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "The computer name is ............ " & _
WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
WScript.Echo "The Num of CPUs is .............. " & _
WshShell.ExpandEnvironmentStrings("%NUMBER_OF_PROCESSORS%")
WScript.Echo "The Processor Architecture is ... " & _
WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
End Sub
Sub System_Memory_Size
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
intRamMB = int((objComputer.TotalPhysicalMemory) /1048576)+1
Wscript.Echo "System Name ...... " & objComputer.Name _
& vbCrLf & "Total RAM ........ " & intRamMB & " MBytes."
next
End Sub
Sub OS_Version
strComputer = "."
'Noemi Matos
'01-June-2016
'Week 5 iLab
'COMP230 - Prof. Sasha Perez
Sub System_Information
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "The computer name is ............ " & _
WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")
WScript.Echo "The Num of CPUs is .............. " & _
WshShell.ExpandEnvironmentStrings("%NUMBER_OF_PROCESSORS%")
WScript.Echo "The Processor Architecture is ... " & _
WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
End Sub
Sub System_Memory_Size
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
intRamMB = int((objComputer.TotalPhysicalMemory) /1048576)+1
Wscript.Echo "System Name ...... " & objComputer.Name _
& vbCrLf & "Total RAM ........ " & intRamMB & " MBytes."
next
End Sub
Sub OS_Version
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
WScript.Echo "The Operating System Detected is Shown Below:" & vbCrLf
For Each objOperatingSystem in colOperatingSystems
WScript.Echo objOperatingSystem.Caption & "Version: " & _
objOperatingSystem.Version
next
End Sub
Sub Printers_Status
strComputer ="."
intPrinters = 1
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")
WScript.Sleep(1000)
For Each objItem In colItems
WScript.Echo _