Skip to content

Get computer name length

Featured Replies

I recently realized that some of our computers have long names (>15 characters). Is there a way to determine or query how many computers have a name that is greater than 14 characters?

<br />I recently realized that some of our computers have long names (>15 characters). Is there a way to determine or query how many computers have a name that is greater than 14 characters?<br />

 

 

probably u can try the below query to get the results:you can also modify script to pipe the results into excel.

 

Set objSysInfo = CreateObject("ADSystemInfo")

strComputerDN = objSysInfo.ComputerName

Set objComputer = GetObject("LDAP://" & strComputerDN)

strFullDNSName = objComputer.dnsHostName

strHostNameOnly = left(strFullDNSName, instr(strFullDNSName, ".") - 1)

Wscript.Echo strHostNameOnly

 

BTW,Did u enable longer names in the computer account of the Active Directory domain. by default if the computer name is more than 15 characters ,it will take only first 15 characrts and join the computer to domain AFAIK.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.