Using setx.exe while using PowerShell Remoting

Hi,
I am using the Invoke-Command with a Session to execute some installers on a remote computer. This works fine but for some reason setx.exe (to set Environment Variables) will not work as expected. When I create a new computer Environment Variable I am using
the following command which works great:
$process = Invoke-Command -Session $Session -ScriptBlock {
$result = Start-Process -FilePath "setx.exe" -ArgumentList 'MY_PATH "C:\Program Files\MyApplication" /M' -Wait -PassThru -Verb RunAs;
However, when I try to edit a current Environment Variable like PATH it does not work. I use the following code:
$process = Invoke-Command -Session $Session -ScriptBlock {
$result = Start-Process -FilePath "setx.exe" -ArgumentList 'PATH "%PATH%;%MY_PATH%\bin" /M' -Wait -PassThru -Verb RunAs;
When I login on the remote computer and use "echo %PATH%" from the command prompt it prints the following:
%PATH%;%MY_PATH%
While I was expecting:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\MyApplication\bin
Any idea why I cannot append with this way to an already existing Environment Variable? The commands work locally when I execute it from the command prompt.

Hi Anna,
Thanks for your reply. I executed your code and the NEWPATH variable is created but the value is "%PATH%;%MY_PATH%\bin". So it does not seem to reconize other environment variables on this way. Any idea why?
Thanks
Ps. the complete code I am using is the following:
try
$Credential = Get-Credential -UserName ("{0}\{1}" -f $env:USERDOMAIN, $env:USERNAME) -Message "Enter your credentials"
$Session = New-PSSession -ComputerName "TEST2938" -Credential $Credential -Authentication Credssp
$process = Invoke-Command -Session $Session -ScriptBlock {
setx.exe NEWPATH "%PATH%;%MY_PATH%\bin" /M
finally
if ($Session -ne $null)
Remove-PSSession $Session

Similar Messages

  • Shutdown ports that is not in use for a while using LMS 4.x

    Hi,
    Is there a way to disable switch ports that has not been in use for a while using LMS 4.x
    Your assistance would be much appreciated.
    Regards,
    Clifton

    Hi,
    Is there a way to disable switch ports that has not been in use for a while using LMS 4.x
    Your assistance would be much appreciated.
    Regards,
    Clifton

  • How does one use Sound sticks while using HDMI at the same time ??

    How does one use Soundsticks while using HDMI at the same time ??

    Hi Caleb,
    This isn't a precise answer but a possible workable solution. SoundSource puts a menu extra which allows you to switch input/output and has an option for Auto-Switch to Headphones. The auto-switch feature doesn't work with USB headphones but I believe it will with 'regular' headphone plugs such as you use.
    http://www.rogueamoeba.com/freebies/
    (Oh, did I mention it's free Universal and works with Leopard?)

  • Can I use my iPhone while using it as a hotspot?

    CCan I use my iPhone while it is being used as a hotspot?

    Yes if your cell provider supports it.

  • Multiple instances of AcroRd32.exe while using Windows Explorer Preview Pane

    I'm trying to understand why our computers behave differently while browsing PDF files using Windows Explorer with the preview pane turned on.
    All are Windows 7 Pro 32-bit.
    The scenario:  Open Windows Explorer with the preview pane turned on, go to a folder full of PDF files, and start single-clicking on them, one by one down the list.  Keep Task Manager open, on the Processes tab, showing processes from all users, as you click on the PDF files.
    On two of the computers, you can keep clicking right on the down the list, and the preview pane shows the PDF file contents immediately with each click.  The Task Manager does not show any instances of AcroRd32.exe running, and the machine does not slow down no matter how quickly you go down the list of files.  You can keep clicking all day.
    On the other two computers, as you keep clicking down the list, after about six or seven clicks, the machine starts getting slower and slower in responding to display the PDF contents.  In Task Manager, you see multiple instances of AcroRd32.exe executing, and the list keeps growing with more instances - I've seen up to 8, with memory allocations to some of the instances approaching 700MB!  One of the CPU cores goes to 100%. If you stop clicking in Windows Explorer, eventually, the machine recovers, and the list of multiple instances of AcroRd32.exe shrinks, but never goes away completely until you close the Explorer window.
    What could account for this difference?  One of the users is complaining - he often browses folders of scanned PDFs looking for invoices, transactions, etc., and has to go slowly to keep his machine from bogging down.  I don't know when this behavior started.
    It doesn't matter if it is a shared folder on a network resource or one locally on the machine, or if it is an admin or standard Windows account - the behavior is the same.  I've tried uninstalling and reinstalling Adobe Reader, to no avail.
    Thanks for any ideas.

    Yes i'm having this issue to.
    Becomes worse after display many documents in pane, worst even if scanned images are in.
    After killing the  process, sometimes it generate even more process.
    After Killing all the process, sometimes need to deactivate the pane view and activate
    again to restore normal preview.
    Sometimes it takes a lot of time to progress to file below, if i wait, going to files above, it pass
    the file that shows delay, without any problem.
    I add received from Microsoft, in answer to the same issue to uninstall adobe reader and install
    latest version. It become a bit more stable, but problem still shows.
    Abobe reader: 10.1.0, ATI latest drivers 11-07
    Please, Help!

  • Can I use 1600x900 res while using VGA ?

    I have a new Mac Mini (2012) and I'm connecting it to a Viewsonic VA20137m-LED monitor. Both units say they'll support 1600x900 resolution, however, that option doesn't appear for me in the preferences / settings. I'm using a VGA cable to connect the two. Does anyone know why my proper resolution setting (1600x900) isn't available to me with this configuration?
    Thanks,

    What adapter are you using for VGA..?
    If you have the following > VA2037m-LED - 20” (19.5” Vis) Widescreen LED monitor, then it has both DVI and VGA inputs.
    I would get a DVI cable and use the Apple supplied HDMI to DVI adapte, the DVI cable connected to the rmonitors DVI input.

  • Can i use malloc function while using DLL created from C program

    Hi,
    I have written a simple program in C , which uses malloc function for allocating memory for the array.When iam calling that DLL using call library function node in labview, it is not giving any output, my doubt is can we use malloc function in C program from which we will create DLL and is called in labview? I am attaching my C code and DLL and also labview file please tell me where i am doing wrong?
    Thanks & Regards,
    Vishnu
    Attachments:
    first.zip ‏1010 KB

    Hi Vishnu,
    There's no problem using the Malloc function in C and call it as a DLL in LabVIEW.
    But LabVIEW has a different memory management than C.
    It is probably not recommended to allocate array memory in C for labVIEW arrays
    You can use initialize array in LabVIEW instead.
    Good luck
    Van L
    NI Applications Engineer

  • Can u just tell me how to use leap motion while using lappy & other apps also

    I hv bought HP envy leap motion few months back and i m not able to understand leap motion features.I've seen many videos about the features but i m not able to do it.Plzz help me

    Hi
    >> U need to go through documents and also videos
    >>the first link that i have mentioned is how tio use
    http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&dlc=en&docname=c03981766&lc=en&jumpid=reg_r1002_us...
    >>the second link a review of video which ill help u
    https://www.youtube.com/watch?v=478LbUj_zvs
    >>hope these documents helps u to find how to work with leap motion
    I am an HP employee

  • Compilation of adobe air app that uses ANE fails while using the flex ant tasks.

    The resolution seems to be a hack - which when you rename .ane files to .swc, it works.
    I came across this workaround here: http://stackoverflow.com/questions/11112705/using-ant-mxmlc-task-with-native-extension?rq= 1
    <mxmlc file="${app.root}/app.as" 
                   output="${output.dir}/app.swf"
                   allow-source-path-overlap="true"
                   debug="false"
                   actionscript-file-encoding="UTF-8"
                   swf-version="19" >
                <load-config filename="${framework.root}/air-config.xml"/>
                <source-path path-element="${framework.root}"/>
                <source-path path-element="src"/>
                <source-path path-element="other"/>
                <compiler.library-path dir="libs" append="true">
                    <include name="**/*.swc"/>
                </compiler.library-path>
                <!-- THIS DOES NOT WORK -->
                <compiler.external-library-path dir="nativeExtension" append="true">
                    <include name="**/*.ane"/>
                </compiler.external-library-path>
            </mxmlc>
    However, if I rename all the .ane files in the nativeExtension directory to .swc the following change works..
                <!-- THIS WORKS -->
                <compiler.external-library-path dir="nativeExtension" append="true">
                    <include name="**/*.swc"/>
                </compiler.external-library-path>
    Has this issue been addressed?
    I'm using the following:
    - Adobe AIR SDK & Compiler (version 3.7) for Mac OS X
    - ActionScript Compiler 2.0
    - Apache Ant wrapper located in "AIRSDK_Compiler/ant/lib/flexTasks.jar"
    Let me know if any other details will be helpful.

    I'm using something like this in my build.xml (inapp.purchase.flash.swc is the flash wrapper for the ANE):
                <external-library-path dir="${basedir}/extensions/inapp.purchase/inapp.purchase.flash/bin" append="true">
                    <include name="inapp.purchase.flash.swc" />
                </external-library-path>
    I don't think you need ANE when building swf component of your app. ANE is only required for packaging. By linking with external inapp.purchase.flash.swc you're just telling action script compiler that above symbols will be defined later (in ANE).

  • Instruction for using printer profile while using Brother printer...

    hi everybody,
    i am having some issues with my Brother MFC 255CW printer. When I have tried to print pictures on it. The colors of picture on the screen are totally different than the one on paper. I am trying to match it. I need help.

    Are you trying to print from editor or organizer? Also there are options under color management option where you can control the colors.

  • Error while using UTL_FILE

    I am getting the following error while using UTL_FILE procedure while using UTL_FILE.FOPEN procedure
    from system account. I am using Windows XP with NTFS.
    SQL> create or replace directory FILE_DIR as 'C:\'
    2 /
    Directory created.
    SQL> grant read on directory FILE_DIR to public;
    Grant succeeded.
    1 create or replace PROCEDURE file_upload IS
    2 v_file_name VARCHAR2(200);
    3 v_file_type UTL_FILE.FILE_TYPE;
    4 v_line VARCHAR2(1000);
    5 BEGIN
    6 v_file_name := 'customers_'||TO_CHAR(SYSDATE,'dd')||TO_CHAR(SYSDATE,'MON')||TO_CHAR(SYSDATE,'YYYY')||'.txt';
    7 v_file_type := UTL_FILE.FOPEN('FILE_DIR','V_FILE_NAME','r',1000);
    8 UTL_FILE.GET_LINE(v_file_type,V_LINE,1000);
    9 UTL_FILE.FCLOSE(v_file_type);
    10 DBMS_OUTPUT.PUT_LINE(V_LINE);
    11* END;
    SQL> exec file_upload;
    BEGIN file_upload; END;
    ERROR at line 1:
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 475
    ORA-29283: invalid file operation
    ORA-06512: at "SYSTEM.FILE_UPLOAD", line 7
    ORA-06512: at line 1
    I appreciate if someone can help me in this regard.
    Thanks in Advance.
    Regards
    Muhammad ALi

    Hello,
    What exactly are you trying to do? Here I got 2 examples for you , replace with your directory name and pick right option for 'a' (append) or 'w' (write) or 'R' (read).
    To read from a directory_ . This will read an existing file 'customer.txt" from the directory
    {code}
    CREATE OR REPLACE PROCEDURE .file_upload
    IS
    v_file_name VARCHAR2 (200);
    v_file_type UTL_FILE.file_type;
    v_line VARCHAR2 (1000);
    BEGIN
    v_file_name := 'customers.txt';
    v_file_type := UTL_FILE.fopen ('EXT_TABLES', v_file_name, 'R');
    UTL_FILE.get_line (v_file_type, v_line); -- Error was here
    DBMS_OUTPUT.put_line (v_line);
    UTL_FILE.fclose (v_file_type);
    END;
    {code}
    _*To open a file*_ This will create customer_XXXXX file under the directory
    {code}
    CREATE OR REPLACE PROCEDURE testme.file_upload
    IS
    v_file_name VARCHAR2 (200);
    v_file_type UTL_FILE.file_type;
    v_line VARCHAR2 (1000);
    BEGIN
    v_file_name := 'customers_'
    || TO_CHAR (SYSDATE, 'dd')
    || TO_CHAR (SYSDATE, 'MON')
    || TO_CHAR (SYSDATE, 'YYYY')
    || '.txt';
    v_file_type := UTL_FILE.fopen ('EXT_TABLES', v_file_name, 'a');
    UTL_FILE.put_line (v_file_type, v_line);
    DBMS_OUTPUT.put_line (v_line);
    UTL_FILE.fclose (v_file_type);
    END;
    {code}
    Regards
    Edited by: OrionNet on Jan 29, 2009 12:30 AM

  • Photo files disapearing from hard Drive while using Lighroom not relink issue, any ideas?

    I've been using Lightroom and while using it files have been disappearing, I understand how to relink the files, it's not that.
    The file folders are showing up but the files are missing. Not all files are affected. They haven't been in my trash.
    Seagate have sent me a 'What a shame, it's not our fault email' Won't be buying any more of their products. They say it's a lightroom / Mac OS problem.
    Does anyone know how I can retreive these missing files? If they've had the same problem? Thank you.

    Does anyone know how I can retreive these missing files?
    Restore from your backup copies
    Download and install an "undelete utility" (there are free ones available) and see if it can recover the files

  • Problem in DII client while using custome type

    Hi All,
    I am accessing a webservice using JAX-RPC DII cleint. Webserviuce is deployed on a websphere app server 6.0
    In Webservice i have 1 complextype called Address.
    When i try to call the webservice and try to pass the complex type as parameter to web service i get deserialization error for complexType.
    I tried to register it using TypeMappingRegistry but again iam getting
    exception like "you can't modify default typemapping".
    here is my code
    public class DIITip implements SerializerConstants {
    public static void main(String args[]) {
    try {
    QName serviceName = new QName("http://localhost:9080/AddressBookService/services/AddressBook/wsdl/AddressBook.wsdl","AddressBookService");
    ServiceFactory factory = ServiceFactory.newInstance();
    Call call = service.createCall();
    QName operationName = new QName("http://addr","setAddressFromName");
    call.setOperationName(operationName);
    // The input parameter
    call.addParameter(
    "arg_0_1", // parameter name
    QNAME_TYPE_CPLX_TYPE, // parameter XML type QName
    Address.class, // parameter Java type class
    ParameterMode.IN); // parameter mode
    // The return
    call.setReturnType(XMLType.XSD_BOOLEAN);
    // The operation is an RPC-style operation.
    call.setProperty(Call.OPERATION_STYLE_PROPERTY,"rpc");
    call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,"http://schemas.xmlsoap.org/soap/encoding/");
    call.setTargetEndpointAddress("http://localhost:9080/AddressBookService/services/AddressBook");
                   Address addr = new Address();
                   addr.setStreetName("Jogesh");
                   addr.setCity("Puri");
                   addr.setState("Orisaa");               
         TypeMappingRegistry registry = service.getTypeMappingRegistry();
         TypeMapping mapping2 = registry.getTypeMapping("");
         TypeMapping typeMapping = registry.getTypeMapping(SOAPConstants.URI_ENCODING);
    QName type = new QName("http://addr", "Address");
    CombinedSerializer serializer = new addr.Address_SOAPSerializer(type,
    ENCODE_TYPE, NULLABLE, SOAPConstants.NS_SOAP_ENCODING);
    serializer = new ReferenceableSerializerImpl(SERIALIZE_AS_REF, serializer);
    registerSerializer(typeMapping,addr.Address.class, type, serializer);
    // Invoke the operation
    Object[] actualArgs = {addr};
    Boolean obj = (Boolean) call.invoke(actualArgs);
                   if (null!= obj)
                        System.out.println(obj.getStreetName()+" "+obj.getCity()+" "+obj.getState());
                   }else
                        System.out.println("Obj is null");
    catch (Throwable t) {
    t.printStackTrace();
    private static void registerSerializer(TypeMapping mapping, Class javaType, QName xmlType,
    Serializer ser) {
    mapping.register(javaType, xmlType, new SingletonSerializerFactory(ser),
    new SingletonDeserializerFactory((Deserializer)ser));
    Anybody know how to register/use complext type while using DII client
    Many thanks for any help offered.
    capri

    Hey Capri,
    did you solved your problem?
    I' am also looking for a solution to add complex Types.
    I use webservices with apache axis. There I don't have to add the parameter to the call object. In the server-config.wsdd, there are all information about the complex type. So I only have to invoke webservice with my object.
    But now I want to invoke a BPEL-Process as webservice. I think at this term I have to add the parameter to the call object.
    regards,
    kirie

  • Volume problem while using headphone

    when I use my headphone I have no problem while talking on phone but when I try to listen to music or watch you tube I cannot hear the left side. I restored iphone and got replacement but same problem. I changed headphones but that wasent the problem as well. please help!

    s. laxnars wrote:
    I am facing some problem while using preparedStatement.setNull while using Bea's Orale XA Driver, the same code works fine with oracle XA driver,
    Can any one plz help on this.
    Here the code
    String insertIntoTestRequestQuery = "Insert into A values(?,?,?)";
    PreparedStatement dbInsertStatement = connection.prepareStatement(insertIntoTestRequestQuery);
    dbInsertStatement.setLong(1, 3L);
    dbInsertStatement.setString(2,"test");
    dbInsertStatement.setNull(3,java.sql.Types.NULL);
    I am using Weblogic 9.2 with Oracle 9i
    here the Spy Log
    spy>> PreparedStatement[163].setNull(int parameterIndex, int sqlType)
    spy>> parameterIndex = 1
    spy>> sqlType = 0
    spy>> java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver. ErrorCode=0 SQLState=HY004
    java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver.
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.validateSqlType(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setObjectInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setNull(Unknown Source)
         at weblogic.jdbcx.base.BasePreparedStatementWrapper.setNull(Unknown Source)
         at weblogic.jdbcspy.SpyPreparedStatement.setNull(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:491)Hi. This is a known issue. Call official BEA support and open a case
    so you will be notified when a new driver will have the fix. In the
    meantime, if you set the Type to correspond to the DBMS's column type,
    it will work. In fact, I'll bet that if you just set the Type to VARCHAR
    it will work, regardless of the actual column type...
    Joe

  • Problem while using BEA's Oracle Driver

    I am facing some problem while using preparedStatement.setNull while using Bea's Orale XA Driver, the same code works fine with oracle XA driver,
    Can any one plz help on this.
    Here the code
    String insertIntoTestRequestQuery = "Insert into A values(?,?,?)";
    PreparedStatement dbInsertStatement = connection.prepareStatement(insertIntoTestRequestQuery);
    dbInsertStatement.setLong(1, 3L);
    dbInsertStatement.setString(2,"test");
    dbInsertStatement.setNull(3,java.sql.Types.NULL);
    I am using Weblogic 9.2 with Oracle 9i
    here the Spy Log
    spy>> PreparedStatement[163].setNull(int parameterIndex, int sqlType)
    spy>> parameterIndex = 1
    spy>> sqlType = 0
    spy>> java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver. ErrorCode=0 SQLState=HY004
    java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver.
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.validateSqlType(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setObjectInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setNull(Unknown Source)
         at weblogic.jdbcx.base.BasePreparedStatementWrapper.setNull(Unknown Source)
         at weblogic.jdbcspy.SpyPreparedStatement.setNull(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:491)

    s. laxnars wrote:
    I am facing some problem while using preparedStatement.setNull while using Bea's Orale XA Driver, the same code works fine with oracle XA driver,
    Can any one plz help on this.
    Here the code
    String insertIntoTestRequestQuery = "Insert into A values(?,?,?)";
    PreparedStatement dbInsertStatement = connection.prepareStatement(insertIntoTestRequestQuery);
    dbInsertStatement.setLong(1, 3L);
    dbInsertStatement.setString(2,"test");
    dbInsertStatement.setNull(3,java.sql.Types.NULL);
    I am using Weblogic 9.2 with Oracle 9i
    here the Spy Log
    spy>> PreparedStatement[163].setNull(int parameterIndex, int sqlType)
    spy>> parameterIndex = 1
    spy>> sqlType = 0
    spy>> java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver. ErrorCode=0 SQLState=HY004
    java.sql.SQLException: [BEA][Oracle JDBC Driver]The specified SQL type is not supported by this driver.
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.validateSqlType(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setObjectInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.setNull(Unknown Source)
         at weblogic.jdbcx.base.BasePreparedStatementWrapper.setNull(Unknown Source)
         at weblogic.jdbcspy.SpyPreparedStatement.setNull(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:491)Hi. This is a known issue. Call official BEA support and open a case
    so you will be notified when a new driver will have the fix. In the
    meantime, if you set the Type to correspond to the DBMS's column type,
    it will work. In fact, I'll bet that if you just set the Type to VARCHAR
    it will work, regardless of the actual column type...
    Joe

Maybe you are looking for

  • Intercompany Transactions

    Experts, I am in the process of moving AP and AR of one Co Cd to another Co Cd, and in the process i have identified the respective accounts from where the amount would be transferred in the sending Co Cd (A) as well the accounts in the receiving Co

  • "photo share" option (to imbed photos in an email)

    PSE12 had an email feature "photo mail" option (to imbed photos in an email) in addition to an email attachment option. This option is missing in PSE13. Is there any way to imbed photos in the body of an email in PSE13 like there was in PSE12? Messag

  • Can I still receive responses after June 22?

    I have existing surveys that will still be collecting data after AdobeForms reduces functionality in late June. Can I still receive responses until the final retirement date?

  • ThreadPoolExecutor in JEE application server

    Our application runs inside a jee application server. We have tasks (implemented as a pojo) that need to be queued and executed by asynchronous threads. We came across the new java.util.concurrent.ThreadPoolExecutor, which seems to be exactly what we

  • Business process for Service related Sales Order

    Dear Sir, We have a business scenarion as per following: A Customer has given an Order for providing a Service related to repairing of a Machine at customer site .  To repair the machine , we have to send our engineer at customer site and also need t