If not then I can write an error message to the file. Now the last bit is the real labour saving bit, when I discover a group, user, OU or site in a filter I can check in AD if it exists. The Powergui variable window is great for parsing the xml and working out what you need. Now that I have located a filter all I need to do is store it in a variable but before I can do that I need to figure out the attributes I need. I wrote functions to simplify things and given I need to do the same thing over and over functions are definitely the way to go. If there is no matching branch then the ‘count’ is set to 0 and I can use this to conditionally explore the XML node more or not. These are filters based on the object type so if a drive mapping were set if the users is a member of a group then there would be a FilterGroup element in the XML. There are four branches of the XML I’m interested in, users, groups, OUs and sites. $NoOfCollections = Count-Filters $driveMapSettingFilters.FilterCollection $driveMapSettingFilters = $driveMapSetting.Filters $driveMapSetting = $driveMapSettings.Drive You can have one or both of these by the way Having got the drive mappings and when looping through them I grabbed the filters and collections. Mosy in my scenario had only one collection but I wrote code to handle the one GPO that had two collections. Collections are groups of filters that are evaluated together and you can AND or OR the collections too if the mapping has more than one collection. The drive mappings are returned as an array of mappings so you can walk through them one at a time using a For loop and for each one you can extract the filters and collections. $($(Get-GPOReport -Name $GPOName -ReportType Xml)).DriveMapSettings Using the GPO commandlets you can extract the drive mappings like this – I used Powergui to navigate trhough the XML to find the required nodes I was interested in and the HTML reports to help me work out what information I’d need. You might think its easy to examine an XML file and to some extent it is, but if you don’t know the structure then just dumping out the information is about all you can do and this is no better than jst reading the XML file which you probably know if not very much fun. This is much better than the HTML report. Exporting the output to a CSV file is an easy way to document the GPO settings and also to highlight potential issues.Ī HTML report could be used but in my book at least a CSV file can be opened in Excel and then sorted to show the drive mapping info required. My solution is to the GrpupPolicy modules and extract an XML report from the Drive Mapping GPO and then parse the XML to confirm that the filters being used and the file paths are still valid. If you have a large number of mappings this can be a big problem. As with logon scripts the issue here is that over time you add to the drive mappings and never get around to checking if the drive mappings are still relevant. It should plan out the process, users, or groups it’s going to apply this network drive.Rather than use logon scripts you can configure drive mappings in a User Preference GPO. It makes admin and user’s life much better and makes changes to the network without having to update each user. user does not have to wait for the logon script to load or if the network path changes it automatically updates. Map a network drive via group policy is a much easier and faster process than manually or logon scripts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |