Add firewall rule with custom environment variable in program path

Hi,
We want to create a firewall rule for a program which is placed in folder which changes sometimes. I know you can add a firewall with the ProgramFiles environment variable like this:
netsh advfirewall firewall add rule name="Test Firewall rule" dir=in program="%%ProgramFiles%%\Test\Test.exe" action=allow security=notrequired
The environment variable ProgramFiles isn't expanded and if the Program Files folder is different on a system the rule still works.
We try to use this with a custom environment variable which we set a system environment variable with this command:
SETX SomeFolder "D:\Some Folder\Apr 2015" /M
If we use the command below to add the firewall rule in a batch file the environment variable SomeFolder is expanded correctly and the program path is added as a static path.
netsh advfirewall firewall add rule name="Some Firewall Rule" dir=in program="%SomeFolder%\AFile.exe" action=allow security=notrequired
Because the folder changes sometimes we want to change the environment variable SomeFolder and not remove the old firewall rule and create a new one. We want to add the environment variable SomeFolder to the program path as a (dynamic) environment variable
and not as the expanded path at the moment when the rule is added. If we use this command:
netsh advfirewall firewall add rule name="Some Firewall Rule" dir=in program="%%SomeFolder%%\AFile.exe" action=allow security=notrequired
We get the error:
          Windows Firewall with Advanced Security
          An error occurred while adding the rule.
          Error: The parameter is incorrect
          Status: The application name could not be resolved
          OK   
Why can't we use %%SOMEFOLDER%% like we can use %%PROGRAMFILES%%? The same error is shown when we try to add the firewall rule through the management console 'Windows Firewall with Advanced Security'
W. Spu

