We have developed a windows application and deployed in terminal server / citrix environment.
We have used the Enviornment.GetEnvironmentVariable("CLIENTNAME") for getting the client name
from where the RDP is accessed.
If I run the application with normal privilege (double cliking the application), then i am getting
correct value in the "ClientName" Env Variable.
But when I run the same application with administrator privilege (right click and run as administrator),
then then "ClientName" Env Variable returns null.
Note: I wrote a small application and get all the environment variables exists in the virtual machine (RDP)
using "Environment.GetEnvironmentVariables()". "ClientName" Env variables is shown only when it is executed with normal privilege
and the same variable is hidden if executed with administrator privilege.
Can anyone let us know why the "ClientName" Env variable is hidden on administrator privilege?
Regards,
Guru
This sounds like this might be your problem:
When connecting remotely with Remote Desktop Connection, the
environment variables CLIENTNAME and SESSIONNAME are added to each
process that is started.
If you set the Folder Option "Launch folder windows in a separate
process" and later launch an application from an additional Explorer
window, the application will not see these additional environment
variables.
To fix the issue:
If your application relies on these variables, remove the folder
option "Launch folder windows in a separate process".
MS Article: https://support.microsoft.com/en-us/kb/2509192
$sessionID = (Get-Process -PID $pid).SessionID
$PC = (Get-ItemProperty -path ("HKCU:\Volatile Environment\" + $sessionID) -name "CLIENTNAME").CLIENTNAME
Related
In my rails application, I exported my database variables in .profile using ansible. the variables are accessible by the command printenv. However, when I run the application or use rails c via ENV['NAME'] , the variables aren't there.
Does anyone have any idea why rails doesn't load variables from .profile?
The ~/.profile script is only meant to be read by your (presumably POSIX compatible) shell. And even then only if it is what is known as a "login" shell. For example, from the bash man page:
When invoked as an interactive login shell, or a non-interactive shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order.
If you're running your rails application from an interactive shell prompt it should have access to the env vars you're setting in ~/.profile. If you're starting your rails app some other way (e.g., from your window manager) then you'll need to find some other way to set the env vars that it inherits.
I have a strange situation, if I run a Docker project in Visual Studio 2017 I get an error saying: Cannot start service webapplication1: error while creating mount source path '/host_mnt/c/Users/MyUser/vsdbg/vs2017u5': mkdir /host_mnt/c/Users/MyUser/vsdbg/vs2017u5: permission denied
But, if I run the same project with the command docker-compose up -d it works.
It cannot be a permission issue only for Visual Studio.
I just had the same problem - found the solution at https://github.com/docker/for-win/issues/897
Basically, the problem is access to C:\Users\user\vsdbg - not to think too much I gave R/W access for Everyone to this one and C:\Users\user\.nuget, just in case, and it worked like a charm :)
For me absolutely nothing worked, including giving full rights to only the vsdbg and .nuget folders.
My setup is as follows:
I have a primary account called "User" onto which I'm currently
logged in and do my development work
I have a user called "DockerDiskSharing" with full admin rights,
which I intend to use for Docker to run with
What did the trick for me was:
I opened a command prompt with admin rights and added the DockerDiskSharing user to the docker-users group by running
net localgroups docker-users DockerDiskSharing /add
I went to Docker -> Settings -> Shared Drives, I clicked "Reset credentials" and added the DockerDiskSharing user's credentials. I ticked C drive (my main partition) and the D drive (where my project is located)
I opened a command prompt with admin rights and gave full access permissions to the entire Users/User folder by running:
icacls "C:\Users\User" /q /c /t /grant docker-users:F
Still unsure which folders in particular it needs permissions to read/write to though from Users/User...
For other readers getting here which have a forced setup where their primary windows user can't be local admin:
That doesn't work!
After trying out different workarounds, I gave up. Note that I have a local service account which is local admin. If you don't have that, and are not a local admin, I guess you're screwed.
So:
I reset my Docker shared drive, mounted it again with my primary windows credentials
I added my primary user to the local administrators group
And now it works :)
I have ant build file, that should take cvs checkouts when called. I can call it ok, but when ant uses cvs to connect to cvs repo, the repo prompts for password and obviously ant command fails.
I have CVSROOT environment variable pointing to same location where I took the initial checkout for the project with TortoiseCVS, having ssh as protocol.
I also have putty's pageant running and an environment variable CVS_RSH pointing to plink.exe of putty. That combination should make the connection via putty, 'cause from pageAnt menu the connection opens without prompts.
My operation system is Windows 8.
Question here is, that why ant build fails on cvs server password prompt, although PageAnt otherwise is enabling promptless access via ssh+cvs?
Ant cvs task invokes cvs.exe command line from PATH so if everything works properly from command line, there is (almost) no reason it will fail from Ant.
Here is a checklist with points to verify:
CVSROOT must contain username and specify ext protocol, :ext:username#cvserver.domain.ldt:/path/to/repository
CVS_RSH must point to plink.exe with absolute file path and you have to ensure it will use SSH protocol
Your SSH private key must have been loaded into Pageant for the same user session as the user running Ant script
If it does not help, please provide more details about your cvs task options and your workstation setup.
When running without any user session opened and Pageant cannot help, often for continuous integration tools, a better option is to pass all arguments like username and private key file to plink directly in CVS_RSH variable:
CVS_RSH="C:\path\to\plink.exe -batch -ssh -l username -i C:\path\user\ssh-privatekey.ppk"
Of course, in such a case, your private key file must not be protected with a passphrase.
I am able to run my script successfully from jenkins when jenking is opened using war file.
If set the jenkinks as winservice my script is failing in middle.
I am trying to run a start.bat file from jenkinks, this bat file calls a java class. again this java class uses bat file to run a plink command.
Execution stops at this stepsif jenkinks is running as winservice and also I can't view the output as it is running in background.
Is there any way to make jenkinks behave normal while running as winservice
Thanks
Try this:
1. Go to services (hit windows key, type "services", select "Services" from the list of matches).
2. Find the Jenkins service and open it's properties
3. Switch to Log On tab
4. Change the service to run as you, instead of local system user.
5. Restart service.
Alternative is to fix local system user account (probably environment variables) so it works as local system user.
I am looking at a user environment variable created using Windows console command
reg add "hkcu\environment" /v SARMaster_Server_Name /d %smServer%
This variable name SARMaster_Server_Name can be seen in the registry under HKCU/Environment with the correct value as well as through the advanced System settings of the Control Panel.
However, when I run
echo %SARMaster_Server_Name%
I get %SARMaster_Server_Name% instead of the actual value of this environment variable. What did I miss? All other environment variables such as TEMP can be echoed.
Variable is being set correctly using
reg add "hkcu\environment" /v SARMaster_Server_Name /d %smServer%
However, I need to restart to be able to access this variable. A workaround, which does not help in my scenario is to open the Environment Variables editor from the Control Panel and click on OK after the variable has been added using "reg add". Somehow, this action registers the new variable which can now be accessed on a new CMD session. Problem is being reported on XP so it may have been fixed on Windows 7 a