Anyone any good at VB Scripts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • S2 Ant
    S2Forum Possessed
    • Jul 2003
    • 3682
    • Country: United Kingdom

    #1

    Anyone any good at VB Scripts?

    Im trying to write a simple script to get all the service tag numbers from our Dell systems, but for some reason its not working and i must have been looking at it too much cos i cant see what ive missed.

    arrComputers =

    Array("uk01ws03","uk01ws04","uk01ws06","uk01ws07", "uk01ws08","uk01ws09","uk01ws10","uk01ws12","uk01w s14","uk01ws15","uk01ws16"

    ,"uk01ws17","uk01ws18","uk01ws20","uk01ws21","uk01 ws22","uk01ws23","uk01ws24","uk01ws25","uk01ws26")
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_BIOS",,48)
    Set objFS = CreateObject("Scripting.FileSystemObject")
    Set objNewFile = objFS.CreateTextFile("output.csv")
    objNewFile.WriteLine "Network Name,Service Tag"
    For Each strComputer In arrComputers
    objNewFile.WriteLine Network Name: " & objItem.Name & "," & "Tag Number: " & objItem.SerialNumber
    Next
    objNewFile.Close
    It should connect to the systems stated in the array and then create a CSV file with 2 headings for network name and service tag.

    Am i being thick or what here?
    Ant

    2007 Mk5 Golf GTi, 3 door, DSG, REVO Stg 2 and other goodies
    2011 Kawasaki Z1000

  • BRY
    S2Forum Possessed
    • Nov 2004
    • 3755
    • Home: United Nations Current: Vietnam

    #2
    Can we have a new computer code section? :mischeif:
    Kingdoms are run by Kings, Dictatorships are run by Dictators.
    England must be a Country. :mischeif:

    Comment

    Working...