How to know the PC domain

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have to check the migration of my 450 pc's from a domain to another.
The first step I'm doing it's to migrate the pc account from domain1 to
domain2, so i have to check the domain of every pc.
I know that I can check the %userdomain% but i can find any system variable
for 'pc domain'.
anyone have some ideas?
 
saghilar said:
i have to check the migration of my 450 pc's from a domain to another.
The first step I'm doing it's to migrate the pc account from domain1
to domain2, so i have to check the domain of every pc.
I know that I can check the %userdomain% but i can find any system
variable for 'pc domain'.
anyone have some ideas?
Hi,

Parse the output from "net.exe config workstation" in a batch file, or
use VBScript/WMI.


Batch file (do *not* remove the spaces in "workstation domain "):

'--------------------8<----------------------
@echo off
for /f "tokens=3" %%a in (
'net.exe config workstation^|find.exe /i "workstation domain "') do set domain=%%a
echo %domain%
'--------------------8<----------------------



VBScript/WMI:

'--------------------8<----------------------
sNode = "." ' use "." for local computer
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sNode & "\root\cimv2")
Set colComputer = oWMI.ExecQuery _
("Select DomainRole, Domain from Win32_ComputerSystem")
For Each oComputer in colComputer
iDR = oComputer.DomainRole
sName = oComputer.Domain
Next

If iDR = 0 Or iDR = 2 Then
WScript.Echo "Computer is in workgroup " & sName
Else
WScript.Echo "Computer is in domain " & sName
End If
'--------------------8<----------------------
 
I tried with batch file but i receive the message 'echo is off' and not the
name of domain
may be I have to customize the batch?
 
saghilar said:
I tried with batch file but i receive the message 'echo is off'
and not the name of domain
may be I have to customize the batch?
Hi,

Is this computer running the English version of WinXP?

If you run this command in a command prompt:

net.exe config workstation

what is the exact output? (you can copy paste from the command
prompt)
 
Hi
I use the italian version of wxp, this the output of the command:


C:\Documents and Settings\Administrator>net.exe config workstation
Nome computer \\ITSC00517
Nome computer completo itsc00517.lonzagroup.net
Nome utente Administrator

Workstation attiva su
NetbiosSmb (000000000000)
NetBT_Tcpip_{1D2E91C9-1C25-42A1-BD8E-1E47D10801B3} (000D6077EB55)

Versione del software Windows 2002

Dominio della workstation LONZAGROUP
Nome DNS del dominio della workstation lonzagroup.net
Dominio di accesso LONZA.IT

Timeout apertura COM (sec) 0
Conteggio invio COM (byte) 16
Timeout invio COM (msec) 250
Esecuzione comando riuscita.
 
saghilar said:
Hi
I use the italian version of wxp, this the output of the command:

(snip)
Hi,

This should work for Italian versions of WinXP:

--------------------8<----------------------
@echo off
for /f "tokens=4" %%a in (
'net.exe config workstation^|find.exe "Dominio della workstation"') do set domain=%%a
echo %domain%
pause
--------------------8<----------------------
 
Back
Top