Link to home
Start Free TrialLog in
Avatar of bbanis2k
bbanis2k

asked on

Need VB Script to automate file and registry edit

I need a VB Script to do the below:

Write the following to the file name appsrv.ini within the below directory:

Compress=Off

EncryptionLevelSession=EncRC5-0

C:\Program Files\Citrix\ICA Client\

I would like for it to add those entries to the ini during a startup script I will create.

It also needs to create the following registry entry:

HKLM\Software\Citrix\ICA Client\Engine\Configuration\Advanced\Canonicalization\TCP/IP

Add new REG_SZ

String Value  Name:Compress

Data:Compress  

Avatar of sirbounty
sirbounty
Flag of United States of America image

Try this...
Const iniName = "appsrv.ini"
Const iniLocation = "C:\Program Files\Citrix\ICA Client\"
Const ForAppending = 8   
Const HKLM = &H80000002
 
'Create/update file
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objFile
If Not objFSO.FolderExists(iniLocation) Then wscript.quit
If objFSO.FileExists (iniLocation & iniName) Then
  Set objFile = objFSO.OpenTextFile(iniLocation & iniName, ForAppending)
Else
  Set objFile = objFSO.CreateTextFile(iniLocation & iniName)
End If
 
objFile.WriteLine "Compress=Off"
objFile.WriteLine "EncryptionLevelSession=EncRC5-0"
objFile.Close
Set objFile = Nothing
 
'Create registry entry
Dim oReg : Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Citrix\ICA Client\Engine\Configuration\Advanced\Canonicalization\TCP/IP"
strValueName = "Compress"
strValue = "Compress"
oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue
 
Set oReg = Nothing
 

Open in new window

Avatar of bbanis2k
bbanis2k

ASKER

Can you configure it to resume on error and then exit without output to the client computer?

I don't follow?
What happens if it does not see that directory or has an issue reading the registry?
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This works great!
Glad I could help - thanx for the grade! :^)