/build/static/layout/Breadcrumb_cap_w.png

Add to Path Envronment Variable

AdminStudio 10
Windows 7

I am trying to add to the Path system Environment Variable through a transform and just can't seem to get it to work.
Should it work, and if so, should it work on Windows 7?

0 Comments   [ + ] Show comments

Answers (14)

Posted by: anonymous_9363 12 years ago
Red Belt
2
- Have you taken a verbose log of the install to check whether your transform is being applied?
- Are you adding to the System environment or the User environment? If the former, be aware that the Windows Installer engine is dumb in that, after adding to the System environment, it does not broadcast the change to Windows, meaning that you need to reboot to bring the change into effect.
Posted by: mukhtar 5 years ago
Orange Belt
0

You can do it in the MSI environment variable and Path:Table Name = Environment

NewEnvironment2 *=-PATH [~];c:\oreclient\instantclient_12_1 NetUsers.exe

NewEnvironment1 *=-OCI_LIB64 [~];c:\oreclient\instantclient_12_1 NetUsers.exe

 

This can also be done via Powershell also:

if (-not (Test-Path env:TNS_NAMES)) 

{

  [Environment]::SetEnvironmentVariable('TNS_NAMES', 'C:\Oracle\instantclient_12_1', 'Machine')

}

Else

{

Write-Host "Variable exists"

}




Function Global:Add-Path {

<#.SYNOPSIS

PowerShell function to modify Env:Path in the registry

.DESCRIPTION

Includes a parameter to append the Env:Path

.EXAMPLE

Add-Path -NewPath "D:\Downloads"

#>

Param (

[String]$NewPath ="C:\Oracle\instantclient_12_1"

)

Begin {

Clear-Host

} # End of small begin section

Process {

Clear-Host

$Reg = "Registry::HKLM\System\CurrentControlSet\Control\Session Manager\Environment"

$OldPath = (Get-ItemProperty -Path "$Reg" -Name PATH).Path

$NewPath = $OldPath + ’;’ + $NewPath

Set-ItemProperty -Path "$Reg" -Name PATH –Value $NewPath -Force

    } #End of Process

}



Add-Path


Posted by: itolutions 12 years ago
Purple Belt
0
Check installExecuteSequence table for "WriteEnviromentStrings" action
Posted by: itolutions 12 years ago
Purple Belt
0
Should it work, and if so, should it work on Windows 7?
should
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
Thanks for your replies.

Yes, the transform is being applied because other actions, such as copying files and adding reg entries, are working.

installExecuteSequence / "WriteEnviromentStrings" = PERL_PATH

I tried again with a reboot and no difference. Below is the log. I'm not sure which step would indicate whether it failed or not.

