Solved

need a script to change one line within a java settings file

Posted on 2013-11-26
3
1,358 Views
Last Modified: 2013-11-28
we need to Change the Setting
deployment.security.level   to MEDIUM like displayed at the code at the bottom
within
%userprofile%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

this line can have some different Settings or completely missing
other lines should not be altered
the user should call the script while logging in or before starting the app.

#deployment.properties
#Tue Nov 26 11:29:51 CET 2013
deployment.expiration.decision.timestamp.10.40.2=1385050638
deployment.security.level=MEDIUM
Sun\\Java\\Deployment\\cache\\6.0\\splash\\splash.xml
deployment.version=7.21

I am unable do write scripts ... can someone help me please?
0
Comment
Question by:Dirk Kotte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39677454
Try this, in powershell:

# name and path of the file
$file = %userprofile%\AppData\LocalLow\Sun\Java\Deployment\deployment.properties

# delete the line containing deployment.security.level, if it exists
(Get-Content $file) | Foreach-Object {$_ -replace "^deployment\.security\.level=.*?$", ""} |
Set-Content $file

# add the required line
echo "deployment.security.level=MEDIUM" >> $file


HTH,
Dan
0
 
LVL 24

Author Comment

by:Dirk Kotte
ID: 39677498
great, nearly perfect :-)
$file = %userprofile%\AppData\Loc...    has to be
$file = "$env:userprofile\AppData\Local...

but results in leading spaces and a space between every character...:
...
deployment.javaws.jre.0.args=
   d e p l o y m e n t . s e c u r i t y . l e v e l = M E D I U M
0
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 500 total points
ID: 39677533
It should of been
echo "`ndeployment.security.level=MEDIUM" >> $file

to force a new line.

Yes, you're right, it's $env:userprofile . I wrote the script for a text file and then copied your path :)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This video teaches viewers about errors in exception handling.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question