Page 1 of 1

those on a windows domain or workgroup....

Posted: Fri Apr 28, 2023 9:40 pm
by jassing
Any chance you could run this & let me know the results? I live mostly offgrid (generator, batteries, etc), and am working on a project for a domain & workgroup - but I only have a laptop here...
I am only interested in x64 windows...

Thanks for considering...

Code: Select all

Enumeration COMPUTER_NAME_FORMAT            ;thanks to jacdelad
  #ComputerNameNetBIOS                      ;[computer name]
  #ComputerNameDnsHostname                  ;[computer name]
  #ComputerNameDnsDomain                    ;[domain]
  #ComputerNameDnsFullyQualified            ;[computer name].[domain]
  #ComputerNamePhysicalNetBIOS              ;[computer name]
  #ComputerNamePhysicalDnsHostname          ;[computer name]
  #ComputerNamePhysicalDnsDomain            ;[domain]
  #ComputerNamePhysicalDnsFullyQualified    ;[computer name].[domain]
  #ComputerNameMax                          ;[empty]
EndEnumeration
Import "Kernel32.lib"
  GetComputerNameExW(NameType, *lpBuffer, *nSize)
EndImport

Procedure.s GetComputerName(NameType = #ComputerNamePhysicalDnsFullyQualified)
  Protected *lpBuffer, nSize = 4096
  Protected.s name
  *lpBuffer = AllocateMemory(4096)
  If GetComputerNameExW(NameType, *lpBuffer, @nSize) 
    name = PeekS(*lpBuffer, nSize)
  EndIf
  FreeMemory(*lpBuffer)
  ProcedureReturn name
EndProcedure

result$=""
For x = #ComputerNameNetBIOS To #ComputerNameMax
  result$ + Str(x)+":"+GetComputerName(x)+#CRLF$
Next
SetClipboardText(result$)

Re: those on a windows domain or workgroup....

Posted: Fri Apr 28, 2023 10:04 pm
by jacdelad
I'm on my company computer right now, so I can't post the plain results. But they are:
0:[computer name]
1:[computer name]
2:[domain]
3:[computer name].[domain]
4:[computer name]
5:[computer name]
6:[domain]
7:[computer name].[domain]
8:[empty]

Re: those on a windows domain or workgroup....

Posted: Fri Apr 28, 2023 10:32 pm
by jassing
jacdelad wrote: Fri Apr 28, 2023 10:04 pm I'm on my company computer right now, so I can't post the plain results. But they are:
Perfect! Thank you. I just wanted to confirm that the domain is in there.
Much appreciated!