![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Export specific settings from GPO Hi, I am trying to create a text file from exported GPO's. I have found the following script which produces a report on a GPO: *************************************************************************************************** ' This VBScript code generates a HTML report of all the properties ' and settings for a GPO. ' --------------------------------------------------------------- ' From the book "Active Directory Cookbook" by Robbie Allen ' ISBN: 0-596-00466-4 ' --------------------------------------------------------------- ' ------ SCRIPT CONFIGURATION ------ strGPO = "<GPOName>" ' e.g. Sales GPO strDomain = "<DomainDNSName>" ' e.g. rallencorp.com strReportFile = "<FileNameAndPath>" ' e.g. c:\gpo_report.html ' ------ END CONFIGURATION --------- set objGPM = CreateObject("GPMgmt.GPM") set objGPMConstants = objGPM.GetConstants() ' Initialize the Domain object set objGPMDomain = objGPM.GetDomain(strDomain, "", objGPMConstants.UseAnyDC) set objGPMSearchCriteria = objGPM.CreateSearchCriteria objGPMSearchCriteria.Add objGPMConstants.SearchPropertyGPODisplayName, _ objGPMConstants.SearchOpEquals, cstr(strGPO) set objGPOList = objGPMDomain.SearchGPOs(objGPMSearchCriteria) if objGPOList.Count = 0 then WScript.Echo "Did not find GPO: " & strGPO WScript.Echo "Exiting." WScript.Quit elseif objGPOList.Count > 1 then WScript.Echo "Found more than one matching GPO. Count: " & _ objGPOList.Count WScript.Echo "Exiting." WScript.Quit else WScript.Echo "Found GPO: " & objGPOList.Item(1).DisplayName end if set objGPMResult = objGPOList.Item(1).GenerateReportToFile(objGPMConstants.ReportHTML, _ strReportFile) ' This will throw an exception if there were any errors ' during the actual operation. on error resume next objGPMResult.OverallStatus() if objGPMResult.Status.Count > 0 then WScript.Echo "Status message(s): " & objGPMResult.Status.Count for i = 1 to objGPMResult.Status.Count WScript.Echo objGPMResult.Status.Item(i).Message next WScript.Echo vbCrLf end if ' Display the result if Err.Number <> 0 then WScript.Echo "Error generating report." WScript.Echo "Error: " & Err.Description else WScript.Echo "Reported saved to " & strReportFile end if *************************************************************************************************** This successfully creates an html file as expected. I am however unable to read that html file using vbscript to export the relevant parts. It will just output 3 characters and then blank lines. What I would ideally like to do is to edit the above script and place the report into a string. Does anyone know how to achieve this? Thanks, Ben |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| script to parse specific gpo settings | VB Script | |||
| Is it possible to export specific emails from Outlook Express and Import it into Windows Mail? | Vista mail | |||
| Can you format specific reply settings? | Live Mail | |||
| Export Settings/Options/Preferences whatever | Live Mail | |||
| Export MediaCenter Settings | Vista performance & maintenance | |||