|
Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.
|
Categories |
OSD:How to Specify the Supported Platforms for a Driver(Microsoft)
Script Code
VBScript
Sub AddSupportedPlatform( objDriver, sDisplayName, sMaxVersion, sMinVersion, sName, sPlatform, sQuery1, sQuery2 )
Dim xmlDoc
Dim objPlatformNode
Dim objAttr
Dim objQuery1Node
Dim objQuery2Node
Dim objPlatformsNode
Dim objDriverNode
' Load the SDM Package XML.
Set xmlDoc = CreateObject("Msxml2.DOMDocument.6.0")
xmlDoc.async = False
xmlDoc.loadXML(objDriver.Properties_.item("SDMPackageXML"))
xmlDoc.setProperty _
"SelectionNamespaces","xmlns:dcm='http://schemas.microsoft.com/SystemsCenterConfigurationManager/2006/03/24/DesiredConfiguration'"
' Create a new platform node.
Set objPlatformNode = xmlDoc.createNode _
( 1, "PlatformApplicabilityCondition", _
"http://schemas.microsoft.com/SystemsCenterConfigurationManager/2006/03/24/DesiredConfiguration")
' Set DisplayName.
Set objAttr = xmlDoc.createAttribute("DisplayName")
objAttr.value = sDisplayName
objPlatformNode.setAttributeNode(objAttr)
' Set MaxVersion.
Set objAttr = xmlDoc.createAttribute("MaxVersion")
objAttr.value = sMaxVersion
objPlatformNode.setAttributeNode(objAttr)
' Set MinVersion.
Set objAttr = xmlDoc.createAttribute("MinVersion")
objAttr.value = sMinVersion
objPlatformNode.setAttributeNode(objAttr)
' Set Name.
Set objAttr = xmlDoc.createAttribute("Name")
objAttr.value = sName
objPlatformNode.setAttributeNode(objAttr)
' Set Platform.
Set objAttr = xmlDoc.createAttribute("Platform")
objAttr.value = sPlatform
objPlatformNode.setAttributeNode(objAttr)
' Set Query1.
Set objQuery1Node = xmlDoc.createNode(1, "Query1", "http://schemas.microsoft.com/SystemsCenterConfigurationManager/2006/03/24/DesiredConfiguration")
objQuery1Node.text = sQuery1
objPlatformNode.appendChild(objQuery1Node)
' Set Query2.
Set objQuery2Node = xmlDoc.createNode(1, "Query2", "http://schemas.microsoft.com/SystemsCenterConfigurationManager/2006/03/24/DesiredConfiguration")
objQuery2Node.text = sQuery2
objPlatformNode.appendChild(objQuery2Node)
' Append to platforms node.
Set objPlatformsNode = xmlDoc.selectSingleNode("/dcm:DesiredConfigurationDigest/dcm:Driver/dcm:PlatformApplicabilityConditions")
objPlatformsNode.appendChild(objPlatformNode)
' Increment the version number.
Set objDriverNode = xmlDoc.selectSingleNode("/dcm:DesiredConfigurationDigest/dcm:Driver")
Set objAttr = objDriverNode.attributes.getNamedItem("Version")
objAttr.value = objAttr.value + 1
' Save the object.
objDriver.Properties_.item("SDMPackageXML") = xmlDoc.xml
objDriver.Put_
End Sub
Platforms
For online peer support, join
The Official Scripting Guys Forum!
To provide feedback or report bugs in sample scripts, please start a new discussion on the Discussions tab for this script.
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Be the first to create a discussion.
|