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

  • SEARCH
  • Home
  • 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 8113261
In Process

The Archive Base Latest Questions

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

I have created a VBScript which pulls the service tag, username, and computer name

  • 0

I have created a VBScript which pulls the service tag, username, and computer name from a computer. What I need to do now is compile this information in a text document.

How it’s set up is as follows:

We have an Active Directory Server, with a folder for login scripts. I have created a batch file to run this .vbs script, and the script works well so far. What I now need is for a file on the AD server, called “logging.txt”, to be populated with the information that is created with the .vbs script.

This is the script I have so far:

'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
    wscript.echo ServiceTag
    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")
wscript.echo sComputerName & " " & sUsername

Thank you very much in advance!

This is what I’ve tried so far:

sub log (user, computer)
  dim fs,f
  set fs=Server.CreateObject("Scripting.FileSystemObject")
  set f=fs.OpenTextFile(Server.MapPath(".\logging.csv"),8,true)
  f.WriteLine now & "," & user & "," & computer
  f.Close:set f=Nothing
  set fs=Nothing
end sub
  • 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-06T02:46:24+00:00Added an answer on June 6, 2026 at 2:46 am

    I feel as though you’re leaving something out.. this is how to write a text file in VBS.

    dim filesys, filetxt, getname, path
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set filetxt = filesys.CreateTextFile("c:\somefile.txt", True)
    path = filesys.GetAbsolutePathName("c:\somefile.txt")
    getname = filesys.GetFileName(path)
    filetxt.WriteLine("Your text goes here.")
    filetxt.Close
    If filesys.FileExists(path) Then
       Response.Write ("Your file, '" & getname & "', has been created.")
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a simple public ref class in the vc++ project, which is
I am trying to call a method I have written in C# from VBScript.
I created a dynamic table in ASP/VBScript that populates a table from a recordset.
I have a VBScript that does a number of tasks, including moving files from
Context: Windows7, VBScript, ADODB and ADOX. I have written some VBScript code which creates
I need to create vbscript which will create new folder 'test' and subfolder 'Output'.There
Today I have just thrown together this PowerShell script which takes a tab-delimited text
I have a form which is submitted to a PHP page. The data from
I need to prompt for a username and password from a batch script subroutine
We have a large framework created using VB Script, which has been created and

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.