those on a windows domain or workgroup....

Windows specific forum
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

those on a windows domain or workgroup....

Post 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$)
Last edited by jassing on Fri Apr 28, 2023 10:35 pm, edited 1 time in total.
User avatar
jacdelad
Addict
Addict
Posts: 2004
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

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

Post 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]
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

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

Post 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!
Post Reply