Skip to content

Commit d4ae119

Browse files
committed
Added OverwriteUT option to overwrite existing UsageTracking file.
1 parent 1b537df commit d4ae119

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

JavaUsageTracking.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$LogFile = (Get-ItemProperty -Path "HKLM:\Software\Microsoft\SMS\Client\Configuration\Client Properties" -Name "Local SMS Path").'Local SMS Path' + "Logs\CM_JavaUsageLogging.log"
22
$LoggingEnable = $True
33
$UTLogFileName = ".java_usage_cm"
4+
$OverwriteUT = $false
45

56
##########################################################################################################
67

@@ -130,7 +131,7 @@ ForEach ($JRE in $JREs) {
130131
$JREPath = test-path "$($JRE.JavaHome)\lib\management"
131132
if ($JREPath) {
132133
$UTProps = test-path "$($JRE.JavaHome)\lib\management\usagetracker.properties"
133-
if (-Not $UTProps) {
134+
if (-Not $UTProps -or $OverwriteUT) {
134135
IF ($LoggingEnable -eq $true) {Log-ScriptEvent -Value "Creating $($JRE.JavaHome)\lib\management\usagetracker.properties" -Severity 1}
135136
Create-UsageTrackingProps -UTPath "$($JRE.JavaHome)\lib\management\usagetracker.properties"
136137
} else {

0 commit comments

Comments
 (0)