Calling out a script with a list of variables from another script RRS feed

  • Question

  • This is kicking my rear! I'm tasked with creating a "SINGLE" GLOBAL login script and I have the script working fine but I like to create a variable for each share:

    $USshare01 = \\usserver01\share01

    $USshare02 = \\usserver01\share02

    $MexShare01 = \\mexserv01\share01

    $MexShare02 = \\mexserv01\share02

    $Frshare01 = \\Frserver01\share01

    $Frshare02 = \\Frserver01\share02

    $Frshare03 = \\Frserver02\share01

    I have about 200 of these so, as you can imagine, it takes up allot of real estate so I thought would try moving all the variables to their own script then, from within the login script, be able to call this script with the list of variables and be able to pick a specific variable to assign.

    Example: From login script:

    If ($Groups -contains FRshare2access) Net Use $Frshare02

    If ($Groups -contains USshare01access) Net Use $USshare01

    But I can't seem to get the login script to "Load" any variables from the other script... Any help would be greatly appreciated!


    Jason Ostrowski

    • Moved by Bill_Stewart Wednesday, September 5, 2018 10:03 PM This is not "teach me basics step-by-step" forum
    Tuesday, July 3, 2018 10:53 PM

All replies

  • I actually found the solution... Dot-sourcing and it works... Thank You

    Jason Ostrowski

    Tuesday, July 3, 2018 11:12 PM