Setting Environment Variable not pulling in certain portion of script
We have multiple domain controllers and when a user gets locked out constantly it is a bit of a process to login to that domain controller, pull the event logs, and search through that way. I looked at a few ways to automate this process in powershell and
tweaked it a bit to work the way we need it to. I am trying to make this a simplified process for people who will use this script, currently I have:
$DC = Read-Host "Domain Controller"
$Account = Read-Host "Username"
Get-WinEvent -ComputerName $DC -FilterHashtable @{Logname='Security';Data='$Account'} -MaxEvents 4 | Format-List -Property ID, TimeCreated, MachineName, Message
This seems to work perfectly for what we need except when entering the information in response to Read-Host for $Account. The $DC pulls correctly but the $Account doesn't (I found this out by entering the user's username in the data field instead of $Account
and the script worked correctly). Any Ideas on how to get this to work?
Most answers are easy. It is the questions that are hard. If you had asked the right question you would have seen the answer immediately.
Ask, "What is the difference between single and double quotes?" When and why do variables need quotes? Why and when do strings need quotes?
These are all PowerShell 101. You must learn and understand to use PowerShell effectively
\_(ツ)_/
Similar Messages
-
Ora-7217 sltln environ variable not set..
Here's the story..
Oracle 8.1.7 on RHat 6.2..
Installation unbelievably perfect!!!
no core dump in any programs like sqlpus, svrmgrl..but..
trying to start with svrmgrl..connect internal or thru sqlplus as sysdba
ora-7217--sltln environment var not set
keeps coming..made sure all the vars are
set in .profile..any clue what's happening?
vinny.A way to set environment variables to binaries is to specify
it on the command line. For example:
LD_LIBRARY_PATH=/usr/mylibs httpd
If you are using apache, it could be changed in the /etc/init.d/apache
script.
If you use a script to startup the server, you can use the same approach.
I am not sure about the obj.conf file.
Sun - DTS -
Does a user need to have certain rights or access to certain libraries to
set environment variables off or on when running a pl/sql script?
environment variables such as:
set echo off;
set termout off;
thanksIt is possible to disable certain SQL*Plus, SQL and PL/SQL commands, using the PRODUCT_USER_PROFILE table (note that this only affects the SQL*Plus environment).
See: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch10.htm#1005596 -
Mountain Lion: how set environment variables
Am I correct that for Mountain Lion, if not earlier, the only way to set environment variables at the system level is to use (or create) a file /etc/launchd.conf that contains commands such as:
setenv CATALINA_BASE /opt/local/share/java/tomcat6
(That does seem to work as expected.)
If so, how does one do this by referencing the value of something else, e.g., to set JAVA_HOME? I tried
setenv JAVA_HOME $(/usr/libexec/java_home)
but then in Terminal if I run
echo $JAVA_HOME
I just get back $(/usr/libexec/java_home).
By contrast, if I put that same setenv JAVA_HOME $(/usr/libexec/java_home) command into my ~/.profile, then the result of echo $JAVA_HOME is the actual value referenced, namely, /Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home.Linc Davis wrote:
launchd is not a shell and does not peform expansion. You have to use literal expressions. But you can also modify the bash environment system-wide by editing the file /etc/profile.
But sudo emacs /etc/profile won't let me edit this file: it's read-protected, emacs says.
What permissions should I give it? Right now it's in group wheel, owned by root but with Read permission only.
P.S. And is it really a good idea to edit /etc/profile -- assuming I can suitably set the permissions to do so? Apple goes out of its way to try to hide this file: /etc is a link to /private/etc, e.g. -
Forget to set environment variable export SAPINST_USE_HOSTNAME
Dear Experts
we have installed the SAP ECC6.0 EhP4 in HACMP environment with AIX6.1 ,Power HA cluster6.1, oracle 11g database
the problem is while installing the CI and ASCS and Dialog instance I missed to set environment variable
export SAPINST_USE_HOSTNAME = <virtual Host Name> and while starting the sap-inst also i didn't start as like
./sapint SAPINST_USE_HOSTNAME = <virtual Host Name>,Now i am facing problem while doing cluster fail over to another node
Node A host Name is not reflecting in Node B and I am not able to start the SAP with host name of Node A
in AIX6.1 in IBM Admin they didnt give any virtual host name they said that they have configured the cluster with two service IP there is no virtual IP in AIX6.1
please help me out how to resolve this host Name issue and to start the SAP in Node B
Thanks in Advance
krishnaHi Krishna,
I dont agree with the AIX 6.1 having no virtual ip's, because i recently installed a HA instance with ASCS, SCS & also ERS on 6.1
to answer your questions:-
"can you tell is this correct setup or anything we did mistake for file system setup and installation"
This depends on what your requirement is. Typically a cluster will have Oracle on one host and SAP on the other host. Ill explain the VCS concept, so you will have a better understanding.
Lets consider Node1 & Node2. Now each node will have a physical IP and a virtual IP. The Virtual IP will be associated with a set of file systems. For example /oracle will be associated to virtual ip lets say "xyzDB" & the /usr/sap/<sid>, TRANS & sap mount will be associated with virtual ip lets say "abcCI". Now when the cluster fails over to which ever node, these file systems will still be associated with their respective virtual ip's.
So, the start profile will always have START_DVEBMGS_abcCI. Irrespective of which Node the sap is in, when you start the SAP, it will use the virtual hostname and start up SAP. I hope your getting the concept.?
Coming back to the setup, since you have ASCS, Oracle , CI & a dialog instance. Im not sure what file systems you have associated with VCS groups. Can you give command "hastatus -sum" and post the output?
Regarding your other question
"this file system is moving to Node B but while starting SAP on Node B host Name is not reflecting and SAP is not coming up due to there hostname didnt change in Node B,, can you advice me please ,,"
This is inline with what i explained above for cluster mechanism. The physical IP will not change. It is only the virtual IP that is associated with a set of file systems.
Ill give you one more example, Consider the parameter rdisp/mshost = <> . What should this be? Physical host or Virtual host?? :-) .It should be Virtual. Because the CI can be in Node1 or Node2. If we give the physical host, then if the SAP fails over to the other node. How will it start up? because the profiles still say the message server is in the other host... Getting my point?
Regards,
Shanser -
How to set environment variable ORACLE_HOME ?
Hi
I trying to install SAP Solution manager 4.0 SR3:
OS: Linux RHEL4u4
DB: Oracle
SAPinst now stops the installation.
To proceed with the installation, install the Oracle database as follows:
1.Log in as user orassm.
2.Set the DISPLAY variable.
3.Change to directory /oracle/stage/102_32/database/SAP.
4.Start './RUNINSTALLER'.
After you installed the Oracle database software, proceed with the database instance
installation by choosing 'OK' in this dialog box.
./RUNINSTALLER
oracle_stage is not set (OK)
oracle_base is not set (OK)
oracle_home is not set (OK)
oracle_sid is not set (OK)
oracle_home_name is not set (OK)
oracle_inst_group is not set (OK)
from_location is not set (OK)
tmp_netca_file is not set (OK)
tmp_dbca_file is not set (OK)
Working in /oracle/stage/102_32/database/SAP ...
The environment variable ORACLE_HOME is not set! abort ...
How to set environment variable ORACLE_HOME ?
Regards
Erici
Switch shell to bash:
orassm:x:502:503:SAP Database Administrator:/oracle/SSM:/bin/bash
[root@csp-p-sm00 ~]# su - orassm
[orassm@csp-p-sm00 ~]$
But when try to run ./RUNINSTALL
[orassm@csp-p-sm00 SAP]$ ./RUNINSTALLER
oracle_stage is not set (OK)
oracle_base is not set (OK)
oracle_home is not set (OK)
oracle_sid is not set (OK)
oracle_home_name is not set (OK)
oracle_inst_group is not set (OK)
from_location is not set (OK)
tmp_netca_file is not set (OK)
tmp_dbca_file is not set (OK)
Working in /oracle/stage/102_32/database/SAP ...
The environment variable ORACLE_HOME is not set! abort ...
Additionaly I've post csh.cshrc and csh.login
/etc/cshrc
csh configuration for all shell invocations.
by default, we want this to get set.
Even for non-interactive, non-login shells.
[ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]
if $status then
umask 022
else
umask 002
endif
if ($?prompt) then
if ($?tcsh) then
set prompt='[%n@%m %c]$ '
else
set prompt=\[`id -nu`@`hostname -s`\]\$\
endif
endif
if ( $?tcsh ) then
bindkey "^[[3~" delete-char
endif
setenv MAIL "/var/spool/mail/$USER"
limit coredumpsize 0
if ( -d /etc/profile.d ) then
set nonomatch
foreach i ( /etc/profile.d/*.csh )
if ( -r $i ) then
source $i
endif
end
unset i nonomatch
endif
/etc/csh.login
System wide environment and startup programs, for login setup
if ($?PATH) then
if ( "$" !~ /usr/X11R6/bin ) then
setenv PATH "$:/usr/X11R6/bin"
endif
else
if ( $uid == 0 ) then
setenv PATH "/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
else
setenv PATH "/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
endif
endif
setenv HOSTNAME `/bin/hostname`
set history=1000
if ( ! -f $HOME/.inputrc ) then
setenv INPUTRC /etc/inputrc
endif
Regards
Eric -
Runtime.exec and setting environment variables
Runtime.exec and setting environment variables
I need a decent example which works on Windows.
Got any?Thank you.
I was hoping for an example of the use of
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runti
e.html#exec(java.lang.String,%20java.lang.String[]) or
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runti
e.html#exec(java.lang.String,%20java.lang.String[],%20j
va.io.File) which take environment variable
information such as PATH.
The reason is because there is a library which is
being loaded via loadLibrary (
http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Syste
.html#loadLibrary(java.lang.String) ). However, for
the child process to find the library the PATH needs
to be updated.
Any example regarding changing the PATH variable via
Java so that libraries can be loaded and processes
created? (Perhaps, I should make a new post and
restate the question with this more explicit
information?)
That won't work. LoadLibrary occurs in the JVM environment. As I said you can't change the JVM environment via exec().
If the shared library needs something in the path then you are going to have to set the path before your application starts up.
If you just need to load the library from someplace that is not on the path then you should be using System.load(). -
[Solved] Trying to set environment variables in script
I'm trying to create a script that will pass environment variables that will stay valid after the script exits.
The problem with this is that (by design?) when executing a script it opens a child environment, and inherits the environmental variables from the parent.
The issue is that the child cannot interact with the parent's environment so setting variables like:
export http_proxy='http://server:port'
wont stay valid once the script exits. I've verified this by trying to echo the variable once the script completes, and i receive an empty reply.
The only work around I have for this is to include this within a bash profile, however I cant just keep adding scripts into my bash profile, because that seems counter-intuitive.
Is there any way to do what I'm trying to do? Or am I just grabbing at straws here?
below is my code for my script, perhaps I've done something wrong...
proxy=x.x.x.x
port=#
username=domain\\username
password=userpassword
export http_proxy='http://$username\:$password@$proxy\:$port'
export ftp_proxy='ftp://$username\:$password@$proxy\:$port'
exit
Last edited by isolatedvirus (2011-10-04 10:58:52)One thing to note is that you should specify the sourced file by its path so it includes a slash, quoting bash(1):
source filename [arguments]
Read and execute commands from filename in the current shell environment
and return the exit status of the last command executed from filename.
If filename does not contain a slash, file names in PATH are used to find
the directory containing filename. The file searched for in PATH need
not be executable. When bash is not in posix mode, the current directory
is searched if no file is found in PATH. If the sourcepath option to the
shopt builtin command is turned off, the PATH is not searched
So if sourcepath is set (as by default), you can end up sourcing the wrong file, e.g.
source file
(DON'T do it!)
will really source /usr/bin/file, even if you have 'file' in current directory.
Instead, always specify the path,
source ./file
Keep this in mind or you're in for a big surprise.
Last edited by lolilolicon (2011-10-04 11:33:48) -
How to set environment variables in WL ?
Hi,
How to set environment variables in WL ?
Thanks,
SriviHi,
You can set the environmet variable in Weblogic by using the below commands
setWLSEnv.cmd/sh ==>Set the CLASSPATH to include the WebLogic Server classes.
Overview of WebLogic Server Domains
or you can use to set the Environment variable along with domain specific varables using the SetDomainEnv.cmd
To run SetDomainEnv.sh in Linux please use
. ./setDomainEnv.sh it require two dots (Dont miss it )
http://docs.oracle.com/cd/E28280_01/web.1111/e13749/weblogicserver.htm#ADMRF205
Hope it helps -
How to set environment variables using java program
Hi all
I want to set environment variables on windows 98/200/xp system, such as path and classpath using a java program.
How to do this using a java program.
Any body plz helppppppppp.#1 05-02-2003, 07:38 AM
Goodz13 Join Date: Jan 2002, Posts: 985
Location: Halifax, NS, Canada
Reputation:
Java FAQ's and tutorials
Java FAQ's
Path and ClassPath:
PATH
In Windows 9x you would set it up in the autoexec.bat file
ie.
SET PATH=%PATH%;c:\jdk1.4.2\bin\;
where c:\jdk1.4.2\ is the path where you installed Java.
In Windows 2000 and XP
Right click on My Computer->Properties->Advanced Tab->Environment Variables... Button.
If you see a PATH in System Variables, click that and edit it. If you don't, you will need to create a new System variable.
It should look something like this:
%SystemRoot%\system32;%SystemRoot%;c:\jdk1.4.2\bin\;
Any querry email me to [email protected]
Answer by
Rajasekhar Goli
DS UNICS Infotech -
Win7 11g -- Environment variables not set?
I have an 11g installation on a school harddrive that doesn't seem to have any of the environment variables set properly. Even ORACLE_HOME is not set. How can I fix that situation and how many environment variables need to be defined?
Also some of the Oracle scripts seem to use the forward-slash rather than the back-slash for paths. Will Win7 care?
Thanks>
I have an 11g installation on a school harddrive that doesn't seem to have any of the environment variables set properly. Even ORACLE_HOME is not set. How can I fix that situation and how many environment variables need to be defined?
>
You can set the following 3 basic environment variable in your system variables list. So that you can connect to database with out manually specifying the variables every time.
ORACLE_HOME: the ORACLE_HOME variable should be set.
ORACLE_SID: it is the name of the instance.
PATH=$ORACLE_HOME/bin : this is the place where your oracle binaries exists.
>
Also some of the Oracle scripts seem to use the forward-slash rather than the back-slash for paths. Will Win7 care?
>
Windows server uses back-slash
Unix flavours use forward-slash -
Error in setting environment variable
hi
Please note JKit is where my jdk1.3 is stored(i.e instead of jdk1.3 folder its JKit folder)... i have gone thru the similar threads but with no success.
SET
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;D:\Jkit\bin;D:\Jkit\lib;D:\Oracle\bin;"C:\PROGRAMFILES\ORACLE\JRE\1.1.7\BIN";D:\JKit\Jre\Bin;
SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
SET CLASSPATH=c:\JavaWebServer2.0\lib\servlet.jar;c:\JKit\lib;
SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29;
SET JAVA_HOME=D:\Jkit;
The error i get after running autoexec.bat and then tomcat/bin/startup is as follows..
The CATALINA_HOME environment variable is not defined
This environment variable is needed to run this program
please HELP!!.THANKSHi
Very many thanks for ur solution.. i actually hadset the environment variables spacce..but when i execute the autoexec.bat file i dont get any error(out of env space)..but when i run the startup.bat file i get from the command prompt, i get the foll error.
This is my Autoexec.bat
SET JAVA_HOME=D:\Jkit\bin
SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29\bin
SET PATH=D:\Jkit\bin;C:\WINDOWS;C:\WINDOWS\COMMAND;
SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
THE FOLLOWING IS THE ERROR I GET WHEN I RUN STARTUP.BAT UNDER TOMCAT'S BIN UNDER THE COMMAND PROMPT
D:\tomcat\jakarta-tomcat-4.1.29\bin>startup
Syntax error
Out of environment space
Out of environment space
Out of environment space
Using CATALINA_BASE: D:\tomcat\jakarta-tomcat-4.1.29
Using CATALINA_HOME: D:\tomcat\jakarta-tomcat-4.1.29
Using CATALINA_TMPDIR: D:\tomcat\jakarta-tomcat-4.1.29\temp
Using JAVA_HOME: D:\Jkit
Out of environment space
Out of environment space
Invalid switch - -DJAVA.ENDORSED.DIRS=D:\TOMCAT\JAKARTA-TOMCAT-4.1.29\COMMON\ENDORSED
I even set JAVA_HOME AND CATALINE_HOME to the \bin dir respectively..
still i get the same error
As given under the tomcat installation documentation (RUNNING.txt), i set the space for environment space under the Memory tab, for startup and shutdown.bat files, it creates a shortcut for running the resp .bat files, running startup.bat file i get,CATALINA_HOME VAR HAS NOT BEEN SET PROPERLY, THIS OCCURS FOR BOTH TOP LEVEL DIR SETTING AND /bin DIR SETTING of CATALINE_HOME IN autoexec.bat
PLEASE HEL, I HAVE BEEN TRYING TO CONFIGURE IT FOR THE PAST DAYS BUT WITH NO SUCCESS, DONT KNOW WHERE I AM GOING WRONG..PLEASE HELP -
Setting Environment Variable CPIC_MAX_CONV
Hi Experts,
In of the steps during POST INSTALLATION of PI7.0 it says to set the variable CPIC_MAX_CONV, using the transaction RZ10.
When i logged in to the abap system , and checked in RZ10,did find any variable of this name.
Do I need to create it first and then set the value gw/max_conn_per_wp.
If yes, give me the steps to do this. or else any other alternative.
Thanks in advance,
YounusHi,
Check this note :
1.- https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_fes/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d333136383737%7d
2.- /thread/174978
The parameter CPIC_MAX_CONV is a environment variable that you find in Unix or windows, depends where you had installed SAP PI.
Best regards
Ivá -
Error Setting Environment Variable inside Listner.ora
Hi,
I am trying to set an environment variable inside listner.ora as follows
(ENVS="EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/opt/app/oracle/product/9.2/lib32:/opt/app/oracle/product/9.2/network/lib32:/usr/lib:/usr/X11R6:/usr/dt/lib,LIBPATH=/opt/app/oracle/product/9.2/lib32,MQSERVER=SYSTEM.DEF.SVRCONN/TCP/ashsou03.mcilink.com(4444)")
but every time I try to start the listner it gives me the following error:
TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in LISTENER.ORA
NL-00303: syntax error in NV string
I think that the parenthses, (4444), in the MQSERVER value is causing this. Any ideas on how I can configure it?Hi
Very many thanks for ur solution.. i actually hadset the environment variables spacce..but when i execute the autoexec.bat file i dont get any error(out of env space)..but when i run the startup.bat file i get from the command prompt, i get the foll error.
This is my Autoexec.bat
SET JAVA_HOME=D:\Jkit\bin
SET CATALINA_HOME=D:\tomcat\jakarta-tomcat-4.1.29\bin
SET PATH=D:\Jkit\bin;C:\WINDOWS;C:\WINDOWS\COMMAND;
SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1;
THE FOLLOWING IS THE ERROR I GET WHEN I RUN STARTUP.BAT UNDER TOMCAT'S BIN UNDER THE COMMAND PROMPT
D:\tomcat\jakarta-tomcat-4.1.29\bin>startup
Syntax error
Out of environment space
Out of environment space
Out of environment space
Using CATALINA_BASE: D:\tomcat\jakarta-tomcat-4.1.29
Using CATALINA_HOME: D:\tomcat\jakarta-tomcat-4.1.29
Using CATALINA_TMPDIR: D:\tomcat\jakarta-tomcat-4.1.29\temp
Using JAVA_HOME: D:\Jkit
Out of environment space
Out of environment space
Invalid switch - -DJAVA.ENDORSED.DIRS=D:\TOMCAT\JAKARTA-TOMCAT-4.1.29\COMMON\ENDORSED
I even set JAVA_HOME AND CATALINE_HOME to the \bin dir respectively..
still i get the same error
As given under the tomcat installation documentation (RUNNING.txt), i set the space for environment space under the Memory tab, for startup and shutdown.bat files, it creates a shortcut for running the resp .bat files, running startup.bat file i get,CATALINA_HOME VAR HAS NOT BEEN SET PROPERLY, THIS OCCURS FOR BOTH TOP LEVEL DIR SETTING AND /bin DIR SETTING of CATALINE_HOME IN autoexec.bat
PLEASE HEL, I HAVE BEEN TRYING TO CONFIGURE IT FOR THE PAST DAYS BUT WITH NO SUCCESS, DONT KNOW WHERE I AM GOING WRONG..PLEASE HELP -
Setting Environment variable in windows xp
Hi all,
I am trying to run a java program in textpad, which is installed in windows XP, but i am getting the following error.
java.lang.NoSuchMethodError: main
Exception in thread "main"
Can anybody tell me, how to set the environment variable in the control panel.
Thanx,
Guddujava.lang.NoSuchMethodError: main
Exception in thread "main"This error is NOT caused by an environmental variable mis-configuration. It means you did not define a main method correctly, or you are trying to run a class as an application and it is not an application.public static void main(String[] args)
Maybe you are looking for
-
Importing into iPhoto, edited RAW photos from Photoshop CS3
I edit all my photos in Photoshop CS3. Sometimes I just batch edit many of them. But when I import these edited images, iPhoto only shows them in unedited form. How do I import these edited images into iPhoto, and yet maintain the edits. I am a profe
-
Can we create a pivot table of Excel in a JSP page using POI
Hello, I want to know whether we can create a pivot table of excel sheet in a jsp page using POI package from apache. thank you.
-
[solved] s-nail 14.7-1 doesn't work
I'm using setup outlined in the wiki: https://wiki.archlinux.org/index.php/S-nail and it works just fine with older versions of s-nail (downgraded to test). I use s-nail to send e-mail to my gmail account, usually with an attachment. $ echo "Done" |
-
Need BADI/exit OR ORHER SOLUTIONS FOR miro BEFORE POSTING A ACCOUNTING DOCU
Dear Expert, How can i find a FI document number Material Line Items Before MIRO posting. so that along with miro posting another FI document can be posted by taking reference of the above.
-
How to query non database items
hi every one I have database block has database items and non database items i want to make query in that non database items to retrieve data by that non database items and database items thinks