I'm a little of the way there.
Here is a Webservice that returns the data I want in the format ZTIGather
needs, however, I am not able select a dynamic setting name. Maybe someone who
is good at LINQ can throw me a bone. The setting I am currently interested in
is "ADComputerGroups," so this works, but I would like this service to be more
generic. I want to get the column specified as "SettingName" rather than
explicitly list the value in that select statement.
Also, there is probably a better way to cast the parsed string array into the
List(of String)-Clearly, I have no idea what I am doing.
Public Class HCISMDT
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetListSetting(ByVal ID As String, ByVal Type As String,
ByVal SettingName As String) As List(Of String)
Dim MDTDB As New MDT2012Entities
Dim strSetting As String
Dim query = From sets In MDTDB.Settings _
Where sets.ID = ID _
And sets.Type = Type _
Select sets.ADComputerGroups
For Each v In query
strSetting = strSetting + v
Next
Dim strArray = Split(strSetting, ",")
Dim strList As New List(Of String)
For i = 0 To strArray.Count - 1
strList.Add(strArray(i))
Next
Return strList
End Function
End Class
From: [email protected] [mailto:[email protected]] On
Behalf Of Miller, Todd
Sent: Monday, December 30, 2013 12:18 PM
To: [email protected]
Subject: [MDT-OSD] Custom MDT setting as List
I would like to make a custom MDT setting that lists the AD groups a computer
should be added to.
I am using Maik's webservice to pull values from MDT Database.
So I have the Setting created in MDT DB, and I have the value "AddtoADGroups"
for a role set to ADgroup1;ADGroup2;ADGroup3.
The GetSetting webservice will return that string "ADgroup1;ADGroup2;ADGroup3"
Is there some built in method I can call or something that I can do that will
parse that string so that AddtoADGroups001=Adgroup1,
AddtoADGroups002=ADGroup2,AddtoADGroups3=ADGroup3?
I see I could set the values like that in CustomSettings.ini, but I want to
pull these from MDT. I need to convert the string that is returned by the
webservice into something MDT/OSD understands is a List value. Is assigning
AddtoADGroup(*) in properties enough? Does the ZTIGather just see that the
value is a list and chuck the ";" separated text into the 001, 002, etc?
[Settings]
Priority= Constants, GetADGroups, Default
Properties=RoleID, SettingType, ADGroupsSettingName, ComputerADGroups(*)
[Constants]
SettingType=R
ADGroupsSettingName=ADComputerGroups
[GetADGroups]
WebService=http://HC-CM12MP1.healthcare.uiowa.edu/mdtwebservice/mdt.asmx/GetSetting
Parameters=RoleID,SettingType,SettingName
RoleID=MDTID
SettingType=Type
ADGroupsSettingName=Setting
ComputerADGroups=string
I think that this may not work. The guide on-line I am seeing looks like
ZTIGather wants ...
<?xml version="1.0" encoding="UTF-8"?>
<ArrayOfString xmlns="http://dx21.llc/WS" xmlns:xsd="[url]" xmlns:xsi="[url]">
<string>ADGroup1</string>
<string>ADGroup2</string>
<string>ADGroup3</string>
</Array of String>
Where Maik's MDTwebservice returns the settings as
<?xml version="1.0" encoding="utf-8" ?>
<string
xmlns="http://maikkoster.com/Deployment">ADGroup1;ADGroup2;ADGroup3</string>
Is there a way to store an array in MDT DB so that MDTwebservice will return
the XML like ZTIConfigure is expecting? Is there a way to make ZTIGather parse
that string into MDT Values? I tried setting the setting to
"ADGROUP1","ADGroup2","ADGroup3" too, but that also returned a single string
and not multiple strings in XML. Would that be left to me as a programming
exercise?
Once I have the multivalue list filled in correctly, I will be able to use this
post to add the computer to multiple groups,
http://myitforum.com/cs2/blogs/maikkoster/archive/2012/07/05/handling-lists-in-mdt-web-service-calls-adding-computers-users-to-active-directory-groups.aspx
but I need a little help in getting the multivalued list filled in.
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and
may be legally privileged. If you are not the intended recipient, you are
hereby notified that any retention, dissemination, distribution, or copying of
this communication is strictly prohibited. Please reply to the sender that you
have received the message in error, then delete it. Thank you.
________________________________
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and
may be legally privileged. If you are not the intended recipient, you are
hereby notified that any retention, dissemination, distribution, or copying of
this communication is strictly prohibited. Please reply to the sender that you
have received the message in error, then delete it. Thank you.
________________________________