Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8119327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:46:23+00:00 2026-06-06T04:46:23+00:00

I am currently writing a script which parses the ServiceTage, Computername and Username from

  • 0

I am currently writing a script which parses the ServiceTage, Computername and Username from a computer and outputs it to a text file on a share, but it seems that it always overwrites the data there rather than adding to it.

The code is as follows:

'Get Dell Service Tag Info
set ProSet = GetObject("winmgmts:").InstancesOf("Win32_BIOS")
Set ProSet1 = GetObject("winmgmts:").InstancesOf("Win32_SystemEnclosure")
For each Pro in ProSet
  For each Pro1 in ProSet1
    ServiceTag=Pro.SerialNumber
    exit for
  Next
  exit for
Next

'get username and computername, could also be asked in a batch
Set oShell     = WScript.CreateObject("WScript.Shell")
Set oShellEnv  = oShell.Environment("Process")
sComputerName  = oShellEnv("ComputerName")
sUsername      = oShellEnv("username")

dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("\\xx.xx.xx.xx\Support\DataLog.txt", 8, True)
path = filesys.GetAbsolutePathName("\\xx.xx.xx.xx\Support\DataLog.txt")
getname = filesys.GetFileName(path)
filetxt.WriteLine sUsername & ", " & sComputerName & ", " & ServiceTag
filetxt.Close

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:46:26+00:00Added an answer on June 6, 2026 at 4:46 am

    Straight from the VBScript Docs:

    object.CreateTextFile(filename[, overwrite[, unicode]])
    
    object.OpenTextFile(filename[, iomode[, create[, format]]])
    

    From your code:

    Set filetxt = filesys.CreateTextFile(filename, 8, True)
    

    Diagnosis:

    You call .CreateTextFile() with the parameters of .OpenTextFile()

    Remedy:

    Use .OpenTextFile():

    Set filetxt = filesys.OpenTextFile(filename, 8, True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently writing a Powershell script that's used to select a user from Active
I'm currently writing a little commercial PHP Script which would be a VPN (PPTP)
I'm currently writing an msbuild script to publish a solution, which is all fine
I am writing a script which is likely to be modified by users. Currently
I'm currently working on an AJAX file upload script, which works like a charm
I'm writing a shell script which parses the path of the current working directory
I'm currently writing a script editing app in c# to edit game scripts. I
well i am currently writing a script that is meant to check the logs
I'm currently writing a PHP script for a guestbook in PHP where people can
I'm currently writing a ToDo-Script for a project i have running. Now there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.