Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Export specific settings from GPO

Reply
 
Old 10-16-2008   #1 (permalink)
Brazil


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46