Quantcast
Channel: Microsoft Deployment Toolkit forum
Viewing all articles
Browse latest Browse all 11297

Computer Description in AD through MDT

$
0
0

Hi

 

I would need to set the computer description in AD during my deployment. below is the script which i have written and im not sure where it is failing but was not able to set the description during the deployment. i dont have a webservice installed and running on my environment and would need to without that. kindly confirm how do i perform withoout a webservice

i have also made the changes on the Deploywiz_Definiton_ENU.XML for entering the description.

 

<job id="ZTISetComputerDescriptionInAD">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">

Option Explicit

Dim WshShell
Dim objConnection, objCommand, objRecordSet, strDN, objComputer, desc, message
Dim strComputerName, strSite, domainController
Const ADS_SCOPE_SUBTREE = 2

strComputerName = oEnvironment.Item("OSDComputerName")
strSite = oEnvironment.Item("destSite")
domainController = oEnvironment.Item("nearDom")


Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =  CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE


Set WshShell = WScript.CreateObject("Wscript.Shell")
If oEnvironment.Item("ComputerDescription") = "" Then

 oLogging.CreateEntry "No Computer Description set...", LogTypeWarning
Else
 oLogging.CreateEntry "Computer Description variable set to: " & oEnvironment.Item("ComputerDescription"), LogTypeInfo
 Set dso = GetObject("LDAP:")
 Set oGroup = dso.OpenDSObject("LDAP://" & domainController & "/" & oEnvironment.Item("sourceSite"), oEnvironment.Item("DomainAdminDomain") & "\" & oEnvironment.Item("DomainAdmin"), oEnvironment.Item("DomainAdminPassword"), ADS_SECURE_AUTHENTICATION + ADS_SERVER_BIND + ADS_FAST_BIND )
 oGroup.Put "description", oEnvironment.Item("ComputerDescription")
 oGroup.Setinfo

 If Err Then
  oLogging.CreateEntry "GetObject Error: " & Err.Number & ") (Error Description: " & Err.Description & ").", LogTypeError
  oLogging.CreateEntry "Could not update object, most likley due to missing permissions in Active Directory. Configure this action to run as a user with permissions to update computer accounts in Active Directory (select to Load the users profile).", LogTypeError
 End If


End If

 

 

 

</script>
</job>


Viewing all articles
Browse latest Browse all 11297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>