Jump to content

Softwaredeployment mit Wpkg


Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Recommended Posts

Hey,

 

ich implementiere gerade softewaredeployment mit wpkg. Dazu habe ich ein vbs, welches die Rechner im Netz ausliest.

 

Const ADS_SCOPE_SUBTREE = 2

set fs = CreateObject("Scripting.FileSystemObject")
set textstream = fs.CreateTextFile("hosts.xml", True)
textstream.WriteLine "<?xml version=""1.0"" encoding=""UTF-8""?>" & vbCrLf
textstream.WriteLine "<!-- automagically generated with " & Wscript.ScriptFullName 
textstream.WriteLine "     Date: " & Date() & "  -->" & vbCrLf & vbCrLf
textstream.WriteLine "<wpkg>"

Set rootDSE = GetObject("LDAP://RootDSE")
domainContainer =  rootDSE.Get("defaultNamingContext")

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

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
    "Select Name, distinguishedName from 'LDAP://" & domainContainer & "' " _
        & "Where objectClass='computer'"  
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
    'Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
    'Wscript.Echo "distinguishedName: " & objRecordSet.Fields("distinguishedName").Value
    arrPath = Split(objRecordSet.Fields("distinguishedName").Value, ",")
    strOU = ""
    for each a in arrPath
		  if left(a,2) = "OU" Then
			  strOU = "/" & right(a,len(a) - 3) & strOU 
			End If
		Next
		'Wscript.Echo "Path: " & StrOU
		textstream.WriteLine vbTab & "<host name=""" & objRecordSet.Fields("Name").Value & """ profile-id=""" & StrOU & """ />"
    objRecordSet.MoveNext
Loop

textstream.WriteLine "</wpkg>"
textstream.close
Wscript.Echo "Finished..."

Hat einer eine Idee, wie ich wichtige Rechner, also server, außen vor lassen kann?

 

MfG

Link to comment
Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte erstelle einen neuen Beitrag zu Deiner Anfrage!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...