Announcement

Collapse
No announcement yet.

adding to path enviroment variables

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • adding to path enviroment variables

    hey all,
    have been asked to add a path for all windows users, so they can run certain commands from a a prompt without having to complete the whole path.

    In the path folder is dll's and exe's

    So the job is basically to set for each user the
    environment variable path to be whatever it was plus that directory
    tacked onto the end.

    e.ge path is w:\vol\company\nt\bin which is too be added

    whats the best way to do this so it will include on all windows machine on the domain
    baring in mind there is no GPO's setup here, as no OU's contructed
    but am building a new domain , but need this path done now

    thanks in advance

  • #2
    Re: adding to path enviroment variables

    3 ways to do it.

    1.
    Easiest way is via a logon script batch file.

    Create a batch file and add the following to it:

    set path=%path%;C:\append path

    2.
    Logon script via vbscript.
    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell") 
    Set WshEnv = WshShell.Environment("SYSTEM") 
    WshEnv("Path") = WshEnv("Path") & ";C:\append path"
    3.
    Manually edit the system variable "PATH", in system properties->advanced tab->environment variables button - append the current path.
    Last edited by ahinson; 26th August 2005, 13:04.
    Andrew

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: adding to path enviroment variables

      so i can add it to a logni script as

      set path=%path%;w:\vol\company\nt\bin

      or is it

      set path=%path%;C:\append path w:\vol\company\nt\bin

      sorry is question is dumb
      dont script much at all!!

      in this bin folder is exe's and dll's
      so the user can just jump in and type in jam for jam.exe instead of the whole path

      so if this is already part of the login script

      REM Sas: 170205 - Harvest local path for user - testing.
      rem Sas: 210305 - No more harvesting for now.
      rem echo Harvesting local user's path.
      rem call w:\vol\weta\nt\paths\paths.bat

      what do i need to add to this for my env path
      without adding it to the paths.bat
      Last edited by Maxwell Shivers; 24th August 2005, 04:33.

      Comment


      • #4
        Re: adding to path enviroment variables

        exually 4 ways

        4) configure it through the registry:
        For the user settings: HKCU\Environment

        For the Machine settings:
        HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

        and for configure it through the registry, there also multiple options:
        export the registry part
        import it through regedit /s regfile.reg

        write a script with Reg.exe see
        http://www.petri.com/reg_command_in_windows_xp.htm (if you're using 2000 you can copy this file from xp to 2000)

        write it via a VBscript for example:
        http://www.microsoft.com/technet/scr.../osrgvb01.mspx



        Maxwell,

        Whats standing in the paths.bat???
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment


        • #5
          Re: adding to path enviroment variables

          Add it to the bottom of the existing batch file so that any changes made to the path prior to adding this will remain intact.

          Code:
          REM Sas: 170205 - Harvest local path for user - testing.
          rem Sas: 210305 - No more harvesting for now.
          rem echo Harvesting local user's path.
          rem call w:\vol\weta\nt\paths\paths.bat
          set path=%path%;w:\vol\company\nt\bin
          Also lines that are REM'd out are ignored so it looks like its not calling paths.bat right now.
          Last edited by ahinson; 24th August 2005, 14:43.
          Andrew

          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

          Comment


          • #6
            Re: adding to path enviroment variables

            hey,

            have added your path as you showed above
            but still no go,

            in the bin folder theres a bunch of dll's and exe,
            so when in cmd prompt you can type the full path

            w:\vol\company\nt\bin\jam jam being and exe and it runs fin
            so i want it by adding this path so users can just open a cmd prompt and type jam
            am i going about this the right way ?

            appreaciate all help btw

            Comment


            • #7
              Re: adding to path enviroment variables

              Try it manually and see if it works. It may be that the script isn't being processed.

              Open cmd and type set path=... etc. then type jam.exe to see if it works.
              Andrew

              ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

              Comment


              • #8
                Re: adding to path enviroment variables

                hrmm yeah tried it manually and worked perfectly
                so script not being exeuted
                any ideas as to why that is, with the part i showed you above?

                Comment


                • #9
                  Re: adding to path enviroment variables

                  Is it processing some of the batch file or none it? Anything with REM at the beginning of the line is skipped.
                  Andrew

                  ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                  Comment


                  • #10
                    Re: adding to path enviroment variables

                    it processes drive mounts ( net use) a start menu folder deployment and an audit scan
                    Just cant seem to get paths going
                    just a straight forward ntlogon batch file for logins, but cant seem to get these paths set

                    i also created apath.bat and assigned that as the login script with the set path etc command only and still no joy

                    driving me a little up the wall now =]
                    Last edited by Maxwell Shivers; 26th August 2005, 00:15.

                    Comment


                    • #11
                      Re: adding to path enviroment variables

                      please post you're script...
                      Marcel
                      Technical Consultant
                      Netherlands
                      http://www.phetios.com
                      http://blog.nessus.nl

                      MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                      "No matter how secure, there is always the human factor."

                      "Enjoy life today, tomorrow may never come."
                      "If you're going through hell, keep going. ~Winston Churchill"

                      Comment


                      • #12
                        Re: adding to path enviroment variables

                        echo.
                        echo Please standby for logon

                        net time \\server /set /y
                        net use w: /d
                        net use w: \\dfs\dfs /y
                        cls
                        echo I guess it's not so much a logon script...
                        echo ...as it is a Dodge-ball cannon.
                        echo.
                        echo Company Digital Network
                        echo Creating Networked Drives
                        echo Authenticating Licensed Software
                        echo.
                        echo.
                        echo Please standby for logon
                        echo.
                        echo.
                        echo.
                        echo.
                        echo.
                        echo.
                        echo.
                        echo.
                        echo.
                        echo NOTE:
                        echo If this screen appears for longer than 1 min please close window to continue
                        echo.
                        echo Thankyou
                        echo.

                        rem ****** LICENCE UPDATE ******
                        rem echo a| xcopy w:\hosts\eric\var\flexlm\*.* c:\flexlm\ /s
                        rem attrib -h c:\autoexec.bat
                        rem echo a| xcopy w:\tech\public\autoexec\*.* c:\ /s
                        rem attrib +h c:\autoexec.bat

                        set [email protected]:[email protected]:[email protected]: [email protected]:[email protected]:[email protected]:[email protected]:[email protected] lie:[email protected]:[email protected]:[email protected];[email protected]

                        REM ***disable UPNP***
                        REM W:
                        REM cd \stuff\prod\tech\software\Wintel\Utils\unpnp
                        REM unpnp disable

                        echo Confirming c:\temp existance.
                        REM Sas: Make sure c:\temp exists
                        if not exist c:\temp mkdir c:\temp


                        set path=%path%;w:\vol\company\nt\bin


                        echo Deploying COMPANY TOOLS to Start Menu
                        REM Sasquatch: wtMkdir Phone ICON deploy to START MENU. As above.
                        if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Start Menu\Company Tools\" mkdir "c:\documents and settings\%USERNAME%\Start Menu\company Tools\"
                        if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Start Menu\Company Tools\company wtMkdir.lnk" copy "w:\vol\weta\nt\programfiles\company wtMkdir.lnk" "c:\documents and settings\%USERNAME%\Start Menu\Company Tools\Company wtMkdir.lnk"

                        REM Sasquatch: Shotsub ICON deploy. Catch 2K C: installs
                        REM if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Desktop\ShotSub GUI.lnk" copy "w:\vol\weta\nt\programfiles\ShotSub GUI.lnk" "c:\documents and settings\%USERNAME%\desktop\ShotSub GUI.lnk"
                        if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Start Menu\Company Tools\ShotSub GUI.lnk" copy "w:\vol\company\nt\programfiles\ShotSub GUI.lnk" "c:\documents and settings\%USERNAME%\Start Menu\Company TOols\ShotSub GUI.lnk"

                        REM Sasquatch: Phone ICON deploy, as above.
                        REM if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Desktop\Phone.lnk" copy "w:\vol\company\nt\programfiles\Phone.lnk" "c:\documents and settings\%USERNAME%\desktop\Phone.lnk"
                        if exist "c:\documents and settings\%USERNAME%" if not exist "c:\documents and settings\%USERNAME%\Start Menu\Weta Tools\Phone.lnk" copy "w:\vol\company\nt\programfiles\Phone.lnk" "c:\documents and settings\%USERNAME%\Start Menu\Company Tools\Phone.lnk"

                        REM Added PRINTER PUSH - Sas 14/2/2005
                        REM They should be out there everywhere by now, disabling push. 29/3/2005

                        rem echo Pushing Printers
                        rem \\server\netlogon\printer_setup.bat

                        REM CTF ***audit***
                        echo Software audit in progress...
                        \\server1\ezaudit\ezscan.exe auto
                        echo ...Audit complete.


                        echo COMPLETE.

                        exit
                        Attached Files

                        Comment


                        • #13
                          Re: adding to path enviroment variables

                          Since that's not working try creating a vbscript that does the same thing and call it from your logon script. I believe I already gave you code to do it.
                          Andrew

                          ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                          Comment


                          • #14
                            Re: adding to path enviroment variables

                            hey
                            did that, call to paths.vbs and got his error

                            Could not locate automation calls named "WScript.*Shell"

                            Comment


                            • #15
                              Re: adding to path enviroment variables

                              Originally posted by Maxwell Shivers
                              hey
                              did that, call to paths.vbs and got his error

                              Could not locate automation calls named "WScript.*Shell"

                              Oops, remove the * before shell it was a typo.
                              Andrew

                              ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

                              Comment

                              Working...
                              X