Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: domain account computer machine member
;Sample code to obtain the name of the domain to which the computer belongs #DefineFunction GetDomainName(computername,username, password) Locator = ObjectCreate("WbemScripting.SWbemLocator") Service = Locator.ConnectServer(computername,"root/cimv2",username,password) Security = Service.Security_ Security.ImpersonationLevel = 3 Class = "Win32_ComputerSystem" Instance = Service.InstancesOf(Class) ForEach obj In Instance If Obj == 0 Then Break domain = Obj.Domain Next Instance = 0 Security = 0 Service = 0 Locator = 0 Return domain #EndFunction computername = "BData001" dom = GetDomainName(computername,"", "") Message("Name of the domain to which the computer belongs", dom) Exit
Article ID: W15789
File Created: 2010:04:02:08:52:42
Last Updated: 2010:04:02:08:52:42