=== Logging started: 2011-05-10 08:47:28 ===
Action start 08:47:28: INSTALL.
Action start 08:47:28: SetRootDrive.
Action ended 08:47:28: SetRootDrive. Return value 1.
Action start 08:47:28: AppSearch.
Action ended 08:47:28: AppSearch. Return value 1.
Action start 08:47:28: FindRelatedProducts.
Action ended 08:47:28: FindRelatedProducts. Return value 1.
Action start 08:47:28: LaunchConditions.
Action ended 08:47:28: LaunchConditions. Return value 1.
Action start 08:47:28: ValidateProductID.
Action ended 08:47:28: ValidateProductID. Return value 1.
Action start 08:47:28: CostInitialize.
Action ended 08:47:28: CostInitialize. Return value 1.
Action start 08:47:28: FileCost.
Action ended 08:47:28: FileCost. Return value 1.
Action start 08:47:28: CostFinalize.
Action ended 08:47:28: CostFinalize. Return value 1.
Action start 08:47:28: MigrateFeatureStates.
Action ended 08:47:28: MigrateFeatureStates. Return value 0.
Action start 08:47:28: SetODBCFolders.
Action ended 08:47:28: SetODBCFolders. Return value 1.
Action start 08:47:28: InstallValidate.
Action ended 08:47:29: InstallValidate. Return value 1.
Action start 08:47:29: SetInstallLocation.
Action ended 08:47:29: SetInstallLocation. Return value 1.
Action start 08:47:29: InstallInitialize.
Action ended 08:47:29: InstallInitialize. Return value 1.
Action start 08:47:29: AllocateRegistrySpace.
Action ended 08:47:29: AllocateRegistrySpace. Return value 1.
Action start 08:47:29: ProcessComponents.
Action ended 08:47:30: ProcessComponents. Return value 1.
Action start 08:47:30: UnpublishComponents.
Action ended 08:47:30: UnpublishComponents. Return value 1.
Action start 08:47:30: UnpublishFeatures.
Action ended 08:47:30: UnpublishFeatures. Return value 1.
Action start 08:47:30: StopServices.
Action ended 08:47:30: StopServices. Return value 1.
Action start 08:47:30: DeleteServices.
Action ended 08:47:30: DeleteServices. Return value 1.
Action start 08:47:30: UnregisterComPlus.
Action ended 08:47:30: UnregisterComPlus. Return value 1.
Action start 08:47:30: SelfUnregModules.
Action ended 08:47:30: SelfUnregModules. Return value 1.
Action start 08:47:30: UnregisterTypeLibraries.
Action ended 08:47:30: UnregisterTypeLibraries. Return value 1.
Action start 08:47:30: RemoveODBC.
Action ended 08:47:30: RemoveODBC. Return value 1.
Action start 08:47:30: UnregisterFonts.
Action ended 08:47:30: UnregisterFonts. Return value 1.
Action start 08:47:30: RemoveRegistryValues.
Action ended 08:47:30: RemoveRegistryValues. Return value 1.
Action start 08:47:30: UnregisterClassInfo.
Action ended 08:47:30: UnregisterClassInfo. Return value 1.
Action start 08:47:30: UnregisterExtensionInfo.
Action ended 08:47:30: UnregisterExtensionInfo. Return value 1.
Action start 08:47:30: UnregisterProgIdInfo.
Action ended 08:47:30: UnregisterProgIdInfo. Return value 1.
Action start 08:47:30: UnregisterMIMEInfo.
Action ended 08:47:30: UnregisterMIMEInfo. Return value 1.
Action start 08:47:30: RemoveIniValues.
Action ended 08:47:30: RemoveIniValues. Return value 1.
Action start 08:47:30: RemoveShortcuts.
Action ended 08:47:30: RemoveShortcuts. Return value 1.
Action start 08:47:30: RemoveEnvironmentStrings.
Action ended 08:47:30: RemoveEnvironmentStrings. Return value 1.
Action start 08:47:30: RemoveDuplicateFiles.
Action ended 08:47:30: RemoveDuplicateFiles. Return value 1.
Action start 08:47:30: RemoveFiles.
Action ended 08:47:30: RemoveFiles. Return value 1.
Action start 08:47:30: RemoveFolders.
Action ended 08:47:30: RemoveFolders. Return value 1.
Action start 08:47:30: CreateFolders.
Action ended 08:47:30: CreateFolders. Return value 1.
Action start 08:47:30: MoveFiles.
Action ended 08:47:30: MoveFiles. Return value 1.
Action start 08:47:30: InstallFiles.
Action ended 08:47:31: InstallFiles. Return value 1.
Action start 08:47:31: DuplicateFiles.
Action ended 08:47:31: DuplicateFiles. Return value 1.
Action start 08:47:31: PatchFiles.
Action ended 08:47:31: PatchFiles. Return value 1.
Action start 08:47:31: BindImage.
Action ended 08:47:31: BindImage. Return value 1.
Action start 08:47:31: CreateShortcuts.
Action ended 08:47:31: CreateShortcuts. Return value 1.
Action start 08:47:31: RegisterClassInfo.
Action ended 08:47:31: RegisterClassInfo. Return value 1.
Action start 08:47:31: WriteRegistryValues.
Action ended 08:47:31: WriteRegistryValues. Return value 1.
Action start 08:47:31: WriteIniValues.
Action ended 08:47:31: WriteIniValues. Return value 1.
Action start 08:47:31: RegisterFonts.
Action ended 08:47:31: RegisterFonts. Return value 1.
Action start 08:47:31: InstallODBC.
Action ended 08:47:31: InstallODBC. Return value 0.
Action start 08:47:31: RegisterTypeLibraries.
Action ended 08:47:31: RegisterTypeLibraries. Return value 1.
Action start 08:47:31: SelfRegModules.
Action ended 08:47:31: SelfRegModules. Return value 1.
Action start 08:47:31: RegisterComPlus.
Action ended 08:47:31: RegisterComPlus. Return value 1.
Action start 08:47:31: InstallServices.
Action ended 08:47:31: InstallServices. Return value 1.
Action start 08:47:31: StartServices.
Action ended 08:47:31: StartServices. Return value 1.
Action start 08:47:31: RegisterUser.
Action ended 08:47:31: RegisterUser. Return value 1.
Action start 08:47:31: SetPPM_TRACK6056.
Action ended 08:47:31: SetPPM_TRACK6056. Return value 1.
Action start 08:47:31: RegisterProduct.
Action ended 08:47:31: RegisterProduct. Return value 1.
Action start 08:47:31: PublishComponents.
Action ended 08:47:31: PublishComponents. Return value 1.
Action start 08:47:31: PublishFeatures.
Action ended 08:47:31: PublishFeatures. Return value 1.
Action start 08:47:31: PublishProduct.
Action ended 08:47:31: PublishProduct. Return value 1.
Action start 08:47:31: ConfigurePerl.
Action ended 08:47:31: ConfigurePerl. Return value 1.
Action start 08:47:31: CONFIGURE_PPM2.
Action ended 08:47:31: CONFIGURE_PPM2. Return value 1.
Action start 08:47:31: RelocatePerl.
Action ended 08:47:31: RelocatePerl. Return value 1.
Action start 08:47:31: GenerateHTML.
Action ended 08:47:31: GenerateHTML. Return value 1.
Action start 08:47:31: InstallFinalize.
Action ended 08:49:58: InstallFinalize. Return value 1.
Action ended 08:49:58: INSTALL. Return value 1.
MSI (s) (C4:68) [08:49:58:654]: Product: ActivePerl 5.6.1 Build 638 -- Installation operation completed successfully.

