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 ...
2nd February 2012, 01:20 PM #1
- Rep Power
AD Group conditional startup script if anyone wants?
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!
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!
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:
the format is: ('GroupName', 'DriveLetter', 'UncPath')
$drivelist = ('authenticated users', 'G:', '\\server\projects'),
('group1', 'Z:', '\\server\tsweb'),
('accounts', 'Y:', '\\server\tsweb')
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:
the output is mearly there incase you want to manually run the script, or pipe it to a txt file or somthing...
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!
Last edited by TornUp; 2nd February 2012 at 01:29 PM.
IDG Tech News
By FN-GM in forum Scripts
Last Post: 4th December 2011, 11:44 PM
By jamesfed in forum Hardware
Last Post: 28th July 2011, 02:37 PM
By Millgate in forum General Chat
Last Post: 22nd July 2011, 03:18 PM
By FN-GM in forum Scripts
Last Post: 6th October 2010, 04:54 PM
By Hedghog in forum Windows
Last Post: 16th June 2008, 01:43 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)