+ Post New Thread
Results 1 to 1 of 1
Scripts Thread, AD Group conditional startup script if anyone wants? in Coding and Web Development; Hi All, so, I am in the process of learning Powershell, and my first real project was to build a ...
  1. #1

    Join Date
    Feb 2008
    Location
    Stevenage, Hertfordshire
    Posts
    111
    Thank Post
    3
    Thanked 8 Times in 5 Posts
    Rep Power
    14

    AD Group conditional startup script if anyone wants?

    Hi All,

    so, I am in the process of learning Powershell, and my first real project was to build a startup script responsible for mapping network drives. what i did yesterday, then today(version 1.5) i added more functionality to map network drives depending upon what AD group the user is part of. and here it is!

    startup_1.5.ps1.zip

    USE'S:
    ---------------------
    Whatever you want! lol... rip it apart, use it entirly, I don't mind!

    Although if you do any form of bug fixing, or have any feedback/advice then please post it here! As i mentioned, im still learning. so need feedback!

    INSTRUCTIONS:
    If you open the file up(i recommend opening it in notepad++, windows notepad doesn't seem to appricate the tab "lining up") for editing you will find an array at the top that looks a little like:

    Code:
    $drivelist = 	('authenticated users', 'G:', '\\server\projects'),
    				('group1', 'Z:', '\\server\tsweb'),
    				('accounts', 'Y:', '\\server\tsweb')
    the format is: ('GroupName', 'DriveLetter', 'UncPath')

    GroupName is the name of the AD group the user must be a member of for that drive to be mapped (using "authenticated users" or "domain users" will result in the drive being mapped for everyone, good for common drives!!)

    DriveLetter is the drive letter you want mapped drive to be set as!

    UncPath is the path to the server (EG: \\server\share\folder\subfolder\etc)


    The script removes all the network drives(only the drives that appear in the array! so if a user has manually mapped a drive, this will not effect it!) and then simply re-add's them all again!

    This is a screenshot of the script being run, normally though it should just exit without seeing any of this:
    script_output.jpg
    the output is mearly there incase you want to manually run the script, or pipe it to a txt file or somthing...

    Enjoy!

    just to cover my arse:
    Although my code doesn't contain anything malicious I offer this "as is" and can not be held responsible for any loss of data, profits, life or consumable goods such as cookies, doughnuts or Coke Cola. IE. run it in a sandbox enviroment first! don't just throw it on all users startup!

    Tom
    Last edited by TornUp; 2nd February 2012 at 12:29 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 18
    Last Post: 4th December 2011, 10:44 PM
  2. Replies: 0
    Last Post: 28th July 2011, 01:37 PM
  3. Free Ram if anyone wants it?????
    By Millgate in forum General Chat
    Replies: 12
    Last Post: 22nd July 2011, 02:18 PM
  4. Replies: 9
    Last Post: 6th October 2010, 03:54 PM
  5. Group Policies and startup scripts
    By Hedghog in forum Windows
    Replies: 1
    Last Post: 16th June 2008, 12:43 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •