73
edits
Changes
→Multiple Profile Method: new code - insert additional manual profiles
' Modifed by: Marc Ozin
' Modified Date: 2010-03-02
' Modification:
' Hosts generated with multiple Profile-IDs to show each sub OU the Host resides within.
' e.g. if Computer1 is contained within Head-Office/Finance/Payroll the following Profile-IDs will be generated:
' <host name="Computer1" >' <profile-id="/root"/>' <profile -id="/root/Head-Office" />' <profile -id="/root/Head-Office/Finance" />' <profile -id="/root/Head-Office/Finance/Payroll" />
' </host>
' Modifed by: Marc Ozin' Modified Date: 2011-08-09' Modification:' after compiling profiles from AD, any computers listed that also exist in the hosts-manual.xml file have extra profiles attached.' the format of the hosts-manual.xml is as follows:' <wpkg>' <profile>' <profile id="manualprofile1">' <host name="computer1"/>' <host name="computer2"/>' <host name="computer3"/>' </profile>' <profile id="manualprofile2">' <host name="computer1"/>' <host name="computer4"/>' <host name="computer6"/>' </profile>'</wpkg>
Const ADS_SCOPE_SUBTREE = 2
Const VBquot = """"
Const ManualHostFile = "hosts-manual.xml"
Const wpkgPath = "\\myserver\wpkg$"
Dim objProfileNodes, ProfileNodeItem, objHostNodes
set fs = CreateObject("Scripting.FileSystemObject")
set textstream = fs.CreateTextFile(wpkgPath & "\hosts.xml", True)
textstream.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf
textstream.WriteLine "<!-- automagically generated with " & Wscript.ScriptFullName
textstream.WriteLine "</wpkg>"
textstream.close
</source>
You'll need to edit the line:<source lang="vb">Const wpkgPath = "\\myserver\wpkg$"</source>...replacing it with the path to your wpkg folder.
Don't forget you'll need to create a profile definition in the profiles.xml for all of the profiles that this script will create!
This version also allows you to build manual profile entries as well.
to use additional manual profiles, create a file called hosts-manual.xml in the wpkg folder like this:
<source lang="xml">
<wpkg>
<profile>
<profile id="manualprofile1">
<host name="computer1"/>
<host name="computer2"/>
<host name="computer3"/>
</profile>
<profile id="manualprofile2">
<host name="computer1"/>
<host name="computer4"/>
<host name="computer6"/>
</profile>
</wpkg>
</source>
[[category:Documentation]]
[[category:Installation]]