Scripting to modify/create text file on Domain Machines

I need a script that does the following:

Deletes the file called "SyncClient.ini" located at

C:\Program Files\SMART Technologies\SMART Sync Student\


Creates a new file called "SyncClient.ini"

The contents of the file is:

#BEGIN

LanguageID=0000
Visible=0
AutoStart=1
ConnectTeacherID="Testing Supervisor"
ConnectIP="10.233.0.1"
StoreFilesToMyDocs=1
CustomSharedFolder=""
RedrawHooks=1000
MirrorDriver=1000
UnicastNoDelay=1
MulticastTTL=1
EnableChat=1
EnableQuestions=1
EnableFileTransfer=1
EnableHelp=0
DisplayExit=0
BroadcastZoomWindow=0
CtrlAltDelSettings=0
NICListLength=0
PasswordHash=""
NamingServerLoc=""
NamingServerPassedTest=0
SecurityUsed=0
ConnectionUsed=3
StudentIDMode=1
StudentID="_WORKSTATION_NAME_"
ActiveDirStudentIdField=""
EnableNICDefaultOrder=1
NTGroupListLength=0

#END


The only thing that needs changed is the StudentID= needs to be updated with the current workstation name.  I guess a WMI query will work.

So for example, on a workstation named "lab-1.student.gorton.edu" once the script is run it will have a file located at "C:\Program Files\SMART Technologies\SMART Sync Student\" named "SyncClient.ini" and the contents would be:


LanguageID=0000
Visible=0
AutoStart=1
ConnectTeacherID="Testing Supervisor"
ConnectIP="10.233.0.1"
StoreFilesToMyDocs=1
CustomSharedFolder=""
RedrawHooks=1000
MirrorDriver=1000
UnicastNoDelay=1
MulticastTTL=1
EnableChat=1
EnableQuestions=1
EnableFileTransfer=1
EnableHelp=0
DisplayExit=0
BroadcastZoomWindow=0
CtrlAltDelSettings=0
NICListLength=0
PasswordHash=""
NamingServerLoc=""
NamingServerPassedTest=0
SecurityUsed=0
ConnectionUsed=3
StudentIDMode=1
StudentID="lab-1"
ActiveDirStudentIdField=""
EnableNICDefaultOrder=1
NTGroupListLength=0




LVL 4
every1isevil2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jostranderCommented:
Does this work for you?
strFoldername="C:\Program Files\SMART Technologies\SMART Sync Student\"
strFilename="SyncClient.ini"

Set fso=CreateObject("Scripting.FileSystemObject")
Set WshNetwork=CreateObject("Wscript.Network")
Set WshShell=CreateObject("Wscript.Shell")

strComputername=WshNetwork.Computername

If fso.FolderExists(strFoldername)=False then
	WshShell.run "cmd /c md " & chr(34) & strFoldername & chr(34),0,true
End If

Set oFile=fso.OpenTextFile(strFoldername & strFileName,2,true)

oFile.WriteLine "LanguageID=0000"
oFile.WriteLine "Visible=0"
oFile.WriteLine "AutoStart=1"
oFile.WriteLine "ConnectTeacherID=""Testing Supervisor"""
oFile.WriteLine "ConnectIP=""10.233.0.1"""
oFile.WriteLine "StoreFilesToMyDocs=1"
oFile.WriteLine "CustomSharedFolder="""""
oFile.WriteLine "RedrawHooks=1000"
oFile.WriteLine "MirrorDriver=1000"
oFile.WriteLine "UnicastNoDelay=1"
oFile.WriteLine "MulticastTTL=1"
oFile.WriteLine "EnableChat=1"
oFile.WriteLine "EnableQuestions=1"
oFile.WriteLine "EnableFileTransfer=1"
oFile.WriteLine "EnableHelp=0"
oFile.WriteLine "DisplayExit=0"
oFile.WriteLine "BroadcastZoomWindow=0"
oFile.WriteLine "CtrlAltDelSettings=0"
oFile.WriteLine "NICListLength=0"
oFile.WriteLine "PasswordHash="""""
oFile.WriteLine "NamingServerLoc="""""
oFile.WriteLine "NamingServerPassedTest=0"
oFile.WriteLine "SecurityUsed=0"
oFile.WriteLine "ConnectionUsed=3"
oFile.WriteLine "StudentIDMode=1"
oFile.WriteLine "StudentID=""" & strComputername & """"
oFile.WriteLine "ActiveDirStudentIdField="""""
oFile.WriteLine "EnableNICDefaultOrder=1"
oFile.WriteLine "NTGroupListLength=0"

oFile.close


msgbox "All done!",vbInformation,strFilename

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
every1isevil2Author Commented:
Looks like gold to me.  Let me test it out and get back with you.  Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.