Re: Network Script Help
- From: Paul <paulholding5@xxxxxxxxxxx>
- Date: Tue, 22 Aug 2006 12:13:53 +0100
There are a couple of ways of doing it, you can get your network admin to create a group policy and then use it as either a startup or shutdown script or you can edit it so that the line:
strComputer = "."
has the actual computer name instead of the . You will need to have full access to the PC that it is being run on as well, but i'm not sure that will work correctly.
I use the first way as that way you can leave the policy active for a few weeks to make sure you get all of the machines as it will run on then as they either startup of shutdown. Then disable the policy. That is for (Win2k / Win2k3 / WinXP)
The script will work as is once you have entered the path for the output files, and made sure that it has the correct permissions not sure what they are off the top of my head.
Paul.
lmossolle wrote:
I am somewhat new to this, could you assist me in making this operational?.
Lee
"Paul" wrote:
If you are able to create a group policy on your network try the following as a startup or shutdown script:
You will need to change it so it puts the files where you need them. Feel free to edit as you need.
'==============================================================================
'LANG :VBScript
'NAME :Paul Holding
'AUTHOR :Mossbourne Network Support
'DATE :14 Feb 2005
'DESCRIPTION :Computer Inventory Script for Assets
'COMMENT :Writes to .CSV File
'
'KEYWORDS :Inventory
'===============================================================================
'===============================================================================
'Variable Declarations
Const ForAppending = 8
'===============================================================================
'===============================================================================
'Main Body
On Error Resume Next
CompName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Get Operation System & Processor Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
CompName = objItem.SystemName
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
if objFSO.FileExists("<Enter UNC Path to where you want the files written>" & CompName & "_Hardware.csv") then
WScript.Quit
end if
'Set the file location to collect the data
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("<Enter UNC Path to where you want the files written>" & CompName & "_Hardware.csv", ForAppending, True)
'Get Operation System & Processor Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
objTextFile.Write "System Name: " & "," & objItem.SystemName & VBCRLF
objTextFile.Write "Processor: " & "," & objItem.Name & VBCRLF
Next
'Get Main Board Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard",,48)
For Each objItem in colItems
objTextFile.Write "Mainboard Manufacture: " & "," & objItem.Manufacturer & VBCRLF
objTextFile.Write "MainBoard Product: " & "," & objItem.Product & VBCRLF
Next
'Get BIOS Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
objTextFile.Write "BIOS Manufacture: " & "," & objItem.Manufacturer & VBCRLF
objTextFile.Write "BIOS Ver: " & "," & objItem.Version & VBCRLF
Next
'Get Total Physical memory
Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
objTextFile.Write "Total RAM: " & "," & objComputer.TotalPhysicalMemory & VBCRLF
Next
'Get Physical Disk Size and Partision Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive",,48)
For Each objItem in colItems
objTextFile.Write "Disk Size: " & "," & objItem.Size & VBCRLF
objTextFile.Write "Disk Partition: " & "," & objItem.Partitions & VBCRLF
Next
'Get the Video Contoller Information (Memory, Description, Processor etc..)
Set colItems = objWMIService.ExecQuery("Select * from Win32_VideoController",,48)
For Each objItem in colItems
objTextFile.Write "VGA Compatable: " & "," & objItem.AdapterCompatibility & VBCRLF
objTextFile.Write "VGA RAM: " & "," & objItem.AdapterRAM & VBCRLF
objTextFile.Write "VGA Name: " & "," & objItem.Name & VBCRLF
objTextFile.Write "VGA Processor: " & "," & objItem.VideoProcessor & VBCRLF
Next
'Get The Keyboard Information (Description)
Set colItems = objWMIService.ExecQuery("Select * from Win32_Keyboard",,48)
For Each objItem in colItems
objTextFile.Write "Keyboard: " & "," & objItem.Description & VBCRLF
Next
'Get The Mouse Information (Description)
Set colItems = objWMIService.ExecQuery("Select * from Win32_PointingDevice",,48)
For Each objItem in colItems
objTextFile.Write "Mouse: " & "," & objItem.Description & VBCRLF
Next
'Get The CD ROM Drive Information (Model Name)
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive",,48)
For Each objItem in colItems
objTextFile.Write "CD Rom: " & "," & objItem.Caption & VBCRLF
Next
'Get USB Information
Set colItems = objWMIService.ExecQuery("Select * from Win32_USBController",,48)
For Each objItem in colItems
objTextFile.Write "USB Controller: " & "," & objItem.Caption & VBCRLF
Next
'Get The Network Adapter Information (Type and MAC Address)
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
For Each objItem in colItems
objTextFile.Write "Network Adapter Name: " & "," & objItem.Name & VBCRLF
objTextFile.Write "Network Adapter MAC: " & "," & objitem.Macaddress & VBCRLF
Next
'Get The Network Adapter IP Address
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration",,48)
For Each objItem in colItems
objTextFile.Write "Network Adapter IP: " & "," & objItem.IPAddress & VBCRLF
Next
objTextFile.Write VbCrLf
objTextFile.Close
'WScript.Echo "Inventory Complete"
'===============================================================================
'===============================================================================
'Procedures
'===============================================================================
Enjoy.
Paul.
lmossolle wrote:
I also need to add in the Workstation name. I have 300 pieces of equipment....
Thanks in advance!
"lmossolle" wrote:
Could someone please help with a VBS that reads in IP addresses from the root of the c:\ that outputs IP Address, MAC Address, CPU Make, CPU Model, CPU Serial Number and user logged on the domain to a text file or XLS? Please assist.
Lee
- References:
- Re: Network Script Help
- From: Paul
- Re: Network Script Help
- From: lmossolle
- Re: Network Script Help
- Prev by Date: Re: Network Script Help
- Next by Date: Outlook 2003 default signature reg key
- Previous by thread: Re: Network Script Help
- Next by thread: Outlook 2003 default signature reg key
- Index(es):
Relevant Pages
|