[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 675
  • Last Modified:

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




0
every1isevil2
Asked:
every1isevil2
1 Solution
 
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
 
every1isevil2Author Commented:
Looks like gold to me.  Let me test it out and get back with you.  Thanks!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now