Hi,
Based on my plenty of test with this problem, it seems like there is no better method to achieve your requirement. To add new policy to firewall, it would be better using general cmdlet. The path parameter like %%SomeFolder%% do have problem in add firewall
policy cmdlet. 
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • Using custom environment variables in the profile path

    Hi,
    I've created a custom environment variable that I've setup on two computers and the domain controllers.  I want to use this in the profile path in user properties.  However when users log in the variable is taken literally rather than being converted
    into the value.  For example
    \\fileserver\share\user\%myenv%.v2 is generated rather than \\fileserver\share\user\envdata.v2
    If I add in another built-in variable such as %OS%, that converts properly but any time I use a custom variable Windows just doesn't use it during the logon process.  If I open up Explorer and type in the path to my data as it should be it works fine
    so Windows is definitely picking up the variable, just not using during the logon process.  I can't seem to find a TechNet article that states custom variables can't be used in profile paths.
    Has anyone else come across this?
    Thanks,
    Tim

    Hi,
    Thanks for your post.
    So did you create the environment variable using group policy? If yes, i would suggest you use 'Create' and not 'Update', the variable is then held through reboots.
    Please refer to this blog, hope it will be helpful
    http://blogs.technet.com/b/askds/archive/2013/07/31/roaming-profile-compatibility-the-windows-7-to-windows-8-challenge.aspx
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Deployment Issues with Custom TS variables set for client

    Good Day folks!
    I have come across an interesting issue that I have not been able to find a quick fix as such I am looking for some ideas where to trouble shoot my issue moving forwards.
    So the Issue:
    I have a TS that deploys a Windows 8.1 SOE image, this is done first by using a PXE boot PE image for an “unknown” systems to load a Custom HTA. This HTA allows me manually add the system to SCCM and add it to a required deployments collection that has the
    8.1 SOE deployed to it.
    The HTA also sets a few custom variables for the system resource things like system location, Machine Domain etc. 
    Once the HTA has run the system then has a delay to allow for the resource to show up tin the 8.1 deployment collection and then closes.
    Now all this appears to work fine, the system is added to the collection, reboots and the deployment runs from start to finish without error.
     I can also check the system resource and the variables are present.
    The problem I have found is that the custom variables for this resource are not being used by the TS after reboot.. upon further investigation I found that these variables are not even being retrieved ( ran a VB script to save all the variables from the
    TS to a txt file to check this )  Because of this the TS is bypassing some needed TS Tasks.
    A few interesting things to note:
    System appears to be added again when AD discovery is run…. So it causes a Duplicate.
    Client Dose connect to SCCM server after deployment but is not receiving deployments ( is getting some policy )
    Worked with SCCM 2012 but not 2012 R2
    So it appears that when the system reboots from the HTA PE step it has identified itself as an unknown system again…. Even though it has been manually added…
     I am interested to know if first of all if others would agree with this and second how SCCM while running a TS matches itself up to a system to retrieve the custom set variables before client install etc... Or a good place to start looking
    to dig up more information!  Or anything else!
    Thanks
    Stuart.

    Have you taken a look at this hotfix?
    http://support.microsoft.com/kb/2907591
    We had to apply it in order for our variables to be seen.
    joeblow

  • How do I use Embed with an environment variable in an Actionscript AIR project Flash Builder 4.7

    I am using Flash Builder 4.7 to build an Actionscript AIR project.  The project embeds a number of png files from my local directory and I have been using absolute paths which all works fine.
    I have a laptop with which I want to start developing the same project - I set up a git repository that both the laptop and main pc can pull from and so I can get the source where I need it and push it back to the central repository.
    My problem is that the absolute paths for the embed commands don't work on the laptop as it has a different filesystem setup (Windows 8 with one drive as opposed to Windows 7 with a SSD and a data drive).  I thought the solution would be as easy as using an environment variable to specify the path which could then point to a different physical directory on both machines, i.e:
    [Embed(source = "DEVELOPER_RESOURCES/graphics/are/here.png"]
    I did a bit of research and there was quite a lot mentioned about setting up resource directories using path variables which I worked through but I just can't get it to compile.  The Actionscript compiler just won't find the png files however I specify the path.  I tried something with a FLEX project and the compiler didn't complain but I think this is because the compiler for FLEX uses a different convention.
    [Embed(source ="/Project Name/DEVELOPER_RESOURCES/graphics/are/here.png"]  works with FLEX but not Actionscript.
    So does anyone have a recipe for using the Embed command referencing assets using an environment variable that works across multiple machines with different file structures?

    I managed to find a solution on Windows which was to use symlinks and absolute paths.  You an basically point one directory to another so I did something like:
    mklink c:\developer_resources c:/the/local/path/to/my/resources
    and then reference all resources as c:\developer_resources\...
    Now as long as a developer machine has the right link (from c:\developer_resources to the place where the resources are kept) then it seems to work. 
    This doesn't however work for Mac and certainly isn't a solution for passing files between Mac and windows

  • Problem with customer exit variable in BeX Query

    Hi All,
    We have created a customer exit variable in a query and populated with few patterns in customer exit.
    My query has to bring all the records where the address line is containg the patterns passed through customer exit. Here the query is not working as expected.
    It is bringing the values where the address line is exactly same as the pattern and not bringing the records where the pattern is part of the address line.
    For example: Pattern passed in customer exit = 'HOSPITAL'
    The record where address line = 'HOSPITAL' is shown in the rpeort, where the record with address line = 'HOSPITAL ROAD' is not shown in the report.
    I would appreciate your help on this.
    Regards,
    Rakesh

    Hi Diogo,
    Below is the code I am using in the customer exit.
    SELECT * FROM zae_tt_pbuild INTO TABLE gt_pbuild.
          IF sy-subrc = 0.
            LOOP AT gt_pbuild INTO gs_pbuild.
              CONCATENATE '*' gs_pbuild-pbuild '*' into lv_pattern.
              ls_range-low = lv_pattern.
              ls_range-sign = lc_sign_i.
              ls_range-opt = 'CP'.
              APPEND ls_range TO e_t_range.
              CLEAR: ls_range,
                     lv_pattern.
            ENDLOOP.
          ENDIF.
         ENDIF.
    I have tried using '%' instead of '*' aswell but the result is same.
    Thanks,
    Rakesh

  • Problem with customer exit variable that is input ready as well

    Hello all,
    I'm facing an issue with a customer exit variable that again has been defined as input ready. I'm not sure why it is working incorrectly and I#m wondering if this is a bug or if I do s.th. stupid.
    The problem is that in the exit program ZXRSRU01 this varibale does not go into the program code I have prepared for this variable. I have added entry points for all three i_step values 1,2,3, but the code will never be touched and in debugging I can see that it simply pypasses the code for this variable.
    I have tried to enter a value or to leave it blank, no difference.
    When I run another test by just using a customer exit variable w/o input ready capability, then I have no issue, the exit does exactly what I have coded.
    Does this mean, that a customer exit variable along with input readiness dows not work ?????
    You may ask why I need this variable. Well, my intention is to use the input value of this variable A to derive other values for a complete different variable B. Afterwards I want to erase the input given into variable A to have it blank.
    Any comments are appreciated
    Thanks

    Hi Heiko,
    I assume A & B variables are defined on different Characteristics. If you wish to derive B based on A, you can create the Query Characteristic Restriction on B & have a dummy RKF restricted on A whose processing is by Manual Input; where processing of B is by Customer Exit. In istep 2 you can check for B, read A & derive B. There would not be a need to blank out A since the Query would not be restricted on A - you can hide the dummy RKF from showing in the output. Just a thought.
    --Priya

  • Sql Loader with TSN environment variable.

    Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???

    952189 wrote:
    Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???
    >Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???
    if sqlldr is run on DB Server system, then no tnsnames.ora file is required.

  • Help with setting environment variable on solaris 10

    hi, i am new to solaris. i have solaris 10 x86, and as root user, i installed jdk 6 into /usr/jdk/jdk1.6.0_20. now i want to add the path /usr/jdk/jdk1.6.0_20/bin to my path variable. also i want to set JAVA_HOME. but each time i do this, and close the terminal, it resets. i mean when i echo $JAVA_HOME, i get nothing and if i echo $path, the address i aded is no longer there too.
    what can i do to make this permanent. and do i have to set it for every user, or will the one set by root, be seen by all users?
    thanks.

    Assuming you're using tcsh, then I typically place my environment variables in my .login.
    You can also place them in your .tcshrc file.
    Use
    setenv JAVA_HOME <path>
    for tcsh.
    For the Bourne shell, you can put them in the .profile file.
    Use
    JAVA_HOME=<path>
    export JAVA_HOME
    -- Ken

  • Text Variable replace with Customer Exit Variable

    Dear Experts,
    I created a text variable based on replacementh path (instead of customer exit). The reference characteristic is same that as my customer exit Variable and replace it by Key.
    I want to replace it with already Existing Customer Exit Variable but it is not displaying in the List Box even though existing variable option is mandatory.
    Can any one Suggest me the answer for this.
    Regards
    Supraja.K

    I do not think you can select Customer Exit variable, if you see the type is selected to Char Value Variables and it is not editable.
    It would be suggested to go for Customer Exit procesing type for your text variable.
    Cheers,
    Neel.

  • Authorization (rsecadmin) with customer exit variable

    Hello,
    I need to maintain authorization on 0CALMONTH with a customer exit variable.
    0CALMONTH is "authorization relevant"
    I created a variable of type "customer exit" : ZVAR001 (this variable is OK, I checked its value in a query)
    I created a new authorization object with 0CALMONTH = $ZVAR001.
    When I run my query I have a message due to authorization error.
    If I change my authorization object by replacing my variable ($ZVAR001) by a constant value I have no authorization problem.
    I don't understand why...
    Error logs don't help me to solve my problem : I have the following message "Message EYE007: You do not have sufficient authorization" and system just says I have "0CALMONTH  I EQ $ZVAR001 " but doesn't precise values under variable ZVAR001
    Thanks for your help

    Indeed problem was in costumer exit because I used condition with "I_STEP". Since I have delete my condition I have no authorization problem with my variable....

  • Authorization with customer exit variable (CP, BT, EQ)

    Hi SDN-Experts,
    I have a question concerning the new authorization concept.
    I created an authorization for 0COSTCENTER which also contains the 3 special characters 0TCAACTVT, 0TCAIPROV and 0TCAVALID. I inserted a customer exit variable for 0COSTCENTER. The exit reads datasets from a db table which contains authorizations for the actual user. The authorizations have different formats, e.g. "1000", "1000;1200", "25*" etc.
    The internal table e_t_range is filled as followed in the exit:
      i   eq   1000
      i   bt   1000   1200
      i   cp   25*
    This does not work. It works if I only use "eq" OR "cp". But not both at the same time.
    How can I achieve to use the different authorizations in the db table for the bi authorization?
    Thanks in advance...
    Joerg

    Hi Olivier.
    Yes, the variable is defined as selection option and I did also try to use "EQ" instead of "CP".
    I tested again with another variable which is "ready for input" and is not used in an authorization. The Variable is filled in the customer exit. This is the code:
    WHEN 'ZJGR_COSTCTR_TEST'.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      l_s_range-low = '0000001000'.
      l_s_range-high = '0000001200'.
      APPEND l_s_range TO e_t_range.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'CP'.
      l_s_range-low = '0000002*'.
      APPEND l_s_range TO e_t_range.
    The result in the variable screen in BEx Analyzer is the following:
    1000 - 1200;0000002*;
    And it still does not work. It seems that you could not mix EQ, BT and CP. But this is exactly what I have to do with the authorization variable...
    Do you have any other tipps that I might try out?
    Thanks,
    Joerg

  • RSCRM: Query date with customer exit variable

    Hi All,
    Is there any way to run the RSCRM transaction with a query with a customer exit variable for a date characteristic?
    The issue is that the query ran ok but the variable is not being updated when the RSCRM query is running with a background job or a process chain.
    Thanks in advance
    EV

    I do not think you can select Customer Exit variable, if you see the type is selected to Char Value Variables and it is not editable.
    It would be suggested to go for Customer Exit procesing type for your text variable.
    Cheers,
    Neel.

  • UDM and shell scripts and working with the ENVIRONMENT variable options

    In Userdefined metrics you have the ability to pass envronment variables.
    I was going to send
    DIR=/db/db05/oradata/ORCL/hot
    How to handle whats passed to the shell script?
    It passes $1 as {DIR=/db/db05/oradata/ORCL/hot}
    yes with the brackets. Here I figured it would simply set the DIR environment variable.
    Any cool tricks to work with this mess?
    Is it meant for perl scripts instead?
    Daryl.

    Ilmari Aalto wrote:
    Hi Darth,
    Thanks for your hint! Nevertheless I think it's something more profound, since there's no error etc. For example, should I have the path wrong I assume that OWB would return me some kind of an error when it doesn't find the .sh-file? Isn't there any log-file to see whether the command was executed? It seems like the execution of the User Defined element would be skipped altogether.
    Cheers,
    IlmariNo, if you don't give an absolute path OWB will not return any error, it just wont do anything at all...

  • Adrelink.sh fails with new environment variable settings (HISTTTY)

    Our IBM-AIX system administrators have adjusted some Unix Host environment variables, like HISTTTY, and made them readonly. They did this for locking down some security issues. When you run adpatch, for example, it would error when running adrelink. When you look at adrelink log, you see the following text:
    You are running adrelink, version 115.28
    Start of adrelink session
    Date/time is Mon Feb 7 10:42:00 EST 2011
    Log file is /in/OAAP/apps11i/oaapappl/admin/OAAP/log/adrelink.log
    Command line arguments are
    "force=y" "ranlib=y" "link_debug=n"
    "filelist=/in/OAAP/apps11i/oaapappl/admin/OAAP/out/alkglx000.txt"
    Operating System Information (output of 'uname -a'):AIX m015ap01 3 5 000AB1E0D600
    Backup Mode is "file"
    Removing extra variables from the environment...
    adrelink will save the following variables (if set): - Generic:"PATH ORACLE_HOME TMPDIR TZ APPL_TOP APPLFENV
    PLATFORM LD_LIBRARY_PATH COBDIR
    LIBPATH NLS_LANG JAVA_TOP PERL5LIB"
    - Shell-Specific: "PS1 PS2 PS3 PS4 IFS MAILCHECK _ LOGNAME A__z"
    Beginning pass 1.
    Processing 408 environment variables...
    /in/OAAP/apps11i/oaapappl/ad/11.5.0/bin/adrelinknew.sh[1066]: HISTTTY: is read only
    adrelink is exiting with status 1
    End of adrelink session
    Date/time is Mon Feb 7 10:42:01 EST 2011
    Thanks in advance!

    Our IBM-AIX system administrators have adjusted some Unix Host environment variables, like HISTTTY, and made them readonlyWhat is the value of HISTTTY"
    Processing 408 environment variables...
    /in/OAAP/apps11i/oaapappl/ad/11.5.0/bin/adrelinknew.sh[1066]: HISTTTY: is read only
    adrelink is exiting with status 1
    End of adrelink sessionFrom the error, looks like you need to give applmgr user more privileges on HISTTTY (try the execute privilege only first).
    Thanks,
    Hussein

  • Problem with customer exit variable

    HI i have created a customer exit variable to rread a table based in user input and pass it to my variable , every thing works fine but i get a waring message in my WAD saying
    RANGE-LOW for customer exit variable ZVSO_PRM corrected to #   BRAIN  746
    Does any one have any idea why is it comming
    my code is as follows
    WHEN 'ZVSO_PRM'.
    IF I_STEP = 2.
    DATA: BEGIN OF ZPROD_MODEL OCCURS 0,
    I_PROD LIKE ZCURR_PM_T-/BIC/ZPRODMOD,
    END OF ZPROD_MODEL.
    DATA: BEGIN OF ZREGIO_TABLE OCCURS 0,
    REGION LIKE ZCURR_PM_T-/BIC/ZREGION,
    END OF ZREGIO_TABLE.
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZREG02'.
    CLEAR L_S_RANGE.
    ZREGIO_TABLE = LOC_VAR_RANGE-LOW.
    APPEND ZREGIO_TABLE.
    ENDLOOP.
    LOOP AT ZREGIO_TABLE.
    SELECT /BIC/ZPRODMOD FROM ZCURR_PM_T INTO TABLE ZPROD_MODEL WHERE /BIC/ZREGION = ZREGIO_TABLE-REGION.
    APPEND ZPROD_MODEL.
    ENDLOOP.
    SORT ZPROD_MODEL.
    CLEAR L_S_RANGE.
    LOOP AT ZPROD_MODEL.
    L_S_RANGE-LOW = ZPROD_MODEL-I_PROD.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'EQ'.
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDLOOP.
    ENDIF.

    Could it be that the code doesn't find any value in ZCURR_PM_T table for the specified input region?

Maybe you are looking for

  • Error while runnig adcfgclone.pl dbTier

    Hii. i was cloning my PROD instance to a Test instance and while configuring the target system database server perl adcfgclone.pl dbTier, Im getting the following error The new database context file has been created : */u03/UAT/uatdb/10.2.0/appsutil/

  • Calibrating Apple Cinema Display for Video Editing

    What's the procedure to calibrate an Apple Cinema Display for editing in FCP (editing and preliminary color grading)? My camcorder can produce color bars, but I can't hook it up directly to the monitor. Shall I record color bars and use the recorded

  • How do you correct syntax errors in OSX 10.9.3?

    How do you correct syntax errors in OSX 10.9.3? Hal Frederick

  • Java error when using cfhttp to any SSL site

    On only one of our boxes (CF 8.01. Windows 2003 x86 SP1 - we are getting our it guys to update it to SP2), if we use cfhttp to get to any SSL site, we receive the following error: I/O Exception: java.security.NoSuchAlgorithmException: Error construct

  • LocalDirector 416 - Browser stays on one server

    I have 5 servers balanced behind LocalDirector. There is no sticky command. They are balanced in a 'weighted' configuration. This is the predictor statement (predictor 192.168.0.10:0:0:tcp weighted). When someone’s browser makes a connection to the b