I inherited this PowerShell logon script from a colleague. It changes the default save locations of Office apps to specific UNC paths (team sites in Sharepoint) based on AD group membership. Every AD group related to a SharePoint team is listed in the script. When launched, the script goes through every AD group, checking one-by-one whether the user is a member of that AD group, and then sets the default save locations of Word, Excel and PowerPoint (registry value) based on the UNC paths listed in the script corresponding to the AD groups.
If the script doesn't find a match at all, it does nothing.
If it finds a match on one of the groups, it sets the registry values accordingly.
If it finds a match on more than one group, then it sets the default save location to K:\My Documents
This was OK when there was a handful of these groups, but now there are over two hundred, and as you can imagine, this script now takes about a minute to complete.
All the groups begin with "EDRMS - " so I was thinking it would be better the other way around, i.e. the script goes through a list of all the AD groups an user is a member of, finds the ones that begin with "EDRMS - ", then checks some sort of lookup table with groups names and UNC paths, then sets the registry values accordingly. Would anyone be able to change the original script (attached) to do this (or, another method if you think it will result in quicker processing)? I'm afraid that my PowerShell knowledge isn't up to this job.
What is the best way to store the table of group names and UNC paths? Would CSV file be a quick and efficient way? I was thinking an external file of some kind would be good in terms of manageability, because I could then delegate the responsibility of adding a new entries to our 1st line team, rather than needing to have scripting knowledge to do it.