myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


Script that pulls data from text file and creates registry keys

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Scripting Technologies] >> VB Script >> Script that pulls data from text file and creates registry keys Page: [1]
Login
Message << Older Topic   Newer Topic >>
Script that pulls data from text file and creates regis... - 6/26/2008 1:59:03 PM   
jscott607

 

Posts: 208
Score: 0
Joined: 9/20/2005
Status: offline
I am trying to pull information from a text file and then create registry keys with the information. So far, I am not having much luck.

The text file has information like what I have below. I am trying to get the script to read the text file and look for the share information. Once it finds that information, it creates one registry entry for Share 1 with \\uschmfp1\test$ as the value and another entry for Share 2 with \\uschmfp1\user1$  as the value. These shares will not be static and would vary for each system.

Binary file information:
File.......: C:\WINDOWS\system32\CSCDLL.DLL
Size.......: 101,888 bytes
Created....: 8/4/2004 8:00:00 AM
File.......: C:\WINDOWS\system32\CSCUI.DLL
Size.......: 326,656 bytes
Created....: 8/4/2004 8:00:00 AM
File.......: C:\WINDOWS\system32\drivers\MRXSMB.SYS
Size.......: 453,120 bytes
Created....: 8/4/2004 8:00:00 AM
File.......: C:\WINDOWS\system32\drivers\RDBSS.SYS
Size.......: 174,592 bytes
Created....: 8/4/2004 8:00:00 AM
Cache information:
CSC enabled..............: Yes
Volume...................: C:\
Bytes on volume..........: 80,015,519,744
Max auto-cache bytes.....: 2,147,483,647 (2.68% of volume)
Current auto-cache bytes.: 12,288 (0.00% of max)
Files in cache...........: 38
Directories in cache.....: 47
Cache encrypted?.........: No
Share                         Status           Files      Dirs    Pinned  Modified    Sparse      USER     GUEST     OTHER  Offline?  OpenFiles?
\\uschmfp1\test$          0x00330000          27        36        63         0         0         4         0        27        No          No
\\uschmfp1\user1$          0x00030A00           3         9         7         0         0         3         0         0        No          No
SUMMARY                                           30        45        70         0         0         7         0        27         0           0


My script is below. At this point, I can only get it to create one registry entry and it uses the last share as the value. Does anyone have advice? Any assistance would be greatly appreciated.

Const ForReading = 1

strComputer = "."
strFile = "C:\windows\logs\offline.txt"
intCount = 0
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Offline_Share"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(strFile, ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.Readline

If strLine <> "" Then
 arrLine = Split(strLine, " ")
 If arrLine(0) = "Share" Then
  intCount = intCount + 1
 ElseIf arrLine(0) = "SUMMARY" Then
  intCount = intCount + 1
 ElseIf intCount = 1 Then
  strShare = arrLine(0)
  WScript.Echo strShare
   
  strKeyPath = "SOFTWARE\Offline_Share"
  strShare1 = "Share 1"
  strShare1Value = strShare
     oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strShare1,strShare1Value
  
 End If
End If
Loop

objFile.Close
Post #: 1
RE: Script that pulls data from text file and creates r... - 6/27/2008 8:34:52 AM   
jscott607

 

Posts: 208
Score: 0
Joined: 9/20/2005
Status: offline
I no longer need assistance. Thanks

(in reply to jscott607)
Post #: 2
Page:   [1]
All Forums >> [Scripting Technologies] >> VB Script >> Script that pulls data from text file and creates registry keys Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.297