System environment variable created during install not available to current user until reboot - installation

I have a msi package generated by wix that creates a system environment variable by populating the Environment table.
<Environment Id="CreateEnvVar" Name="DATADIR" Action="set"
System="yes" Part="all" Value="[DATA_DIR]" />
The install successfully creates the environment variable at the system level. This was verified by viewing the Environment Variables dialog from System Properties
However the currently logged in user does not have access to the newly created environment variables until the machine is rebooted ( I'm assuming that logging out then back in would also work. Just have not tried it yet). Executing an application that was just installed fails because it does not have access to the DATADIR variable.
Also, opening up a command prompt after the installation is complete the DATADIR variable does not appear when executing the set command.
I understand that a process started before executing the MSI would not get the new variables. However, why wouldn't a process started after the environment variables are added get the new ones?
FYI, I am installing on Windows Server 2003 and I am logged in through remote desktop with a user in the Administrators group.

Are you installing via Remote Desktop? If so, ensure you are using the admin console session.
To do so, launch Remote Desktop using:
mstsc /admin
Or if you are using the latest version of RDP, it is now:
mstsc /console
Try installing it from this session (or locally) and let me know the result.

Related

Installing JBOSS EAP 7.4 on Windows Server – Account and Shutdown problems

I´m trying to install JBOSS EAP 7.4 on Windows Server as a service and I´m having trouble with two issues. All batch files where executed from the command line (cmd.exe) in admin mode.
Installation of Service with local system account
I´m using the service.bat to install it as a service. When checking in the properties of the service for the user context, it says it was installed under a Local Service user.This leads to numerous errors in the startup log, as the service is not allowed to access the file system in R/W mode. Manually setting this to “Local System Account” solves the problem, it runs just fine.
So, how do I configure the installation script that the service will use “Local System Account” or, how can I grant R/W access to this “Local Service”?
Shutdown
The manual states, that you must use the parameter /jbossuser (and password) for the installation. If I don´t, it is not possible to shut down the service via the Windows Services Tool, timeout…
If I add a user to the installation, it can be shutdown. As long as it runs in the “Local Service” context. If I change it to Local System Account, it doesn´t shutdown anymore, timeout…
Beside, this is a productive installation on a virtual server. It will not be possible to have a permanent, dedicated user on such a machine.
How do I configure this correctly?
Current installation params, generated by the service.bat:
"D:\jboss-eap-7.4.6\jboss-eap-7.4\bin\prunsrv.exe" install MyApp
--DisplayName=MyApp
--Description="JBoss Enterprise Application Platform 7"
--LogLevel=INFO
--LogPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\standalone\log"
--LogPrefix=service
--StdOutput=auto
--StdError=auto
--StartMode=exe
--Startup=manual
--StartImage=cmd.exe
--StartPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\bin" ++StartParams="/c#set#NOPAUSE=Y#&&#standalone.bat#-Djboss.server.base.dir=D:\jboss-eap-7.4.6\jboss-eap-7.4\standalone#--server-config=standalone.xml"
--StopMode=exe
--StopImage=cmd.exe
--StopPath="D:\jboss-eap-7.4.6\jboss-eap-7.4\bin"
++StopParams="/c jboss-cli.bat --controller=localhost:9990 --connect --user=ABC --password='12345' --command=:shutdown"
Any help is appreciated!

Heroku won't load within Visual Studio Code

heroku : File C:\Users\mar\AppData\Roaming\npm\heroku.ps1 cannot be loaded. The file C:\Users\mar\AppData\Roaming\npm\heroku.ps1 is not digitally
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
This is the error I'm getting. I've tried running "heroku -v" within the cmd and it works there so I know it was installed correctly. However, when I run the same command in visual studio I get the above error. I'm running visual studio code in admin mode and I installed heroku from admin mode as well.
I also enabled developer mode in my computer settings.
You need to set the execution policy regardless of whether you are running in administrator mode or not for PowerShell.
You can read more about this here
You can also see that it's throwing an error with regards to execution policy. The error basically means that windows could not verify the identity of the user that created the script and is blocking you from running it because it may be harmful (based on the fact that it could not verify the identity of the file creator).
This is just a counter-measure to prevent malicious scripts from running automatically.
If you want to run the script I would suggest running
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
and then running the Heroku commands. The above script removes restrictions on script executions on the current logged in user.

Getting Sqldeveloper working with instantclient on Windows without admin privileges?

I've installed Sqldeveloper Version 19.1 64-bit Version on an enterprise PC with Win10-64bit.
It works fine with embedded jdbc-client, but I need to get it working using the Oracle OCI-client. One reason is the much better support to cancel long running queries.
Using an OCI-client (thick-driver) requires for sure a client like instantclient_12_2.
I have no admin privileges on my workstation and so copied the full instantclient_12_2 to the enterprise PC.
Since I'm not allowed to change the %PATH% myself, I created a start.bat file with required settings, because without, it also won't work (already tried).
PATH="C:\Users\myuser\OneDrive\Oracle\instantclient_12_2";%JAVA_HOME%;%PATH%
C:\Users\myuser\OneDrive\Oracle\sqldeveloper64\sqldeveloper.exe
When I try to configure another Oracle-Client without this change, I get another error, that PATH to instantclient needs to be defined before any others.
Now, starting sqldeveloper with this bat-file works fine. Connections can be established using the internal jdbc client.
Then, I've configured the Oracle Client in SQLdeveloper (Preferences/Database/Advanced) and selected the instantclient directory.
Pressing the "Test" button opens the Messages log "Oracle Client Test Results - Log" and shows an error.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occured, Program will exit.
Unrecognized option: -
Now, I'm lost, because I'm not a Java-Expert. I'm wondering, why sqldeveloper as Java-tool is running, but the instant-client says it can't create the JVM.
The reason for me to use OCI-client is, that it has e.g. better support of User-breaks.
Without admin privileges and no permission to change your %PATH% env permanently, you only need to install the whole directory somewhere and add a .BAT file, that changes environment temporarily before calling SQL-Developer.
Install complete SQL-Developer e.g. in C:\myprogs\sqldeveloper
Install instant-client somewhere, e.g. in C:\myprogs\instantclient_12_2
Create .BAT file, e.g. C:\myprogs\sqldeveloper\startsqldev.bat with following content:
set PATH=C:\myprogs\instantclient_12_2;%PATH%
REM start sqldeveloper
"C:\myprogs\sqldeveloper\sqldeveloper.exe"
It works for versions > 20 as well ;-)
Meanwhile, I've solved it.
Result of testing:
Testing the Instant Client located at C:\Users\myuser\Oracle\instantclient_12_2
Testing client directory ... OK
Testing loading Oracle JDBC driver ... OK
Testing checking Oracle JDBC driver version ... OK
Driver version: 12.2.0.1.0
Testing testing native OCI library load ... OK
Success!
Reason were following mistakes:
Forgot "set" in front of Variable assignment (because I'm usually using Unix)
Used quotation marks during Variable assignment, which are taken as part of the value (also different to UNIX).
Added JAVA_HOME and JRE_PATH
See below my complete bat-file (adapted, because of some secret information within pathnames):
REM Optional: setting of USE_OS_DATETIME_FORMAT changes DATE-Format
set USE_OS_DATETIME_FORMAT=1
set PATH=%USERPROFILE%\OneDrive - myCompany\Oracle\instantclient_12_2;%JAVA_HOME%;%PATH%
REM start your preferred sqldeveloper
"%USERPROFILE%\OneDrive - myCompany\Oracle\sqldeveloperx64.20.2\sqldeveloper.exe"C:\Users\myuser\OneDrive - myCompany\Oracle\sqldeveloperx64.19.1\sqldeveloper.exe"
Additionally, I've added a shortcut to the bat-file and now I can start it simply with CRTL-SHIFT-S ;-)
BTW: Same solution works fine on Win10 as well

How to update Windows environment variables after Ansible's win_environment module?

I am using Ansible to configure our Windows Servers 2012.
I am using Ansible's Windows modules: win_xxx. All modules are working fine except for
win_environment
win_path
I think the win_path depends win_environment module in my case.
I am installing
JDK
Apache Ant
Apache Tomcat8.
Installation works fine and setting up the environment variables for
JAVA_HOME
ANT_HOME
is not working as expected. The server is not updated with the new environment variables. I need to sign out and sign in back to the server in order the new variables are updated. Is there any way to update the system in Ansible or in Windows Batch/Powershell without signing in and out?
just to remind that "User level environment" variables will be set, but not available until the user has logged off and on again.
check then either you have selected "user" as level on you win_environment module.

OracleXE Service OracleXETNSListener won't start

I'm trying to run oracleXE in my computer. However, I can't get the OracleXETNSListener to start.
I've tryed to remove the ORACLE_HOME variable, and this fixes the problem. However, when I do delete te ORACLE_HOME variable and open the SQL command line (otherwise it won't open) when I try to login using SYSTEM user I can't because this variable is missing

Resources