'setvirtualattributes.vbs 'Sets the isVirtual and vmType custom attributes 'for computer objects in AD. 'set variables 'blnIsVirtual - set to "true" to label VMs or ' set to "false" to label physical systems blnIsVirtual = true 'strVMtype -- Virtualization platform identifier ' strVMtype values: ' Vesx – VMware ESX VM ' Vms – Microsoft Virtual Server VM ' Vxen – Xen VM ' Vvi – Virtual Iron VM ' Vvz – SWsoft Virtuozzo virtual private server ' Vscon – Solaris Container strVMtype = "Vesx" 'strDomainTarget -- this is the AD container ' where the target computer accounts are located strDomainTarget = "cn=computers,dc=virtual,dc=net" 'strSourceFile -- file that contains computer ' account list strSourceFile = "c:\computers.txt" ' Constants Const ForReading = 1 'Open Source File Set objFSO = CreateObject("Scripting.FileSystemObject") set objSourceFile = objFSO.OpenTextFile(strSourceFile,_ ForReading, True) 'Connect to Directory Service and 'Modify isVirtual and vmType attributes for ' each computer in source file list Do Until objSourceFile.AtEndOfStream strcomputer = objSourceFile.Readline strADSpath = "LDAP://cn=" & strcomputer & _ "," & strDomainTarget Set objComputer = GetObject(strADSpath) objComputer.put "isVirtual" , blnIsVirtual objComputer.put "vmType" , strVMtype objComputer.SetInfo Loop