Gr8 Thanks !!!
Here
is the csv version. Make sure to read the comments to make in work for
you. I am not much of a scriptor, but it works!
' A simple script to return asset tag
from all computers in active directory domain
' The output is
exported to a comma serparated file with the name
"service-tags.csv"
' Do not open the csv
file until the vbscript is done. You can make a copy of the file while
' the script is running and open the copy to see the
results. I may work on making the script
' you
need to edit the local_domain variable to what ever your domain
is
' you
can limit the search to a specific OU by using the example directly
below
Const
wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly =
&h20
Const ADS_SCOPE_SUBTREE = 2
Set objConnection =
CreateObject("ADODB.Connection")
Set objCommand =
CreateObject("ADODB.Command")
objConnection.Provider =
"ADsDSOObject"
objConnection.Open "Active Directory
Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = "Select Name, Location from '" & local_domain &
"' Where objectClass='computer'"
objCommand.Properties("Page
Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Sort On") = "name"
Set fso =
CreateObject("Scripting.FileSystemObject")
Set MyFile =
fso.CreateTextFile("service-tags.csv", True)
MyFile.Writeline ("Report
started " & Now())
MyFile.Writeline
("Computer,Serial,Name,Vendor,Status")
Set objRecordSet =
objCommand.Execute
objRecordSet.MoveFirst
Do Until
objRecordSet.EOF
On Error Resume
Next
strComputer =
objRecordSet.Fields("Name").Value
if (IsConnectible(strComputer, "",
"") OR (strComputer = ".")) Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT *
FROM Win32_ComputerSystemProduct", "WQL", wbemFlagReturnImmediately +
wbemFlagForwardOnly)
For each objItem in
colItems
MyFile.Writeline ( strComputer & "," &
objItem.IdentifyingNumber & "," & objItem.Name & "," &
objItem.Vendor & ",Reachable")
Next
Set
objItem = nothing
Set objWMIService =
nothing
else
MyFile.Writeline (
strComputer & ",,,,Unreachable")
end
if
Set strComputer = nothing
objRecordSet.MoveNext
Loop
MyFile.Writeline ("Report Ended "
& Now())
MyFile.Close
MsgBox ("DONE")
Function
IsConnectible(sHost,iPings,iTO)
If iPings = "" Then iPings =
2
If iTO = "" Then iTO = 750
Set oShell =
CreateObject("WScript.Shell")
Set oExCmd = oShell.Exec("ping -n "
& iPings _
& " -w " & iTO & " " &
sHost)
Select Case
InStr(oExCmd.StdOut.Readall,"TTL=")
Case 0 IsConnectible =
False
Case Else IsConnectible = True
End
Select
End Function
the one that goes to a csv would be nice also if u can
share.
regards,
The
asset id should be the Dell service if the service tag information is set
in the bios. If audit32 cannot read the service tag info it will set the
asset id the same as the TrackIT asset number. You need to make sure
that the service tag is actually readable. I have attached a script that
you can run on a remote computer to see if the service tag information is
there. I also have a version that will check multiple computers and
output to a csv file.
'
Script to return asset tag from computers.
strComputer = InputBox("Enter computer name or ip address",
_
"Enter computer name", "WS-")
If (IsNull(strComputer)) Or
(strComputer = "") Then
MsgBox "Please computer name or ip address
you wish to scan."
ExitScript
End If
'On
Error Resume Next
if (IsConnectible(strComputer, "", "") OR (strComputer =
".")) Then
Set objWMIService = GetObject("winmgmts:\\" &
strComputer & "\root\cimv2")
Set colItems =
objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL",
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For each objItem in
colItems
MSGBox ( objItem.IdentifyingNumber
)
Next
Set objItem = nothing
Set objWMIService =
nothing
else
MSGBox ( "Not Reachable" )
end if
Set
strComputer = nothing
Function IsConnectible(sHost,iPings,iTO)
If iPings = "" Then
iPings = 2
If iTO = "" Then iTO = 750
Set oShell =
CreateObject("WScript.Shell")
Set oExCmd = oShell.Exec("ping -n "
& iPings _
& " -w " & iTO & " " &
sHost)
Select Case
InStr(oExCmd.StdOut.Readall,"TTL=")
Case 0 IsConnectible
= False
Case Else IsConnectible = True
End
Select
End Function
Private Sub ExitScript()
WScript.Quit
End
Sub
Marty
All,
anyone have a procedure where we can associate/view
the inventoried new pc from the dell service
tag
to the asset id
??
i
did a few but it shows as asset id
425
thanks
Lou
YAHOO! GROUPS LINKS