MSI (s) (C4:68) [08:49:58:670]: Windows Installer installed the product. Product Name: ActivePerl 5.6.1 Build 638. Product Version: 5.6.638. Product Language: 1033. Manufacturer: ActiveState. Installation success or error status: 0.

=== Logging stopped: 2011-05-10 08:49:58 ===
Posted by: timmsie 12 years ago
Fourth Degree Brown Belt
0
what does your entry in the environment table look like?

you want your log to be a bit more verbose /l*vx
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
From ORCA.

Environment = NewEnvironment1
Name = *+-Path
Value = [INSTALLDIR]bin;[~]
Component = _cff2fc4b3373b379e1b060ad865b95a6

I am creating the mst in AdminStudio 10, but I opened it in ORCA to read the table. I have tried making the change with ORCA, but msiexec complained that the mst was corrupted.
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
I can't seem to post the log here because of its size. What should i be looking for in the log?
Posted by: timmsie 12 years ago
Fourth Degree Brown Belt
0
I would say you want *=-PATH

I think with the + it will only create it if it doesn't exist and obviously the PATH statement will always exists.

EDIT - just tested on xp and +-/=- seem to do the same thing

look for something like this in your log

Action 15:03:08: WriteEnvironmentStrings. Updating environment strings...
MSI (s) (38:C8) [15:03:08:280]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=13200)
MSI (s) (38:C8) [15:03:08:280]: Executing op: UpdateEnvironmentStrings(Name=PATH,Value=[INSTALLDIR]bin,Delimiter=;,Action=-1610612735,)
MSI (c) (24:28) [15:03:08:280]: Note: 1: 2262 2: Billboard 3: -2147287038
WriteEnvironmentStrings: Name: PATH
Value:[INSTALLDIR]bin

If not, next thing is, are there any conditions on the component or feature that the component belongs to
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
For some reason, it looks like its skipping the step.
MSI (s) (1C:AC) [10:32:16:000]: Skipping action: WriteEnvironmentStrings (condition is false)

Any ideas as to why?

I can't seem to find a setting that would tell it to skip that step. I can set the value manually or using the set cmd so I don't think its a policy.
Posted by: anonymous_9363 12 years ago
Red Belt
0
Look in the InstallExecuteSequence table. There is a condition on the WriteEnvironmentStrings action which is evaluating to False. My guess is that it would be a test against 'NTVersion'.
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
Both Wise and AdminStudio set it to the same. Confirmed with ORCA. The only difference between the 2 is the Name. AdminStudio has the it *=-Path and Wise has it =-Path.

Its set to installExecuteSequence / "WriteEnviromentStrings" = PERL_PATH
Posted by: jmaclaurin 12 years ago
Third Degree Blue Belt
0
I crated an empty MSI that only changes the path environment variable and it worked no problem. Looks like its a problem with the original MSI. I don't want to repackage it so I will just use this as a workaround.

Thanks for your help!
Posted by: timmsie 12 years ago
Fourth Degree Brown Belt
0
so are you saying that when you look at the InstallExecuteSequence table the WriteEnvironmentStrings row has the value of PERL_Path in the Condition column?

if so remove the condition
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